Skip to content

[MIR-opt] MIR inlining handles closures incorrectly #45894

Closed
@arielb1

Description

@arielb1
$ rustc -V
rustc 1.23.0-nightly (90ef3372e 2017-10-29)
$ rustc klosure.rs
$ ./klosure 
28
$ rustc klosure.rs -Z mir-opt-level=2
Function return type does not match operand type of return inst!
  ret { i32, [0 x i8], i32, [0 x i8] } %15
 i32LLVM ERROR: Broken function found, compilation aborted!

Code:

fn main() {
    println!("{}", foo(0, 14));
}

fn foo<T: Copy>(_t: T, q: i32) -> i32 {
    let x = |_t, _q| _t;
    x(q*2, q*3)
}

Expected result: no LLVM assert, should work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions