]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs
Rollup merge of #103644 - catlee:catlee/option-question-mark-docs, r=workingjubilee
[rust.git] / src / test / ui / nll / issue-54556-temps-in-tail-diagnostic.rs
1 fn main() {
2     {
3         let mut _thing1 = D(Box::new("thing1"));
4         // D("other").next(&_thing1).end()
5         D(&_thing1).end() //~ ERROR does not live long enough
6     }
7
8     ;
9 }
10
11 #[derive(Debug)]
12 struct D<T: std::fmt::Debug>(T);
13
14 impl<T: std::fmt::Debug>  Drop for D<T> {
15     fn drop(&mut self) {
16         println!("dropping {:?})", self);
17     }
18 }
19
20 impl<T: std::fmt::Debug> D<T> {
21     fn next<U: std::fmt::Debug>(&self, _other: U) -> D<U> { D(_other) }
22     fn end(&self) { }
23 }