From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sat, 2 Apr 2022 15:08:16 +0000 (-0400) Subject: unboxed-closures and type-alias-impl-trait nll revisions X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=f881bf7c0a2c1020e36fd5f35be5ecb5af278966;p=rust.git unboxed-closures and type-alias-impl-trait nll revisions --- 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 index 00000000000..a3b410c2cfb --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr @@ -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 = 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 = 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) -> WrongGeneric { + | - 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/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr index dc85db66d32..db771d21132 100644 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr @@ -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 = 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 = 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 | ^ diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs index cb90776472b..2ad7e615e19 100644 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs @@ -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 index 15ec2eed3da..00000000000 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr +++ /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 = 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 = 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) -> WrongGeneric { - | - 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 index 00000000000..be77b60ca8f --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr @@ -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 + diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr index 91daa65d656..f5b91567ff5 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr @@ -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 diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs index 7c6e7642484..e95ddab75be 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs @@ -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 index 45329ea292d..00000000000 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr +++ /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 index 00000000000..5d555a9c5e4 --- /dev/null +++ b/src/test/ui/unboxed-closures/issue-30906.base.stderr @@ -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 + diff --git a/src/test/ui/unboxed-closures/issue-30906.nll.stderr b/src/test/ui/unboxed-closures/issue-30906.nll.stderr index 147a2097473..333e8e17821 100644 --- a/src/test/ui/unboxed-closures/issue-30906.nll.stderr +++ b/src/test/ui/unboxed-closures/issue-30906.nll.stderr @@ -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 diff --git a/src/test/ui/unboxed-closures/issue-30906.rs b/src/test/ui/unboxed-closures/issue-30906.rs index e2d219e4703..1fd3a7f97de 100644 --- a/src/test/ui/unboxed-closures/issue-30906.rs +++ b/src/test/ui/unboxed-closures/issue-30906.rs @@ -1,5 +1,9 @@ #![feature(fn_traits, unboxed_closures)] +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn test FnOnce<(&'x str,)>>(_: F) {} struct Compose(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 index 35b1e454c02..00000000000 --- a/src/test/ui/unboxed-closures/issue-30906.stderr +++ /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 index 00000000000..ebd14c64298 --- /dev/null +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr @@ -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`. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr index e97157b8398..aeeee6e5003 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr @@ -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` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs index a1364b93fa4..288349e4456 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs @@ -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(val: T, f: &F) @@ -14,6 +18,8 @@ fn doit(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 index d7813338f68..00000000000 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr +++ /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`.