-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Description
Test case
#![feature(rustc_attrs)]
#[rustc_mir(pretty = "foo.mir")]
fn foo() -> [String; 2] {
[String::from("test"), loop {}]
}
fn main() {
println!("{:?}", foo());
}Generated MIR for foo
fn() -> [collections::string::String; 2] {
let mut tmp0: collections::string::String;
let mut tmp1: collections::string::String;
bb0: {
tmp0 = core::convert::From::from(const "test") -> [return: bb3, unwind: bb2];
}
bb1: {
return;
}
bb2: {
drop tmp0;
resume;
}
bb3: {
tmp1 = ();
goto -> bb3;
}
}Notice how the function foo assigns an rvalue () to tmp1 which has type collections::string::String. This seems to not affect the built executable since tmp1 = () is a no-op, but MIR should probably be type-correct at this stage.
Metadata
Metadata
Assignees
Labels
No labels