]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-67007-escaping-data.rs
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
[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 #![feature(nll)]
5
6 // Covariant over 'a, invariant over 'tcx
7 struct FnCtxt<'a, 'tcx: 'a>(&'a (), *mut &'tcx ());
8
9 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10     fn use_it(&self, _: &'tcx ()) {}
11 }
12
13 struct Consumer<'tcx>(&'tcx ());
14
15 impl<'tcx> Consumer<'tcx> {
16     fn bad_method<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) {
17         let other = self.use_fcx(fcx); //~ ERROR borrowed data
18         fcx.use_it(other);
19     }
20
21     fn use_fcx<'a>(&self, _: &FnCtxt<'a, 'tcx>) -> &'a () {
22         &()
23     }
24 }
25
26 fn main() {}