Skip to content

Commit 3feffd4

Browse files
committed
Regression test for rust-lang#22323.
1 parent 1e21c9a commit 3feffd4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// rust-lang/rust#22323: regression test demonstrating that NLL
2+
// precisely tracks temporary destruction order.
3+
4+
// compile-pass
5+
6+
#![feature(nll)]
7+
8+
fn main() {
9+
let _s = construct().borrow().consume_borrowed();
10+
}
11+
12+
fn construct() -> Value { Value }
13+
14+
pub struct Value;
15+
16+
impl Value {
17+
fn borrow<'a>(&'a self) -> Borrowed<'a> { unimplemented!() }
18+
}
19+
20+
pub struct Borrowed<'a> {
21+
_inner: Guard<'a, Value>,
22+
}
23+
24+
impl<'a> Borrowed<'a> {
25+
fn consume_borrowed(self) -> String { unimplemented!() }
26+
}
27+
28+
pub struct Guard<'a, T: ?Sized + 'a> {
29+
_lock: &'a T,
30+
}
31+
32+
impl<'a, T: ?Sized> Drop for Guard<'a, T> { fn drop(&mut self) {} }

0 commit comments

Comments
 (0)