summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/issue-67007-escaping-data.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/nll/issue-67007-escaping-data.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/nll/issue-67007-escaping-data.rs b/src/test/ui/nll/issue-67007-escaping-data.rs
new file mode 100644
index 000000000..49ea2e596
--- /dev/null
+++ b/src/test/ui/nll/issue-67007-escaping-data.rs
@@ -0,0 +1,24 @@
+// Regression test for issue #67007
+// Ensures that we show information about the specific regions involved
+
+// Covariant over 'a, invariant over 'tcx
+struct FnCtxt<'a, 'tcx: 'a>(&'a (), *mut &'tcx ());
+
+impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
+ fn use_it(&self, _: &'tcx ()) {}
+}
+
+struct Consumer<'tcx>(&'tcx ());
+
+impl<'tcx> Consumer<'tcx> {
+ fn bad_method<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) {
+ let other = self.use_fcx(fcx); //~ ERROR lifetime may not live long enough
+ fcx.use_it(other);
+ }
+
+ fn use_fcx<'a>(&self, _: &FnCtxt<'a, 'tcx>) -> &'a () {
+ &()
+ }
+}
+
+fn main() {}