Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM assert with simple closures #3052

Closed
brson opened this issue Jul 29, 2012 · 3 comments
Closed

LLVM assert with simple closures #3052

brson opened this issue Jul 29, 2012 · 3 comments
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@brson
Copy link
Contributor

brson commented Jul 29, 2012

type Connection = fn@(~[u8]);
type ConnectionFactory = fn@() -> option<Connection>;

fn main() {
    let mock_connection: Connection = |data| { };

    let mock_connection_factory: ConnectionFactory = || {
        some(mock_connection)
    };
}
rustc: /home/brian/dev/rust/src/llvm/lib/VMCore/Instructions.cpp:280: void llvm::CallInst::init(llvm::Value*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
@brson
Copy link
Contributor Author

brson commented Jul 29, 2012

A simpler test case

type Connection = fn@(~[u8]);

fn f() -> option<Connection> {
    let mock_connection: Connection = fn@(data: ~[u8]) { };
    some(mock_connection)
}

fn main() {
}

@brson
Copy link
Contributor Author

brson commented Jul 31, 2012

This works:

type Connection = fn@(+~[u8]);

fn f() -> option<Connection> {
    let mock_connection: Connection = fn@(+data: ~[u8]) { };
    some(mock_connection)
}

fn main() {
}

The argument mode for one of the function types ends up being infer and the other expl, so type_of creates two different LLVM nominal types for their option types.

@catamorphism
Copy link
Contributor

This compiles successfully, possibly due to de-moding, with d2ad028:

use option::*;

type Connection = fn@(~[u8]);

fn f() -> Option<Connection> {
    let mock_connection: Connection = fn@(_data: ~[u8]) { };
    Some(mock_connection)
}

fn main() {
}

bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
added a note about the use of the RUST_LOG environment variable
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Upgrades the Rust toolchain to `nightly-2024-03-01`. The Rust compiler
PRs that triggered changes in this upgrades are:
 * rust-lang#121516
 * rust-lang#121598
 * rust-lang#121489
 * rust-lang#121783
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants