]> git.lizzy.rs Git - rust.git/commitdiff
unboxed-closures and type-alias-impl-trait nll revisions
authorJack Huey <31162821+jackh726@users.noreply.github.com>
Sat, 2 Apr 2022 15:08:16 +0000 (11:08 -0400)
committerJack Huey <31162821+jackh726@users.noreply.github.com>
Tue, 5 Apr 2022 15:42:44 +0000 (11:42 -0400)
16 files changed:
src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr [new file with mode: 0644]
src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr
src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs
src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr [deleted file]
src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr [new file with mode: 0644]
src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr
src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs
src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr [deleted file]
src/test/ui/unboxed-closures/issue-30906.base.stderr [new file with mode: 0644]
src/test/ui/unboxed-closures/issue-30906.nll.stderr
src/test/ui/unboxed-closures/issue-30906.rs
src/test/ui/unboxed-closures/issue-30906.stderr [deleted file]
src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr [new file with mode: 0644]
src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr
src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs
src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr [deleted file]

diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr
new file mode 100644 (file)
index 0000000..a3b410c
--- /dev/null
@@ -0,0 +1,29 @@
+error: at least one trait must be specified
+  --> $DIR/generic_type_does_not_live_long_enough.rs:14:24
+   |
+LL | type WrongGeneric<T> = impl 'static;
+   |                        ^^^^^^^^^^^^
+
+error: non-defining opaque type use in defining scope
+  --> $DIR/generic_type_does_not_live_long_enough.rs:10:18
+   |
+LL |     let z: i32 = x;
+   |                  ^
+   |
+note: used non-generic type `&'static i32` for generic parameter
+  --> $DIR/generic_type_does_not_live_long_enough.rs:14:19
+   |
+LL | type WrongGeneric<T> = impl 'static;
+   |                   ^
+
+error[E0310]: the parameter type `T` may not live long enough
+  --> $DIR/generic_type_does_not_live_long_enough.rs:18:5
+   |
+LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
+   |                  - help: consider adding an explicit lifetime bound...: `T: 'static`
+LL |     t
+   |     ^ ...so that the type `T` will meet its required lifetime bounds
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0310`.
index dc85db66d32ba4d9adad945b9a9c4ef848712567..db771d211322c8f53776a358d3e67c210c140468 100644 (file)
@@ -1,23 +1,23 @@
 error: at least one trait must be specified
-  --> $DIR/generic_type_does_not_live_long_enough.rs:10:24
+  --> $DIR/generic_type_does_not_live_long_enough.rs:14:24
    |
 LL | type WrongGeneric<T> = impl 'static;
    |                        ^^^^^^^^^^^^
 
 error: non-defining opaque type use in defining scope
-  --> $DIR/generic_type_does_not_live_long_enough.rs:6:18
+  --> $DIR/generic_type_does_not_live_long_enough.rs:10:18
    |
 LL |     let z: i32 = x;
    |                  ^
    |
 note: used non-generic type `&'static i32` for generic parameter
-  --> $DIR/generic_type_does_not_live_long_enough.rs:10:19
+  --> $DIR/generic_type_does_not_live_long_enough.rs:14:19
    |
 LL | type WrongGeneric<T> = impl 'static;
    |                   ^
 
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/generic_type_does_not_live_long_enough.rs:14:5
+  --> $DIR/generic_type_does_not_live_long_enough.rs:18:5
    |
 LL |     t
    |     ^
index cb90776472b5dc543fd395548d0cbe41082ca61f..2ad7e615e19cc016b3ea8cab1e1b0a1a276f89c0 100644 (file)
@@ -1,5 +1,9 @@
 #![feature(type_alias_impl_trait)]
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 fn main() {
     let y = 42;
     let x = wrong_generic(&y);
diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
deleted file mode 100644 (file)
index 15ec2ee..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-error: at least one trait must be specified
-  --> $DIR/generic_type_does_not_live_long_enough.rs:10:24
-   |
-LL | type WrongGeneric<T> = impl 'static;
-   |                        ^^^^^^^^^^^^
-
-error: non-defining opaque type use in defining scope
-  --> $DIR/generic_type_does_not_live_long_enough.rs:6:18
-   |
-LL |     let z: i32 = x;
-   |                  ^
-   |
-note: used non-generic type `&'static i32` for generic parameter
-  --> $DIR/generic_type_does_not_live_long_enough.rs:10:19
-   |
-LL | type WrongGeneric<T> = impl 'static;
-   |                   ^
-
-error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/generic_type_does_not_live_long_enough.rs:14:5
-   |
-LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
-   |                  - help: consider adding an explicit lifetime bound...: `T: 'static`
-LL |     t
-   |     ^ ...so that the type `T` will meet its required lifetime bounds
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr
new file mode 100644 (file)
index 0000000..be77b60
--- /dev/null
@@ -0,0 +1,11 @@
+error: implementation of `FnOnce` is not general enough
+  --> $DIR/issue-57611-trait-alias.rs:25:9
+   |
+LL |         |x| x
+   |         ^^^^^ implementation of `FnOnce` is not general enough
+   |
+   = note: closure with signature `fn(&'2 X) -> &X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
+   = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
+
+error: aborting due to previous error
+
index 91daa65d6563a33f2d8b89dfd08a262f39e7f647..f5b91567ff53170c469f15b77bffbef65f3971ed 100644 (file)
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-57611-trait-alias.rs:20:9
+  --> $DIR/issue-57611-trait-alias.rs:25:9
    |
 LL |         |x| x
    |         ^^^^^ one type is more general than the other
@@ -7,13 +7,13 @@ LL |         |x| x
    = note: expected type `for<'r> Fn<(&'r X,)>`
               found type `Fn<(&X,)>`
 note: this closure does not fulfill the lifetime requirements
-  --> $DIR/issue-57611-trait-alias.rs:20:9
+  --> $DIR/issue-57611-trait-alias.rs:25:9
    |
 LL |         |x| x
    |         ^^^^^
 
 error: implementation of `FnOnce` is not general enough
-  --> $DIR/issue-57611-trait-alias.rs:20:9
+  --> $DIR/issue-57611-trait-alias.rs:25:9
    |
 LL |         |x| x
    |         ^^^^^ implementation of `FnOnce` is not general enough
index 7c6e764248479544c20025f46403e2bb04741252..e95ddab75bee407aae93febc78a5f2383159dc94 100644 (file)
@@ -1,6 +1,11 @@
 // Regression test for issue #57611
 // Ensures that we don't ICE
 // FIXME: This should compile, but it currently doesn't
+// known-bug
+
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
 
 #![feature(trait_alias)]
 #![feature(type_alias_impl_trait)]
@@ -18,7 +23,6 @@ impl Foo for X {
 
     fn bar(&self) -> Self::Bar {
         |x| x
-        //~^ ERROR implementation of `FnOnce` is not general enough
     }
 }
 
diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr
deleted file mode 100644 (file)
index 45329ea..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: implementation of `FnOnce` is not general enough
-  --> $DIR/issue-57611-trait-alias.rs:20:9
-   |
-LL |         |x| x
-   |         ^^^^^ implementation of `FnOnce` is not general enough
-   |
-   = note: closure with signature `fn(&'2 X) -> &X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
-   = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/unboxed-closures/issue-30906.base.stderr b/src/test/ui/unboxed-closures/issue-30906.base.stderr
new file mode 100644 (file)
index 0000000..5d555a9
--- /dev/null
@@ -0,0 +1,11 @@
+error: implementation of `FnOnce` is not general enough
+  --> $DIR/issue-30906.rs:22:5
+   |
+LL |     test(Compose(f, |_| {}));
+   |     ^^^^ implementation of `FnOnce` is not general enough
+   |
+   = note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`...
+   = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2`
+
+error: aborting due to previous error
+
index 147a20974732def5fe8f699bf701381f718c4229..333e8e178217f23b73483dd0092449382e316885 100644 (file)
@@ -1,5 +1,5 @@
 error: implementation of `FnOnce` is not general enough
-  --> $DIR/issue-30906.rs:18:5
+  --> $DIR/issue-30906.rs:22:5
    |
 LL |     test(Compose(f, |_| {}));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
index e2d219e470384700bdf2e95eb2c3f6a681ee5626..1fd3a7f97dea3e88662e8d4b41a5fb0c88bbb634 100644 (file)
@@ -1,5 +1,9 @@
 #![feature(fn_traits, unboxed_closures)]
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}
 
 struct Compose<F, G>(F, G);
diff --git a/src/test/ui/unboxed-closures/issue-30906.stderr b/src/test/ui/unboxed-closures/issue-30906.stderr
deleted file mode 100644 (file)
index 35b1e45..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: implementation of `FnOnce` is not general enough
-  --> $DIR/issue-30906.rs:18:5
-   |
-LL |     test(Compose(f, |_| {}));
-   |     ^^^^ implementation of `FnOnce` is not general enough
-   |
-   = note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`...
-   = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr
new file mode 100644 (file)
index 0000000..ebd14c6
--- /dev/null
@@ -0,0 +1,30 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:15
+   |
+LL |         x.set(y);
+   |               ^
+   |
+note: ...the reference is valid for the anonymous lifetime #2 defined here...
+  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14
+   |
+LL |       doit(0, &|x, y| {
+   |  ______________^
+LL | |         x.set(y);
+LL | |
+LL | |
+LL | |     });
+   | |_____^
+note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined here
+  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14
+   |
+LL |       doit(0, &|x, y| {
+   |  ______________^
+LL | |         x.set(y);
+LL | |
+LL | |
+LL | |     });
+   | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0312`.
index e97157b83980ce4307e35c0dbcaefe79d4cb52e0..aeeee6e5003e897799fae54845a0bd9e11f3d628 100644 (file)
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:9
+  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:9
    |
 LL |     doit(0, &|x, y| {
    |               -  - has type `&'1 i32`
index a1364b93fa4cd16fb594caaadaa5b5214b1e43ac..288349e44561e35d1e40e6abd540b6c768b6029d 100644 (file)
@@ -3,6 +3,10 @@
 // That a closure whose expected argument types include two distinct
 // bound regions.
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 use std::cell::Cell;
 
 fn doit<T,F>(val: T, f: &F)
@@ -14,6 +18,8 @@ fn doit<T,F>(val: T, f: &F)
 
 pub fn main() {
     doit(0, &|x, y| {
-        x.set(y); //~ ERROR E0312
+        x.set(y);
+        //[base]~^ ERROR E0312
+        //[nll]~^^ lifetime may not live long enough
     });
 }
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr
deleted file mode 100644 (file)
index d781333..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0312]: lifetime of reference outlives lifetime of borrowed content...
-  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15
-   |
-LL |         x.set(y);
-   |               ^
-   |
-note: ...the reference is valid for the anonymous lifetime #2 defined here...
-  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
-   |
-LL |       doit(0, &|x, y| {
-   |  ______________^
-LL | |         x.set(y);
-LL | |     });
-   | |_____^
-note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined here
-  --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14
-   |
-LL |       doit(0, &|x, y| {
-   |  ______________^
-LL | |         x.set(y);
-LL | |     });
-   | |_____^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0312`.