mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
b3a47d9b6b
This commit desugars the drop and replace deriving from an assignment at MIR build, avoiding the construction of the DropAndReplace terminator (which will be removed in a followign PR) In order to retain the same error messages for replaces a new DesugaringKind::Replace variant is introduced.
11 lines
239 B
Rust
11 lines
239 B
Rust
fn main() {
|
|
let mut greeting = "Hello world!".to_string();
|
|
let res = (|| (|| &greeting)())();
|
|
|
|
greeting = "DEALLOCATED".to_string();
|
|
//~^ ERROR cannot assign
|
|
drop(greeting);
|
|
|
|
println!("thread result: {:?}", res);
|
|
}
|