Open
Description
I tried this code:
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;
#[custom_mir(dialect = "runtime", phase = "initial")]
pub fn wrong(arg: char) -> char {
mir!({
let temp = arg;
RET = temp;
temp = 'b';
Return()
})
}
fn main() {
assert_eq!('a', wrong('a'));
}
$ rustc +master -Zmir-opt-level=0 -Zmir-enable-passes=+RenameReturnPlace test3.rs
$ ./test3
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `'a'`,
right: `'b'`', test3.rs:16:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Meta
Reproduces on master at f5adff6bd8b29ac7dd173b36f0c8c35bb1c593c5
, as well as
rustc --version --verbose
:
rustc 1.71.0-nightly (7908a1d65 2023-04-17)
binary: rustc
commit-hash: 7908a1d65496b88626e4b7c193c81d777005d6f3
commit-date: 2023-04-17
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2