summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs
new file mode 100644
index 000000000..1078f77a0
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs
@@ -0,0 +1,15 @@
+struct Invariant<'a> {
+ f: Box<dyn FnOnce() -> *mut &'a isize + 'static>,
+}
+
+fn to_same_lifetime<'r>(b_isize: Invariant<'r>) {
+ let bj: Invariant<'r> = b_isize;
+}
+
+fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+ b_isize
+ //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {
+}