We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent baf9a7c commit 60be2deCopy full SHA for 60be2de
src/test/ui/let-else/let-else-temporary-lifetime.rs
@@ -29,6 +29,21 @@ fn main() {
29
assert_eq!(TRACKER.load(Ordering::Acquire), 1);
30
println!("Should have dropped 👆");
31
32
+ {
33
+ // cf. https://github.com/rust-lang/rust/pull/99518#issuecomment-1191520030
34
+ struct Foo<'a>(&'a mut u32);
35
+
36
+ impl<'a> Drop for Foo<'a> {
37
+ fn drop(&mut self) {
38
+ *self.0 = 0;
39
+ }
40
41
+ let mut foo = 0;
42
+ let Foo(0) = Foo(&mut foo) else {
43
+ *&mut foo = 1;
44
+ todo!()
45
+ };
46
47
{
48
let x = String::from("Hey");
49
@@ -61,6 +76,8 @@ fn main() {
61
76
}
62
77
63
78
// test let-else drops temps before else block
79
+ // NOTE: this test has to be the last block in the `main`
80
+ // body.
64
81
let rc = Rc::new(0);
65
82
let 1 = *rc.clone() else {
66
83
Rc::try_unwrap(rc).unwrap();
0 commit comments