You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::sync::Mutex;#[derive(Clone,Debug)]structA{}fnmain(){let n = Mutex::new(Some(A{}));ifletSome(a) = {let a = n.lock().unwrap(); a.clone()}{
n.lock();}println!("This is ok");ifletSome(a) = {let a = n.lock(); a.unwrap().clone()}{
n.lock();}println!("Never reached !!!!");}
Output:
Finished dev [unoptimized + debuginfo] target(s) in 0.56s
Running `target/debug/playground`
/root/entrypoint.sh: line 8: 7 Killed timeout --signal=KILL ${timeout} "$@"
Standard Output
This is ok
The text was updated successfully, but these errors were encountered:
@jonas-schievink well, what you said, plus the detail about how the temporaries in tail expressions of a block are given the dynamic extent of the block's parent, right?
Yes, indeed. Looks like #37612 (comment) explains this quite well, and that issue is basically the same as this (minus the if let -> match desugaring), so I'll close this as a duplicate of #37612.
The code:
Output:
The text was updated successfully, but these errors were encountered: