]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-67007-escaping-data.rs
Auto merge of #105121 - oli-obk:simpler-cheaper-dump_mir, r=nnethercote
[rust.git] / src / test / ui / nll / issue-67007-escaping-data.rs
1 // Regression test for issue #67007
2 // Ensures that we show information about the specific regions involved
3
4 // Covariant over 'a, invariant over 'tcx
5 struct FnCtxt<'a, 'tcx: 'a>(&'a (), *mut &'tcx ());
6
7 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8     fn use_it(&self, _: &'tcx ()) {}
9 }
10
11 struct Consumer<'tcx>(&'tcx ());
12
13 impl<'tcx> Consumer<'tcx> {
14     fn bad_method<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) {
15         let other = self.use_fcx(fcx); //~ ERROR lifetime may not live long enough
16         fcx.use_it(other);
17     }
18
19     fn use_fcx<'a>(&self, _: &FnCtxt<'a, 'tcx>) -> &'a () {
20         &()
21     }
22 }
23
24 fn main() {}