diff --git a/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.migrate.stderr b/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.migrate.stderr new file mode 100644 index 00000000000..a4eafbd3850 --- /dev/null +++ b/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.migrate.stderr @@ -0,0 +1,19 @@ +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/inverse-bounds.rs:18:70 + | +LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e> + | ^^^^^^^^^^^^^^^^^^ + | + = note: hidden type `Invert<'_>` captures lifetime '_#8r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` + +warning: the feature `pin` has been stable since 1.33.0 and no longer requires an attribute to enable + --> $DIR/inverse-bounds.rs:6:60 + | +LL | #![feature(arbitrary_self_types, async_await, await_macro, pin)] + | ^^^ + | + = note: #[warn(stable_features)] on by default + diff --git a/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.rs b/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.rs index 60275ac3ab0..ac240e8ccde 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.rs @@ -1,4 +1,7 @@ // edition:2018 +// run-pass +// revisions: migrate mir +//[mir]compile-flags: -Z borrowck=mir #![feature(arbitrary_self_types, async_await, await_macro, pin)] diff --git a/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.stderr b/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.stderr index 13fb6f5d73e..4de872e8441 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/inverse-bounds.stderr @@ -1,25 +1,19 @@ -error: impl Trait captures unexpected lifetime - --> $DIR/inverse-bounds.rs:15:70 +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/inverse-bounds.rs:16:70 | LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e> - | ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured + | ^^^^^^^^^^^^^^^^^^ | -note: hidden type captures the lifetime 'd as defined on the function body at 15:29 - --> $DIR/inverse-bounds.rs:15:29 - | -LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e> - | ^^ -note: hidden type would be allowed to capture the lifetime 'd as defined on the function body at 15:29 - --> $DIR/inverse-bounds.rs:15:29 - | -LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e> - | ^^ -note: hidden type would be allowed to capture the lifetime 'e as defined on the function body at 15:33 - --> $DIR/inverse-bounds.rs:15:33 - | -LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Invert<'a>, b: Invert<'b>) -> impl Trait<'d, 'e> - | ^^ - = note: hidden type would be allowed to capture the static lifetime + = note: hidden type `Invert<'_>` captures lifetime '_#8r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` -error: aborting due to previous error +warning: the feature `pin` has been stable since 1.33.0 and no longer requires an attribute to enable + --> $DIR/inverse-bounds.rs:4:60 + | +LL | #![feature(arbitrary_self_types, async_await, await_macro, pin)] + | ^^^ + | + = note: #[warn(stable_features)] on by default diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.migrate.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.migrate.stderr new file mode 100644 index 00000000000..3c6fe0b8de6 --- /dev/null +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.migrate.stderr @@ -0,0 +1,22 @@ +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/ordinary-bounds-pick-original.rs:12:50 + | +LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^ + | + = note: hidden type `(&u8, &u8)` captures lifetime '_#6r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` + +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/ordinary-bounds-pick-original.rs:12:50 + | +LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^ + | + = note: hidden type `(&u8, &u8)` captures lifetime '_#7r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` + diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.rs index dde3e6d72c9..0d04980d37a 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.rs @@ -1,6 +1,7 @@ // edition:2018 - -#![feature(arbitrary_self_types, async_await, await_macro, pin)] +// run-pass +// revisions: migrate mir +//[mir]compile-flags: -Z borrowck=mir trait Trait<'a, 'b> { } impl Trait<'_, '_> for T { } diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.stderr index 43e92ac6827..f55bba987ec 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.stderr @@ -1,48 +1,22 @@ -error: impl Trait captures unexpected lifetime - --> $DIR/ordinary-bounds-pick-original.rs:11:50 +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/ordinary-bounds-pick-original.rs:10:50 | LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured + | ^^^^^^^^^^^^^^^^^^ | -note: hidden type captures the lifetime 'a as defined on the function body at 11:17 - --> $DIR/ordinary-bounds-pick-original.rs:11:17 - | -LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^ -note: hidden type would be allowed to capture the lifetime 'a as defined on the function body at 11:17 - --> $DIR/ordinary-bounds-pick-original.rs:11:17 - | -LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^ -note: hidden type would be allowed to capture the lifetime 'b as defined on the function body at 11:21 - --> $DIR/ordinary-bounds-pick-original.rs:11:21 - | -LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^ - = note: hidden type would be allowed to capture the static lifetime + = note: hidden type `(&u8, &u8)` captures lifetime '_#6r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` -error: impl Trait captures unexpected lifetime - --> $DIR/ordinary-bounds-pick-original.rs:11:50 +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/ordinary-bounds-pick-original.rs:10:50 | LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured + | ^^^^^^^^^^^^^^^^^^ | -note: hidden type captures the lifetime 'b as defined on the function body at 11:21 - --> $DIR/ordinary-bounds-pick-original.rs:11:21 - | -LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^ -note: hidden type would be allowed to capture the lifetime 'a as defined on the function body at 11:17 - --> $DIR/ordinary-bounds-pick-original.rs:11:17 - | -LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^ -note: hidden type would be allowed to capture the lifetime 'b as defined on the function body at 11:21 - --> $DIR/ordinary-bounds-pick-original.rs:11:21 - | -LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> { - | ^^ - = note: hidden type would be allowed to capture the static lifetime - -error: aborting due to 2 previous errors + = note: hidden type `(&u8, &u8)` captures lifetime '_#7r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.migrate.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.migrate.stderr new file mode 100644 index 00000000000..f1c2fc8695a --- /dev/null +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.migrate.stderr @@ -0,0 +1,11 @@ +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/ordinary-bounds-pick-other.rs:19:74 + | +LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> + | ^^^^^^^^^^^^^^^^^^ + | + = note: hidden type `Ordinary<'_>` captures lifetime '_#8r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` + diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.rs index b53ef1dde42..6555bacba67 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.rs @@ -1,6 +1,7 @@ // edition:2018 - -#![feature(arbitrary_self_types, async_await, await_macro, pin)] +// run-pass +// revisions: migrate mir +//[mir]compile-flags: -Z borrowck=mir trait Trait<'a, 'b> {} impl Trait<'_, '_> for T {} diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.stderr index ff09f947107..a9b56210b0f 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.stderr @@ -1,25 +1,11 @@ -error: impl Trait captures unexpected lifetime - --> $DIR/ordinary-bounds-pick-other.rs:18:74 +warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/ordinary-bounds-pick-other.rs:17:74 | LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> - | ^^^^^^^^^^^^^^^^^^ only lifetimes that appear in the impl Trait bounds may be captured + | ^^^^^^^^^^^^^^^^^^ | -note: hidden type captures the lifetime 'e as defined on the function body at 18:33 - --> $DIR/ordinary-bounds-pick-other.rs:18:33 - | -LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> - | ^^ -note: hidden type would be allowed to capture the lifetime 'd as defined on the function body at 18:29 - --> $DIR/ordinary-bounds-pick-other.rs:18:29 - | -LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> - | ^^ -note: hidden type would be allowed to capture the lifetime 'e as defined on the function body at 18:33 - --> $DIR/ordinary-bounds-pick-other.rs:18:33 - | -LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> - | ^^ - = note: hidden type would be allowed to capture the static lifetime - -error: aborting due to previous error + = note: hidden type `Ordinary<'_>` captures lifetime '_#8r + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + = note: for more information, try `rustc --explain E0729` diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs index c1322a39140..3a97624647e 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs @@ -1,7 +1,5 @@ // edition:2018 -#![feature(arbitrary_self_types, async_await, await_macro, pin)] - trait Trait<'a, 'b> {} impl Trait<'_, '_> for T {} diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr index cd2d46ac182..c807048ce54 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr @@ -1,11 +1,11 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/ordinary-bounds-unrelated.rs:18:74 + --> $DIR/ordinary-bounds-unrelated.rs:16:74 | LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> | ^^^^^^^^^^^^^^^^^^ | -note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 23:1 - --> $DIR/ordinary-bounds-unrelated.rs:23:1 +note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 21:1 + --> $DIR/ordinary-bounds-unrelated.rs:21:1 | LL | / { LL | | // Hidden type `Ordinary<'0>` with constraints: diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs index a28bbd5df78..85c478d8d31 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs @@ -1,7 +1,5 @@ // edition:2018 -#![feature(arbitrary_self_types, async_await, await_macro, pin)] - trait Trait<'a, 'b> {} impl Trait<'_, '_> for T {} diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr index 59ce93fa78b..6687c40f957 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr @@ -1,11 +1,11 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/ordinary-bounds-unsuited.rs:20:62 + --> $DIR/ordinary-bounds-unsuited.rs:18:62 | LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> | ^^^^^^^^^^^^^^^^^^ | -note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 22:1 - --> $DIR/ordinary-bounds-unsuited.rs:22:1 +note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 20:1 + --> $DIR/ordinary-bounds-unsuited.rs:20:1 | LL | / { LL | | // We return a value: