diff options
Diffstat (limited to 'tests/ui')
41 files changed, 1061 insertions, 1116 deletions
diff --git a/tests/ui/associated-type-bounds/duplicate-bound-err.rs b/tests/ui/associated-type-bounds/duplicate-bound-err.rs new file mode 100644 index 00000000000..01cc05f2545 --- /dev/null +++ b/tests/ui/associated-type-bounds/duplicate-bound-err.rs @@ -0,0 +1,114 @@ +//@ edition: 2024 + +#![feature(associated_const_equality, type_alias_impl_trait, return_type_notation)] +#![allow(refining_impl_trait_internal)] + +use std::iter; + +fn rpit1() -> impl Iterator<Item: Copy, Item: Send> { + iter::empty() + //~^ ERROR type annotations needed +} +fn rpit2() -> impl Iterator<Item: Copy, Item: Copy> { + iter::empty() + //~^ ERROR type annotations needed +} +fn rpit3() -> impl Iterator<Item: 'static, Item: 'static> { + iter::empty() + //~^ ERROR type annotations needed +} + +type Tait1<T: Iterator<Item: Copy, Item: Send>> = impl Copy; +//~^ ERROR unconstrained opaque type +type Tait2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy; +//~^ ERROR unconstrained opaque type +type Tait3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy; +//~^ ERROR unconstrained opaque type + +type Tait4 = impl Iterator<Item: Copy, Item: Send>; +//~^ ERROR unconstrained opaque type +type Tait5 = impl Iterator<Item: Copy, Item: Copy>; +//~^ ERROR unconstrained opaque type +type Tait6 = impl Iterator<Item: 'static, Item: 'static>; +//~^ ERROR unconstrained opaque type + +fn mismatch() -> impl Iterator<Item: Copy, Item: Send> { + //~^ ERROR [E0277] + iter::empty::<*const ()>() +} + +fn mismatch_2() -> impl Iterator<Item: Copy, Item: Send> { + //~^ ERROR [E0277] + iter::empty::<String>() +} + +trait Trait { + type Gat<T>; + + const ASSOC: i32; + + fn foo() -> impl Sized; +} + +impl Trait for () { + type Gat<T> = (); + + const ASSOC: i32 = 3; + + fn foo() {} +} + +impl Trait for u32 { + type Gat<T> = (); + + const ASSOC: i32 = 4; + + fn foo() -> u32 { + 42 + } +} + +fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {} + +fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {} + +fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {} + +type MustFail = dyn Iterator<Item = i32, Item = u32>; +//~^ ERROR [E0719] +//~| ERROR conflicting associated type bounds + +trait Trait2 { + const ASSOC: u32; +} + +type MustFail2 = dyn Trait2<ASSOC = 3u32, ASSOC = 4u32>; +//~^ ERROR [E0719] +//~| ERROR conflicting associated type bounds + +type MustFail3 = dyn Iterator<Item = i32, Item = i32>; +//~^ ERROR [E0719] + +type MustFail4 = dyn Trait2<ASSOC = 3u32, ASSOC = 3u32>; +//~^ ERROR [E0719] + +trait Trait3 { + fn foo() -> impl Iterator<Item = i32, Item = u32>; +} + +impl Trait3 for () { + fn foo() -> impl Iterator<Item = i32, Item = u32> { + //~^ ERROR[E0271] + //~| ERROR[E0271] + [2u32].into_iter() + } +} + +fn main() { + uncallable(iter::empty::<u32>()); //~ ERROR [E0271] + uncallable(iter::empty::<i32>()); //~ ERROR [E0271] + uncallable_const(()); //~ ERROR [E0271] + uncallable_const(4u32); //~ ERROR [E0271] + uncallable_rtn(()); //~ ERROR [E0271] + uncallable_rtn(17u32); //~ ERROR [E0271] +} diff --git a/tests/ui/associated-type-bounds/duplicate-bound-err.stderr b/tests/ui/associated-type-bounds/duplicate-bound-err.stderr new file mode 100644 index 00000000000..1737d0dc5a3 --- /dev/null +++ b/tests/ui/associated-type-bounds/duplicate-bound-err.stderr @@ -0,0 +1,268 @@ +error[E0282]: type annotations needed + --> $DIR/duplicate-bound-err.rs:9:5 + | +LL | iter::empty() + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` + | +help: consider specifying the generic argument + | +LL | iter::empty::<T>() + | +++++ + +error[E0282]: type annotations needed + --> $DIR/duplicate-bound-err.rs:13:5 + | +LL | iter::empty() + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` + | +help: consider specifying the generic argument + | +LL | iter::empty::<T>() + | +++++ + +error[E0282]: type annotations needed + --> $DIR/duplicate-bound-err.rs:17:5 + | +LL | iter::empty() + | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` + | +help: consider specifying the generic argument + | +LL | iter::empty::<T>() + | +++++ + +error: unconstrained opaque type + --> $DIR/duplicate-bound-err.rs:21:51 + | +LL | type Tait1<T: Iterator<Item: Copy, Item: Send>> = impl Copy; + | ^^^^^^^^^ + | + = note: `Tait1` must be used in combination with a concrete type within the same crate + +error: unconstrained opaque type + --> $DIR/duplicate-bound-err.rs:23:51 + | +LL | type Tait2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy; + | ^^^^^^^^^ + | + = note: `Tait2` must be used in combination with a concrete type within the same crate + +error: unconstrained opaque type + --> $DIR/duplicate-bound-err.rs:25:57 + | +LL | type Tait3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy; + | ^^^^^^^^^ + | + = note: `Tait3` must be used in combination with a concrete type within the same crate + +error: unconstrained opaque type + --> $DIR/duplicate-bound-err.rs:28:14 + | +LL | type Tait4 = impl Iterator<Item: Copy, Item: Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `Tait4` must be used in combination with a concrete type within the same crate + +error: unconstrained opaque type + --> $DIR/duplicate-bound-err.rs:30:14 + | +LL | type Tait5 = impl Iterator<Item: Copy, Item: Copy>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `Tait5` must be used in combination with a concrete type within the same crate + +error: unconstrained opaque type + --> $DIR/duplicate-bound-err.rs:32:14 + | +LL | type Tait6 = impl Iterator<Item: 'static, Item: 'static>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `Tait6` must be used in combination with a concrete type within the same crate + +error[E0277]: `*const ()` cannot be sent between threads safely + --> $DIR/duplicate-bound-err.rs:35:18 + | +LL | fn mismatch() -> impl Iterator<Item: Copy, Item: Send> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely +LL | +LL | iter::empty::<*const ()>() + | -------------------------- return type was inferred to be `std::iter::Empty<*const ()>` here + | + = help: the trait `Send` is not implemented for `*const ()` + +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/duplicate-bound-err.rs:40:20 + | +LL | fn mismatch_2() -> impl Iterator<Item: Copy, Item: Send> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` +LL | +LL | iter::empty::<String>() + | ----------------------- return type was inferred to be `std::iter::Empty<String>` here + +error[E0271]: expected `IntoIter<u32, 1>` to be an iterator that yields `i32`, but it yields `u32` + --> $DIR/duplicate-bound-err.rs:100:17 + | +LL | fn foo() -> impl Iterator<Item = i32, Item = u32> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` +... +LL | [2u32].into_iter() + | ------------------ return type was inferred to be `std::array::IntoIter<u32, 1>` here + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate-bound-err.rs:77:42 + | +LL | type MustFail = dyn Iterator<Item = i32, Item = u32>; + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error: conflicting associated type bounds for `Item` + --> $DIR/duplicate-bound-err.rs:77:17 + | +LL | type MustFail = dyn Iterator<Item = i32, Item = u32>; + | ^^^^^^^^^^^^^----------^^----------^ + | | | + | | `Item` is specified to be `u32` here + | `Item` is specified to be `i32` here + +error[E0719]: the value of the associated type `ASSOC` in trait `Trait2` is already specified + --> $DIR/duplicate-bound-err.rs:85:43 + | +LL | type MustFail2 = dyn Trait2<ASSOC = 3u32, ASSOC = 4u32>; + | ------------ ^^^^^^^^^^^^ re-bound here + | | + | `ASSOC` bound here first + +error: conflicting associated type bounds for `ASSOC` + --> $DIR/duplicate-bound-err.rs:85:18 + | +LL | type MustFail2 = dyn Trait2<ASSOC = 3u32, ASSOC = 4u32>; + | ^^^^^^^^^^^------------^^------------^ + | | | + | | `ASSOC` is specified to be `4` here + | `ASSOC` is specified to be `3` here + +error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified + --> $DIR/duplicate-bound-err.rs:89:43 + | +LL | type MustFail3 = dyn Iterator<Item = i32, Item = i32>; + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `ASSOC` in trait `Trait2` is already specified + --> $DIR/duplicate-bound-err.rs:92:43 + | +LL | type MustFail4 = dyn Trait2<ASSOC = 3u32, ASSOC = 3u32>; + | ------------ ^^^^^^^^^^^^ re-bound here + | | + | `ASSOC` bound here first + +error[E0271]: expected `impl Iterator<Item = u32>` to be an iterator that yields `i32`, but it yields `u32` + --> $DIR/duplicate-bound-err.rs:100:17 + | +LL | fn foo() -> impl Iterator<Item = i32, Item = u32> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` + | +note: required by a bound in `Trait3::foo::{anon_assoc#0}` + --> $DIR/duplicate-bound-err.rs:96:31 + | +LL | fn foo() -> impl Iterator<Item = i32, Item = u32>; + | ^^^^^^^^^^ required by this bound in `Trait3::foo::{anon_assoc#0}` + +error[E0271]: expected `Empty<u32>` to be an iterator that yields `i32`, but it yields `u32` + --> $DIR/duplicate-bound-err.rs:108:16 + | +LL | uncallable(iter::empty::<u32>()); + | ---------- ^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` + | | + | required by a bound introduced by this call + | +note: required by a bound in `uncallable` + --> $DIR/duplicate-bound-err.rs:71:32 + | +LL | fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {} + | ^^^^^^^^^^ required by this bound in `uncallable` + +error[E0271]: expected `Empty<i32>` to be an iterator that yields `u32`, but it yields `i32` + --> $DIR/duplicate-bound-err.rs:109:16 + | +LL | uncallable(iter::empty::<i32>()); + | ---------- ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32` + | | + | required by a bound introduced by this call + | +note: required by a bound in `uncallable` + --> $DIR/duplicate-bound-err.rs:71:44 + | +LL | fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {} + | ^^^^^^^^^^ required by this bound in `uncallable` + +error[E0271]: type mismatch resolving `<() as Trait>::ASSOC == 4` + --> $DIR/duplicate-bound-err.rs:110:22 + | +LL | uncallable_const(()); + | ---------------- ^^ expected `4`, found `3` + | | + | required by a bound introduced by this call + | + = note: expected constant `4` + found constant `3` +note: required by a bound in `uncallable_const` + --> $DIR/duplicate-bound-err.rs:73:46 + | +LL | fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {} + | ^^^^^^^^^ required by this bound in `uncallable_const` + +error[E0271]: type mismatch resolving `<u32 as Trait>::ASSOC == 3` + --> $DIR/duplicate-bound-err.rs:111:22 + | +LL | uncallable_const(4u32); + | ---------------- ^^^^ expected `3`, found `4` + | | + | required by a bound introduced by this call + | + = note: expected constant `3` + found constant `4` +note: required by a bound in `uncallable_const` + --> $DIR/duplicate-bound-err.rs:73:35 + | +LL | fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {} + | ^^^^^^^^^ required by this bound in `uncallable_const` + +error[E0271]: type mismatch resolving `<() as Trait>::ASSOC == 4` + --> $DIR/duplicate-bound-err.rs:112:20 + | +LL | uncallable_rtn(()); + | -------------- ^^ expected `4`, found `3` + | | + | required by a bound introduced by this call + | + = note: expected constant `4` + found constant `3` +note: required by a bound in `uncallable_rtn` + --> $DIR/duplicate-bound-err.rs:75:75 + | +LL | fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {} + | ^^^^^^^^^ required by this bound in `uncallable_rtn` + +error[E0271]: type mismatch resolving `<u32 as Trait>::ASSOC == 3` + --> $DIR/duplicate-bound-err.rs:113:20 + | +LL | uncallable_rtn(17u32); + | -------------- ^^^^^ expected `3`, found `4` + | | + | required by a bound introduced by this call + | + = note: expected constant `3` + found constant `4` +note: required by a bound in `uncallable_rtn` + --> $DIR/duplicate-bound-err.rs:75:48 + | +LL | fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {} + | ^^^^^^^^^ required by this bound in `uncallable_rtn` + +error: aborting due to 25 previous errors + +Some errors have detailed explanations: E0271, E0277, E0282, E0719. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-type-bounds/duplicate-bound.rs b/tests/ui/associated-type-bounds/duplicate-bound.rs new file mode 100644 index 00000000000..696710d76f6 --- /dev/null +++ b/tests/ui/associated-type-bounds/duplicate-bound.rs @@ -0,0 +1,240 @@ +//@ edition: 2024 +//@ run-pass + +#![feature(associated_const_equality, return_type_notation)] +#![allow(dead_code, refining_impl_trait_internal, type_alias_bounds)] + +use std::iter; +use std::mem::ManuallyDrop; + +struct Si1<T: Iterator<Item: Copy, Item: Send>> { + f: T, +} +struct Si2<T: Iterator<Item: Copy, Item: Copy>> { + f: T, +} +struct Si3<T: Iterator<Item: 'static, Item: 'static>> { + f: T, +} +struct Sw1<T> +where + T: Iterator<Item: Copy, Item: Send>, +{ + f: T, +} +struct Sw2<T> +where + T: Iterator<Item: Copy, Item: Copy>, +{ + f: T, +} +struct Sw3<T> +where + T: Iterator<Item: 'static, Item: 'static>, +{ + f: T, +} + +enum Ei1<T: Iterator<Item: Copy, Item: Send>> { + V(T), +} +enum Ei2<T: Iterator<Item: Copy, Item: Copy>> { + V(T), +} +enum Ei3<T: Iterator<Item: 'static, Item: 'static>> { + V(T), +} +enum Ew1<T> +where + T: Iterator<Item: Copy, Item: Send>, +{ + V(T), +} +enum Ew2<T> +where + T: Iterator<Item: Copy, Item: Copy>, +{ + V(T), +} +enum Ew3<T> +where + T: Iterator<Item: 'static, Item: 'static>, +{ + V(T), +} + +union Ui1<T: Iterator<Item: Copy, Item: Send>> { + f: ManuallyDrop<T>, +} +union Ui2<T: Iterator<Item: Copy, Item: Copy>> { + f: ManuallyDrop<T>, +} +union Ui3<T: Iterator<Item: 'static, Item: 'static>> { + f: ManuallyDrop<T>, +} +union Uw1<T> +where + T: Iterator<Item: Copy, Item: Send>, +{ + f: ManuallyDrop<T>, +} +union Uw2<T> +where + T: Iterator<Item: Copy, Item: Copy>, +{ + f: ManuallyDrop<T>, +} +union Uw3<T> +where + T: Iterator<Item: 'static, Item: 'static>, +{ + f: ManuallyDrop<T>, +} + +fn fi1<T: Iterator<Item: Copy, Item: Send>>() {} +fn fi2<T: Iterator<Item: Copy, Item: Copy>>() {} +fn fi3<T: Iterator<Item: 'static, Item: 'static>>() {} +fn fw1<T>() +where + T: Iterator<Item: Copy, Item: Send>, +{ +} +fn fw2<T>() +where + T: Iterator<Item: Copy, Item: Copy>, +{ +} +fn fw3<T>() +where + T: Iterator<Item: 'static, Item: 'static>, +{ +} + +fn rpit1() -> impl Iterator<Item: Copy, Item: Send> { + iter::empty::<u32>() +} +fn rpit2() -> impl Iterator<Item: Copy, Item: Copy> { + iter::empty::<u32>() +} +fn rpit3() -> impl Iterator<Item: 'static, Item: 'static> { + iter::empty::<u32>() +} +fn apit1(_: impl Iterator<Item: Copy, Item: Send>) {} +fn apit2(_: impl Iterator<Item: Copy, Item: Copy>) {} +fn apit3(_: impl Iterator<Item: 'static, Item: 'static>) {} + +type Tait1<T: Iterator<Item: Copy, Item: Send>> = T; +type Tait2<T: Iterator<Item: Copy, Item: Copy>> = T; +type Tait3<T: Iterator<Item: 'static, Item: 'static>> = T; +type Taw1<T> +where + T: Iterator<Item: Copy, Item: Send>, += T; +type Taw2<T> +where + T: Iterator<Item: Copy, Item: Copy>, += T; +type Taw3<T> +where + T: Iterator<Item: 'static, Item: 'static>, += T; + +trait Tri1<T: Iterator<Item: Copy, Item: Send>> {} +trait Tri2<T: Iterator<Item: Copy, Item: Copy>> {} +trait Tri3<T: Iterator<Item: 'static, Item: 'static>> {} +trait Trs1: Iterator<Item: Copy, Item: Send> {} +trait Trs2: Iterator<Item: Copy, Item: Copy> {} +trait Trs3: Iterator<Item: 'static, Item: 'static> {} +trait Trw1<T> +where + T: Iterator<Item: Copy, Item: Send>, +{ +} +trait Trw2<T> +where + T: Iterator<Item: Copy, Item: Copy>, +{ +} +trait Trw3<T> +where + T: Iterator<Item: 'static, Item: 'static>, +{ +} +trait Trsw1 +where + Self: Iterator<Item: Copy, Item: Send>, +{ +} +trait Trsw2 +where + Self: Iterator<Item: Copy, Item: Copy>, +{ +} +trait Trsw3 +where + Self: Iterator<Item: 'static, Item: 'static>, +{ +} +trait Tra1 { + type A: Iterator<Item: Copy, Item: Send>; +} +trait Tra2 { + type A: Iterator<Item: Copy, Item: Copy>; +} +trait Tra3 { + type A: Iterator<Item: 'static, Item: 'static>; +} + +trait Trait { + type Gat<T>; + + const ASSOC: i32; + + fn foo() -> impl Sized; +} + +impl Trait for () { + type Gat<T> = (); + + const ASSOC: i32 = 3; + + fn foo() {} +} + +trait Subtrait: Trait<Gat<u32> = u32, Gat<u64> = u64> {} + +fn f<T: Trait<Gat<i32> = (), Gat<i64> = ()>>() { + let _: T::Gat<i32> = (); + let _: T::Gat<i64> = (); +} + +fn g<T: Trait<Gat<i32> = (), Gat<i64> = &'static str>>() { + let _: T::Gat<i32> = (); + let _: T::Gat<i64> = ""; +} + +fn uncallable(_: impl Iterator<Item = i32, Item = u32>) {} + +fn callable(_: impl Iterator<Item = i32, Item = i32>) {} + +fn uncallable_const(_: impl Trait<ASSOC = 3, ASSOC = 4>) {} + +fn callable_const(_: impl Trait<ASSOC = 3, ASSOC = 3>) {} + +fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<ASSOC = 4>>) {} + +fn callable_rtn(_: impl Trait<foo(..): Send, foo(..): Send, foo(..): Eq>) {} + +trait Trait2 { + const ASSOC: u32; +} + +trait Trait3 { + fn foo() -> impl Iterator<Item = i32, Item = u32>; +} + +fn main() { + callable(iter::empty::<i32>()); + callable_const(()); + callable_rtn(()); +} diff --git a/tests/ui/associated-type-bounds/duplicate.rs b/tests/ui/associated-type-bounds/duplicate.rs deleted file mode 100644 index e9d94787e98..00000000000 --- a/tests/ui/associated-type-bounds/duplicate.rs +++ /dev/null @@ -1,278 +0,0 @@ -#![feature(type_alias_impl_trait)] - -use std::iter; -use std::mem::ManuallyDrop; - -struct SI1<T: Iterator<Item: Copy, Item: Send>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - f: T, -} -struct SI2<T: Iterator<Item: Copy, Item: Copy>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - f: T, -} -struct SI3<T: Iterator<Item: 'static, Item: 'static>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - f: T, -} -struct SW1<T> -where - T: Iterator<Item: Copy, Item: Send>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - f: T, -} -struct SW2<T> -where - T: Iterator<Item: Copy, Item: Copy>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - f: T, -} -struct SW3<T> -where - T: Iterator<Item: 'static, Item: 'static>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - f: T, -} - -enum EI1<T: Iterator<Item: Copy, Item: Send>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - V(T), -} -enum EI2<T: Iterator<Item: Copy, Item: Copy>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - V(T), -} -enum EI3<T: Iterator<Item: 'static, Item: 'static>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - V(T), -} -enum EW1<T> -where - T: Iterator<Item: Copy, Item: Send>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - V(T), -} -enum EW2<T> -where - T: Iterator<Item: Copy, Item: Copy>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - V(T), -} -enum EW3<T> -where - T: Iterator<Item: 'static, Item: 'static>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - V(T), -} - -union UI1<T: Iterator<Item: Copy, Item: Send>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - f: ManuallyDrop<T>, -} -union UI2<T: Iterator<Item: Copy, Item: Copy>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - f: ManuallyDrop<T>, -} -union UI3<T: Iterator<Item: 'static, Item: 'static>> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - f: ManuallyDrop<T>, -} -union UW1<T> -where - T: Iterator<Item: Copy, Item: Send>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - f: ManuallyDrop<T>, -} -union UW2<T> -where - T: Iterator<Item: Copy, Item: Copy>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - f: ManuallyDrop<T>, -} -union UW3<T> -where - T: Iterator<Item: 'static, Item: 'static>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ - f: ManuallyDrop<T>, -} - -fn FI1<T: Iterator<Item: Copy, Item: Send>>() {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -fn FW1<T>() -where - T: Iterator<Item: Copy, Item: Send>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -fn FW2<T>() -where - T: Iterator<Item: Copy, Item: Copy>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -fn FW3<T>() -where - T: Iterator<Item: 'static, Item: 'static>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} - -fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - iter::empty() - //~^ ERROR type annotations needed -} -fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - iter::empty() - //~^ ERROR type annotations needed -} -fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> { - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - iter::empty() - //~^ ERROR type annotations needed -} -fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - -type TAI1<T: Iterator<Item: Copy, Item: Send>> = T; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -type TAW1<T> -where - T: Iterator<Item: Copy, Item: Send>, -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -= T; -type TAW2<T> -where - T: Iterator<Item: Copy, Item: Copy>, -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -= T; -type TAW3<T> -where - T: Iterator<Item: 'static, Item: 'static>, -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -= T; - -type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR unconstrained opaque type -type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR unconstrained opaque type -type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR unconstrained opaque type -type ETAI4 = impl Iterator<Item: Copy, Item: Send>; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR unconstrained opaque type -type ETAI5 = impl Iterator<Item: Copy, Item: Copy>; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR unconstrained opaque type -type ETAI6 = impl Iterator<Item: 'static, Item: 'static>; -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR unconstrained opaque type - -trait TRI1<T: Iterator<Item: Copy, Item: Send>> {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -trait TRS1: Iterator<Item: Copy, Item: Send> {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -trait TRS2: Iterator<Item: Copy, Item: Copy> {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -trait TRS3: Iterator<Item: 'static, Item: 'static> {} -//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -trait TRW1<T> -where - T: Iterator<Item: Copy, Item: Send>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -trait TRW2<T> -where - T: Iterator<Item: Copy, Item: Copy>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -trait TRW3<T> -where - T: Iterator<Item: 'static, Item: 'static>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -trait TRSW1 -where - Self: Iterator<Item: Copy, Item: Send>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -trait TRSW2 -where - Self: Iterator<Item: Copy, Item: Copy>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -trait TRSW3 -where - Self: Iterator<Item: 'static, Item: 'static>, - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -{ -} -trait TRA1 { - type A: Iterator<Item: Copy, Item: Send>; - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -} -trait TRA2 { - type A: Iterator<Item: Copy, Item: Copy>; - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -} -trait TRA3 { - type A: Iterator<Item: 'static, Item: 'static>; - //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] - //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719] -} - -fn main() {} diff --git a/tests/ui/associated-type-bounds/duplicate.stderr b/tests/ui/associated-type-bounds/duplicate.stderr deleted file mode 100644 index 68fbb345f6f..00000000000 --- a/tests/ui/associated-type-bounds/duplicate.stderr +++ /dev/null @@ -1,751 +0,0 @@ -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:6:36 - | -LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:10:36 - | -LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:14:39 - | -LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> { - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:20:29 - | -LL | T: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:27:29 - | -LL | T: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:34:32 - | -LL | T: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:40:34 - | -LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:44:34 - | -LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:48:37 - | -LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> { - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:54:29 - | -LL | T: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:61:29 - | -LL | T: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:68:32 - | -LL | T: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:74:35 - | -LL | union UI1<T: Iterator<Item: Copy, Item: Send>> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:78:35 - | -LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:82:38 - | -LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> { - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:88:29 - | -LL | T: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:95:29 - | -LL | T: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:102:32 - | -LL | T: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:108:32 - | -LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:110:32 - | -LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:112:35 - | -LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {} - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:116:29 - | -LL | T: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:122:29 - | -LL | T: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:128:32 - | -LL | T: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:133:42 - | -LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:139:42 - | -LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:145:45 - | -LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> { - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:151:40 - | -LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:153:40 - | -LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:155:43 - | -LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {} - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:158:35 - | -LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:160:35 - | -LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:162:38 - | -LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T; - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:166:29 - | -LL | T: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:171:29 - | -LL | T: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:176:32 - | -LL | T: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:180:36 - | -LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:183:36 - | -LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:186:39 - | -LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy; - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:202:36 - | -LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:204:36 - | -LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:206:39 - | -LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {} - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:208:34 - | -LL | trait TRS1: Iterator<Item: Copy, Item: Send> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:208:34 - | -LL | trait TRS1: Iterator<Item: Copy, Item: Send> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:208:34 - | -LL | trait TRS1: Iterator<Item: Copy, Item: Send> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:212:34 - | -LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:212:34 - | -LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:212:34 - | -LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:216:37 - | -LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {} - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:216:37 - | -LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {} - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:216:37 - | -LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {} - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:222:29 - | -LL | T: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:228:29 - | -LL | T: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:234:32 - | -LL | T: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:240:32 - | -LL | Self: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:240:32 - | -LL | Self: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:240:32 - | -LL | Self: Iterator<Item: Copy, Item: Send>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:248:32 - | -LL | Self: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:248:32 - | -LL | Self: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:248:32 - | -LL | Self: Iterator<Item: Copy, Item: Copy>, - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:256:35 - | -LL | Self: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:256:35 - | -LL | Self: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:256:35 - | -LL | Self: Iterator<Item: 'static, Item: 'static>, - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:263:34 - | -LL | type A: Iterator<Item: Copy, Item: Send>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:263:34 - | -LL | type A: Iterator<Item: Copy, Item: Send>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:268:34 - | -LL | type A: Iterator<Item: Copy, Item: Copy>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:268:34 - | -LL | type A: Iterator<Item: Copy, Item: Copy>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:273:37 - | -LL | type A: Iterator<Item: 'static, Item: 'static>; - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:273:37 - | -LL | type A: Iterator<Item: 'static, Item: 'static>; - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:133:42 - | -LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0282]: type annotations needed - --> $DIR/duplicate.rs:136:5 - | -LL | iter::empty() - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` - | -help: consider specifying the generic argument - | -LL | iter::empty::<T>() - | +++++ - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:139:42 - | -LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> { - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0282]: type annotations needed - --> $DIR/duplicate.rs:142:5 - | -LL | iter::empty() - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` - | -help: consider specifying the generic argument - | -LL | iter::empty::<T>() - | +++++ - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:145:45 - | -LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> { - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0282]: type annotations needed - --> $DIR/duplicate.rs:148:5 - | -LL | iter::empty() - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` - | -help: consider specifying the generic argument - | -LL | iter::empty::<T>() - | +++++ - -error: unconstrained opaque type - --> $DIR/duplicate.rs:180:51 - | -LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy; - | ^^^^^^^^^ - | - = note: `ETAI1` must be used in combination with a concrete type within the same crate - -error: unconstrained opaque type - --> $DIR/duplicate.rs:183:51 - | -LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy; - | ^^^^^^^^^ - | - = note: `ETAI2` must be used in combination with a concrete type within the same crate - -error: unconstrained opaque type - --> $DIR/duplicate.rs:186:57 - | -LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy; - | ^^^^^^^^^ - | - = note: `ETAI3` must be used in combination with a concrete type within the same crate - -error: unconstrained opaque type - --> $DIR/duplicate.rs:189:14 - | -LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `ETAI4` must be used in combination with a concrete type within the same crate - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:189:40 - | -LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:189:40 - | -LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: unconstrained opaque type - --> $DIR/duplicate.rs:193:14 - | -LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `ETAI5` must be used in combination with a concrete type within the same crate - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:193:40 - | -LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:193:40 - | -LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>; - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: unconstrained opaque type - --> $DIR/duplicate.rs:197:14 - | -LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `ETAI6` must be used in combination with a concrete type within the same crate - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:197:43 - | -LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>; - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/duplicate.rs:197:43 - | -LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>; - | ------------- ^^^^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 87 previous errors - -Some errors have detailed explanations: E0282, E0719. -For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/associated-types/associated-types-overridden-binding-2.stderr b/tests/ui/associated-types/associated-types-overridden-binding-2.stderr index 71a4a2610aa..e96a2446b6c 100644 --- a/tests/ui/associated-types/associated-types-overridden-binding-2.stderr +++ b/tests/ui/associated-types/associated-types-overridden-binding-2.stderr @@ -1,4 +1,4 @@ -error: conflicting associated type bounds for `Item` when expanding trait alias +error: conflicting associated type bounds for `Item` --> $DIR/associated-types-overridden-binding-2.rs:6:13 | LL | trait I32Iterator = Iterator<Item = i32>; diff --git a/tests/ui/associated-types/associated-types-overridden-binding.stderr b/tests/ui/associated-types/associated-types-overridden-binding.stderr index 3b20015dfca..08ab9b63ee9 100644 --- a/tests/ui/associated-types/associated-types-overridden-binding.stderr +++ b/tests/ui/associated-types/associated-types-overridden-binding.stderr @@ -22,7 +22,7 @@ note: required by a bound in `I32Iterator` LL | trait I32Iterator = Iterator<Item = i32>; | ^^^^^^^^^^ required by this bound in `I32Iterator` -error: conflicting associated type bounds for `Item` when expanding trait alias +error: conflicting associated type bounds for `Item` --> $DIR/associated-types-overridden-binding.rs:10:13 | LL | trait I32Iterator = Iterator<Item = i32>; diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs index 19a31d1889b..f97ec779b32 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs @@ -44,4 +44,18 @@ fn through_field_and_ref_move<'a>(x: &S<'a>) { outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x` } +struct T; +impl T { + fn outlives<'a>(&'a self, _: impl Sized + 'a) {} +} +fn through_method<'a>(x: &'a i32) { + let c = async || { println!("{}", *x); }; //~ ERROR `x` does not live long enough + T.outlives::<'a>(c()); + T.outlives::<'a>(call_once(c)); + + let c = async move || { println!("{}", *x); }; + T.outlives::<'a>(c()); //~ ERROR `c` does not live long enough + T.outlives::<'a>(call_once(c)); +} + fn main() {} diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr index b7259074bf6..4aae9807dd2 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr @@ -28,6 +28,12 @@ LL | outlives::<'a>(c()); LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed + | +note: requirement that the value outlives `'a` introduced here + --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 + | +LL | fn outlives<'a>(_: impl Sized + 'a) {} + | ^^ error[E0597]: `x` does not live long enough --> $DIR/without-precise-captures-we-are-powerless.rs:26:13 @@ -73,6 +79,12 @@ LL | outlives::<'a>(c()); LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed + | +note: requirement that the value outlives `'a` introduced here + --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 + | +LL | fn outlives<'a>(_: impl Sized + 'a) {} + | ^^ error[E0505]: cannot move out of `c` because it is borrowed --> $DIR/without-precise-captures-we-are-powerless.rs:32:30 @@ -89,6 +101,12 @@ LL | outlives::<'a>(c()); | argument requires that `c` is borrowed for `'a` LL | outlives::<'a>(call_once(c)); | ^ move out of `c` occurs here + | +note: requirement that the value outlives `'a` introduced here + --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 + | +LL | fn outlives<'a>(_: impl Sized + 'a) {} + | ^^ error[E0597]: `x` does not live long enough --> $DIR/without-precise-captures-we-are-powerless.rs:36:13 @@ -129,6 +147,12 @@ LL | outlives::<'a>(c()); LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed + | +note: requirement that the value outlives `'a` introduced here + --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 + | +LL | fn outlives<'a>(_: impl Sized + 'a) {} + | ^^ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/without-precise-captures-we-are-powerless.rs:44:5 @@ -141,7 +165,44 @@ help: add explicit lifetime `'a` to the type of `x` LL | fn through_field_and_ref_move<'a>(x: &'a S<'a>) { | ++ -error: aborting due to 10 previous errors +error[E0597]: `x` does not live long enough + --> $DIR/without-precise-captures-we-are-powerless.rs:52:13 + | +LL | fn through_method<'a>(x: &'a i32) { + | -- lifetime `'a` defined here +LL | let c = async || { println!("{}", *x); }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough +LL | T.outlives::<'a>(c()); +LL | T.outlives::<'a>(call_once(c)); + | ------------------------------ argument requires that `x` is borrowed for `'a` +... +LL | } + | - `x` dropped here while still borrowed + +error[E0597]: `c` does not live long enough + --> $DIR/without-precise-captures-we-are-powerless.rs:57:22 + | +LL | fn through_method<'a>(x: &'a i32) { + | -- lifetime `'a` defined here +... +LL | let c = async move || { println!("{}", *x); }; + | - binding `c` declared here +LL | T.outlives::<'a>(c()); + | -----------------^--- + | | | + | | borrowed value does not live long enough + | argument requires that `c` is borrowed for `'a` +LL | T.outlives::<'a>(call_once(c)); +LL | } + | - `c` dropped here while still borrowed + | +note: requirement that the value outlives `'a` introduced here + --> $DIR/without-precise-captures-we-are-powerless.rs:49:47 + | +LL | fn outlives<'a>(&'a self, _: impl Sized + 'a) {} + | ^^ + +error: aborting due to 12 previous errors Some errors have detailed explanations: E0505, E0597, E0621. For more information about an error, try `rustc --explain E0505`. diff --git a/tests/ui/borrowck/fn-item-check-type-params.stderr b/tests/ui/borrowck/fn-item-check-type-params.stderr index aafb7e66ef5..7a0a7752a14 100644 --- a/tests/ui/borrowck/fn-item-check-type-params.stderr +++ b/tests/ui/borrowck/fn-item-check-type-params.stderr @@ -27,6 +27,12 @@ LL | want(&String::new(), extend_lt); | | | | | creates a temporary value which is freed while still in use | argument requires that borrow lasts for `'static` + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/fn-item-check-type-params.rs:47:33 + | +LL | fn want<I, O>(_: I, _: impl Fn(I) -> O) {} + | ^^^^^^^^^^ error[E0716]: temporary value dropped while borrowed --> $DIR/fn-item-check-type-params.rs:54:26 @@ -36,6 +42,12 @@ LL | let val = extend_lt(&String::from("blah blah blah")); | | | | | creates a temporary value which is freed while still in use | argument requires that borrow lasts for `'static` + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/fn-item-check-type-params.rs:22:21 + | +LL | (T, Option<U>): Displayable, + | ^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr index 5389226f7a7..7b840d54ed0 100644 --- a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr +++ b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr @@ -22,6 +22,12 @@ LL | force_send(async_load(¬_static)); ... LL | } | - `not_static` dropped here while still borrowed + | +note: requirement that the value outlives `'1` introduced here + --> $DIR/implementation-not-general-enough-ice-133252.rs:16:18 + | +LL | fn force_send<T: Send>(_: T) {} + | ^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/issue-17545.stderr b/tests/ui/borrowck/issue-17545.stderr index 45e977e3947..63fd57cd233 100644 --- a/tests/ui/borrowck/issue-17545.stderr +++ b/tests/ui/borrowck/issue-17545.stderr @@ -10,6 +10,9 @@ LL | | )); | | -- temporary value is freed at the end of this statement | |______| | argument requires that borrow lasts for `'a` + | +note: requirement that the value outlives `'a` introduced here + --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/undeclared-lifetime.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/undeclared-lifetime.rs new file mode 100644 index 00000000000..5fa5b74c0c0 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/undeclared-lifetime.rs @@ -0,0 +1,20 @@ +//@ add-core-stubs +//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -Cincremental=true +//@ needs-llvm-components: arm +#![feature(abi_cmse_nonsecure_call, no_core)] +#![no_core] + +extern crate minicore; +use minicore::*; + +// A regression test for https://github.com/rust-lang/rust/issues/131639. +// NOTE: -Cincremental=true was required for triggering the bug. + +fn foo() { + id::<extern "cmse-nonsecure-call" fn(&'a ())>(PhantomData); + //~^ ERROR use of undeclared lifetime name `'a` +} + +fn id<T>(x: PhantomData<T>) -> PhantomData<T> { + x +} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/undeclared-lifetime.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/undeclared-lifetime.stderr new file mode 100644 index 00000000000..4aca17e7354 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/undeclared-lifetime.stderr @@ -0,0 +1,19 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/undeclared-lifetime.rs:14:43 + | +LL | id::<extern "cmse-nonsecure-call" fn(&'a ())>(PhantomData); + | ^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the type lifetime-generic with a new `'a` lifetime + | +LL | id::<for<'a> extern "cmse-nonsecure-call" fn(&'a ())>(PhantomData); + | +++++++ +help: consider introducing lifetime `'a` here + | +LL | fn foo<'a>() { + | ++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/error-codes/E0719.rs b/tests/ui/error-codes/E0719.rs index 0ea6d19000b..d7b4b876d1b 100644 --- a/tests/ui/error-codes/E0719.rs +++ b/tests/ui/error-codes/E0719.rs @@ -1,8 +1,3 @@ -trait Foo: Iterator<Item = i32, Item = i32> {} -//~^ ERROR is already specified -//~| ERROR is already specified -//~| ERROR is already specified - type Unit = (); fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> { diff --git a/tests/ui/error-codes/E0719.stderr b/tests/ui/error-codes/E0719.stderr index 7e8329db1f4..f4817568924 100644 --- a/tests/ui/error-codes/E0719.stderr +++ b/tests/ui/error-codes/E0719.stderr @@ -1,33 +1,5 @@ error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/E0719.rs:1:33 - | -LL | trait Foo: Iterator<Item = i32, Item = i32> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/E0719.rs:1:33 - | -LL | trait Foo: Iterator<Item = i32, Item = i32> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/E0719.rs:1:33 - | -LL | trait Foo: Iterator<Item = i32, Item = i32> {} - | ---------- ^^^^^^^^^^ re-bound here - | | - | `Item` bound here first - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/E0719.rs:8:42 + --> $DIR/E0719.rs:3:42 | LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> { | --------- ^^^^^^^^^^^ re-bound here @@ -35,13 +7,13 @@ LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> { | `Item` bound here first error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified - --> $DIR/E0719.rs:14:38 + --> $DIR/E0719.rs:9:38 | LL | let _: &dyn Iterator<Item = i32, Item = i32>; | ---------- ^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0719`. diff --git a/tests/ui/errors/span-format_args-issue-140578.rs b/tests/ui/errors/span-format_args-issue-140578.rs new file mode 100644 index 00000000000..8c91ded8337 --- /dev/null +++ b/tests/ui/errors/span-format_args-issue-140578.rs @@ -0,0 +1,32 @@ +fn check_format_args() { + print!("{:?} {a} {a:?}", [], a = 1 + 1); + //~^ ERROR type annotations needed +} + +fn check_format_args_nl() { + println!("{:?} {a} {a:?}", [], a = 1 + 1); + //~^ ERROR type annotations needed +} + +fn check_multi1() { + println!("{:?} {:?} {a} {a:?}", [], [], a = 1 + 1); + //~^ ERROR type annotations needed +} + +fn check_multi2() { + println!("{:?} {:?} {a} {a:?} {b:?}", [], [], a = 1 + 1, b = []); + //~^ ERROR type annotations needed +} + +fn check_unformatted() { + println!(" + {:?} {:?} +{a} +{a:?}", + [], + //~^ ERROR type annotations needed + [], +a = 1 + 1); +} + +fn main() {} diff --git a/tests/ui/errors/span-format_args-issue-140578.stderr b/tests/ui/errors/span-format_args-issue-140578.stderr new file mode 100644 index 00000000000..6a273e5cd51 --- /dev/null +++ b/tests/ui/errors/span-format_args-issue-140578.stderr @@ -0,0 +1,43 @@ +error[E0282]: type annotations needed + --> $DIR/span-format_args-issue-140578.rs:2:28 + | +LL | print!("{:?} {a} {a:?}", [], a = 1 + 1); + | ^^ cannot infer type + | + = note: this error originates in the macro `$crate::format_args` which comes from the expansion of the macro `print` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0282]: type annotations needed + --> $DIR/span-format_args-issue-140578.rs:7:30 + | +LL | println!("{:?} {a} {a:?}", [], a = 1 + 1); + | ^^ cannot infer type + | + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0282]: type annotations needed + --> $DIR/span-format_args-issue-140578.rs:12:35 + | +LL | println!("{:?} {:?} {a} {a:?}", [], [], a = 1 + 1); + | ^^ cannot infer type + | + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0282]: type annotations needed + --> $DIR/span-format_args-issue-140578.rs:17:41 + | +LL | println!("{:?} {:?} {a} {a:?} {b:?}", [], [], a = 1 + 1, b = []); + | ^^ cannot infer type + | + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0282]: type annotations needed + --> $DIR/span-format_args-issue-140578.rs:26:9 + | +LL | [], + | ^^ cannot infer type + | + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr index 8bb72833e30..77a637c470c 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr @@ -14,6 +14,11 @@ note: due to a current limitation of the type system, this implies a `'static` l | LL | for<'a> I::Item<'a>: Debug, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: requirement that the value outlives `'static` introduced here + --> $DIR/hrtb-implied-1.rs:26:26 + | +LL | for<'a> I::Item<'a>: Debug, + | ^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.rs b/tests/ui/impl-trait/precise-capturing/migration-note.rs index 7587e89409a..412d8af9884 100644 --- a/tests/ui/impl-trait/precise-capturing/migration-note.rs +++ b/tests/ui/impl-trait/precise-capturing/migration-note.rs @@ -32,6 +32,7 @@ fn needs_static() { //~| NOTE borrowed value does not live long enoug fn needs_static(_: impl Sized + 'static) {} + //~^ NOTE requirement that the value outlives `'static` introduced here needs_static(a); //~^ NOTE argument requires that `x` is borrowed for `'static` } @@ -79,6 +80,7 @@ fn needs_static_mut() { //~| NOTE borrowed value does not live long enough fn needs_static(_: impl Sized + 'static) {} + //~^ NOTE requirement that the value outlives `'static` introduced here needs_static(a); //~^ NOTE argument requires that `x` is borrowed for `'static` } diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.stderr b/tests/ui/impl-trait/precise-capturing/migration-note.stderr index aa0f6400091..880e7878477 100644 --- a/tests/ui/impl-trait/precise-capturing/migration-note.stderr +++ b/tests/ui/impl-trait/precise-capturing/migration-note.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/migration-note.rs:182:17 + --> $DIR/migration-note.rs:184:17 | LL | let x = vec![0]; | - binding `x` declared here @@ -50,6 +50,11 @@ LL | LL | } | - `x` dropped here while still borrowed | +note: requirement that the value outlives `'static` introduced here + --> $DIR/migration-note.rs:34:37 + | +LL | fn needs_static(_: impl Sized + 'static) {} + | ^^^^^^^ note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules --> $DIR/migration-note.rs:29:13 | @@ -61,7 +66,7 @@ LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { | ++++++++ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/migration-note.rs:48:8 + --> $DIR/migration-note.rs:49:8 | LL | let x = vec![1]; | - binding `x` declared here @@ -76,7 +81,7 @@ LL | } | - borrow might be used here, when `a` is dropped and runs the destructor for type `impl std::fmt::Display` | note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:43:13 + --> $DIR/migration-note.rs:44:13 | LL | let a = display_len(&x); | ^^^^^^^^^^^^^^^ @@ -90,7 +95,7 @@ LL | let a = display_len(&x.clone()); | ++++++++ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/migration-note.rs:66:5 + --> $DIR/migration-note.rs:67:5 | LL | let a = display_len_mut(&mut x); | ------ first mutable borrow occurs here @@ -102,7 +107,7 @@ LL | println!("{a}"); | - first borrow later used here | note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:63:13 + --> $DIR/migration-note.rs:64:13 | LL | let a = display_len_mut(&mut x); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -112,7 +117,7 @@ LL | fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display + use<T> { | ++++++++ error[E0597]: `x` does not live long enough - --> $DIR/migration-note.rs:76:29 + --> $DIR/migration-note.rs:77:29 | LL | let mut x = vec![1]; | ----- binding `x` declared here @@ -126,8 +131,13 @@ LL | LL | } | - `x` dropped here while still borrowed | +note: requirement that the value outlives `'static` introduced here + --> $DIR/migration-note.rs:82:37 + | +LL | fn needs_static(_: impl Sized + 'static) {} + | ^^^^^^^ note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:76:13 + --> $DIR/migration-note.rs:77:13 | LL | let a = display_len_mut(&mut x); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -137,7 +147,7 @@ LL | fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display + use<T> { | ++++++++ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/migration-note.rs:95:8 + --> $DIR/migration-note.rs:97:8 | LL | let mut x = vec![1]; | ----- binding `x` declared here @@ -152,7 +162,7 @@ LL | } | - borrow might be used here, when `a` is dropped and runs the destructor for type `impl std::fmt::Display` | note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:90:13 + --> $DIR/migration-note.rs:92:13 | LL | let a = display_len_mut(&mut x); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -166,7 +176,7 @@ LL | let a = display_len_mut(&mut x.clone()); | ++++++++ error[E0506]: cannot assign to `s.f` because it is borrowed - --> $DIR/migration-note.rs:115:5 + --> $DIR/migration-note.rs:117:5 | LL | let a = display_field(&s.f); | ---- `s.f` is borrowed here @@ -178,7 +188,7 @@ LL | println!("{a}"); | - borrow later used here | note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:112:13 + --> $DIR/migration-note.rs:114:13 | LL | let a = display_field(&s.f); | ^^^^^^^^^^^^^^^^^^^ @@ -188,7 +198,7 @@ LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> { | ++++++++ error[E0506]: cannot assign to `s.f` because it is borrowed - --> $DIR/migration-note.rs:131:5 + --> $DIR/migration-note.rs:133:5 | LL | let a = display_field(&mut s.f); | -------- `s.f` is borrowed here @@ -200,7 +210,7 @@ LL | println!("{a}"); | - borrow later used here | note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:128:13 + --> $DIR/migration-note.rs:130:13 | LL | let a = display_field(&mut s.f); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -210,7 +220,7 @@ LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> { | ++++++++ error[E0503]: cannot use `s.f` because it was mutably borrowed - --> $DIR/migration-note.rs:143:5 + --> $DIR/migration-note.rs:145:5 | LL | let a = display_field(&mut s.f); | -------- `s.f` is borrowed here @@ -222,7 +232,7 @@ LL | println!("{a}"); | - borrow later used here | note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:140:13 + --> $DIR/migration-note.rs:142:13 | LL | let a = display_field(&mut s.f); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -232,7 +242,7 @@ LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> { | ++++++++ error[E0597]: `z.f` does not live long enough - --> $DIR/migration-note.rs:159:25 + --> $DIR/migration-note.rs:161:25 | LL | let z = Z { f: vec![1] }; | - binding `z` declared here @@ -248,7 +258,7 @@ LL | } | = note: values in a scope are dropped in the opposite order they are defined note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:159:13 + --> $DIR/migration-note.rs:161:13 | LL | x = display_len(&z.f); | ^^^^^^^^^^^^^^^^^ @@ -258,7 +268,7 @@ LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { | ++++++++ error[E0716]: temporary value dropped while borrowed - --> $DIR/migration-note.rs:170:40 + --> $DIR/migration-note.rs:172:40 | LL | let x = { let x = display_len(&mut vec![0]); x }; | ^^^^^^^ - - borrow later used here @@ -268,7 +278,7 @@ LL | let x = { let x = display_len(&mut vec![0]); x }; | = note: consider using a `let` binding to create a longer lived value note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:170:23 + --> $DIR/migration-note.rs:172:23 | LL | let x = { let x = display_len(&mut vec![0]); x }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -279,7 +289,7 @@ LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { | ++++++++ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/migration-note.rs:198:10 + --> $DIR/migration-note.rs:200:10 | LL | let x = String::new(); | - binding `x` declared here @@ -294,12 +304,12 @@ LL | } | - borrow might be used here, when `y` is dropped and runs the destructor for type `impl Sized` | note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules - --> $DIR/migration-note.rs:195:13 + --> $DIR/migration-note.rs:197:13 | LL | let y = capture_apit(&x); | ^^^^^^^^^^^^^^^^ note: you could use a `use<...>` bound to explicitly specify captures, but argument-position `impl Trait`s are not nameable - --> $DIR/migration-note.rs:189:21 + --> $DIR/migration-note.rs:191:21 | LL | fn capture_apit(x: &impl Sized) -> impl Sized {} | ^^^^^^^^^^ diff --git a/tests/ui/implied-bounds/bevy_world_query.rs b/tests/ui/implied-bounds/bevy_world_query.rs index 6548c03d1b0..e2750bcf957 100644 --- a/tests/ui/implied-bounds/bevy_world_query.rs +++ b/tests/ui/implied-bounds/bevy_world_query.rs @@ -1,6 +1,8 @@ -#![crate_name = "bevy_ecs"] - //@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +#![crate_name = "bevy_ecs"] // We currently special case bevy from erroring on incorrect implied bounds // from normalization (issue #109628). diff --git a/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr index a78941f9e11..3de317d2af6 100644 --- a/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr +++ b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr @@ -1,10 +1,10 @@ error[E0282]: type annotations needed - --> $DIR/issue-107745-avoid-expr-from-macro-expansion.rs:17:5 + --> $DIR/issue-107745-avoid-expr-from-macro-expansion.rs:17:22 | LL | println!("{:?}", []); - | ^^^^^^^^^^^^^^^^^^^^ cannot infer type + | ^^ cannot infer type | - = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index e13653f3423..af07745a00a 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -69,6 +69,12 @@ LL | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> LL | }) LL | } | - `a` dropped here while still borrowed + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:13:8 + | +LL | F: for<'x> FnOnce(Cell<&'a u32>, Cell<&'x u32>), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/closure-requirements/propagate-multiple-requirements.stderr b/tests/ui/nll/closure-requirements/propagate-multiple-requirements.stderr index 15f48d88c37..4136ac418de 100644 --- a/tests/ui/nll/closure-requirements/propagate-multiple-requirements.stderr +++ b/tests/ui/nll/closure-requirements/propagate-multiple-requirements.stderr @@ -13,6 +13,12 @@ LL | z = &local_arr; ... LL | } | - `local_arr` dropped here while still borrowed + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/propagate-multiple-requirements.rs:4:21 + | +LL | fn once<S, T, U, F: FnOnce(S, T) -> U>(f: F, s: S, t: T) -> U { + | ^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/nll/local-outlives-static-via-hrtb.stderr b/tests/ui/nll/local-outlives-static-via-hrtb.stderr index a98f11ce513..263d271b6b3 100644 --- a/tests/ui/nll/local-outlives-static-via-hrtb.stderr +++ b/tests/ui/nll/local-outlives-static-via-hrtb.stderr @@ -17,6 +17,11 @@ note: due to a current limitation of the type system, this implies a `'static` l | LL | fn assert_static_via_hrtb<G>(_: G) where for<'a> G: Outlives<'a> {} | ^^^^^^^^^^^^^^^^^^^^^^^ +note: requirement that the value outlives `'static` introduced here + --> $DIR/local-outlives-static-via-hrtb.rs:15:53 + | +LL | fn assert_static_via_hrtb<G>(_: G) where for<'a> G: Outlives<'a> {} + | ^^^^^^^^^^^^ error[E0597]: `local` does not live long enough --> $DIR/local-outlives-static-via-hrtb.rs:25:45 @@ -37,6 +42,11 @@ note: due to a current limitation of the type system, this implies a `'static` l | LL | for<'a> &'a T: Reference<AssociatedType = &'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: requirement that the value outlives `'static` introduced here + --> $DIR/local-outlives-static-via-hrtb.rs:19:30 + | +LL | for<'a> &'a T: Reference<AssociatedType = &'a ()>, + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr index 6e47b8e59f5..804b3f00a26 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr @@ -18,6 +18,11 @@ note: due to a current limitation of the type system, this implies a `'static` l | LL | fn bad<F: Fn(&()) -> &()>(_: F) {} | ^^^^^^^^^^^^^^ +note: requirement that the value outlives `'static` introduced here + --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 + | +LL | fn bad<F: Fn(&()) -> &()>(_: F) {} + | ^^^ error: implementation of `Fn` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr index 6e47b8e59f5..804b3f00a26 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr @@ -18,6 +18,11 @@ note: due to a current limitation of the type system, this implies a `'static` l | LL | fn bad<F: Fn(&()) -> &()>(_: F) {} | ^^^^^^^^^^^^^^ +note: requirement that the value outlives `'static` introduced here + --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 + | +LL | fn bad<F: Fn(&()) -> &()>(_: F) {} + | ^^^ error: implementation of `Fn` is not general enough --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 diff --git a/tests/ui/proc-macro/quote/not-quotable.stderr b/tests/ui/proc-macro/quote/not-quotable.stderr index d1c3d06f2b6..62a02638e54 100644 --- a/tests/ui/proc-macro/quote/not-quotable.stderr +++ b/tests/ui/proc-macro/quote/not-quotable.stderr @@ -15,8 +15,8 @@ LL | let _ = quote! { $ip }; Cow<'_, T> Option<T> Rc<T> - RepInterp<T> - and 25 others + bool + and 24 others error: aborting due to 1 previous error diff --git a/tests/ui/regions/multiple-sources-for-outlives-requirement.rs b/tests/ui/regions/multiple-sources-for-outlives-requirement.rs new file mode 100644 index 00000000000..720cd1cf6ee --- /dev/null +++ b/tests/ui/regions/multiple-sources-for-outlives-requirement.rs @@ -0,0 +1,11 @@ +fn outlives_indir<'a: 'b, 'b, T: 'a>(_x: T) {} +//~^ NOTE: requirements that the value outlives `'b` introduced here + +fn foo<'b>() { //~ NOTE: lifetime `'b` defined here + outlives_indir::<'_, 'b, _>(&mut 1u32); //~ ERROR: temporary value dropped while borrowed + //~^ NOTE: argument requires that borrow lasts for `'b` + //~| NOTE: creates a temporary value which is freed while still in use + //~| NOTE: temporary value is freed at the end of this statement +} + +fn main() {} diff --git a/tests/ui/regions/multiple-sources-for-outlives-requirement.stderr b/tests/ui/regions/multiple-sources-for-outlives-requirement.stderr new file mode 100644 index 00000000000..4cdaf950e15 --- /dev/null +++ b/tests/ui/regions/multiple-sources-for-outlives-requirement.stderr @@ -0,0 +1,20 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/multiple-sources-for-outlives-requirement.rs:5:38 + | +LL | fn foo<'b>() { + | -- lifetime `'b` defined here +LL | outlives_indir::<'_, 'b, _>(&mut 1u32); + | ---------------------------------^^^^-- temporary value is freed at the end of this statement + | | | + | | creates a temporary value which is freed while still in use + | argument requires that borrow lasts for `'b` + | +note: requirements that the value outlives `'b` introduced here + --> $DIR/multiple-sources-for-outlives-requirement.rs:1:23 + | +LL | fn outlives_indir<'a: 'b, 'b, T: 'a>(_x: T) {} + | ^^ ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/regions/regions-infer-proc-static-upvar.stderr b/tests/ui/regions/regions-infer-proc-static-upvar.stderr index 919fcffdc53..158d74ed06d 100644 --- a/tests/ui/regions/regions-infer-proc-static-upvar.stderr +++ b/tests/ui/regions/regions-infer-proc-static-upvar.stderr @@ -11,6 +11,12 @@ LL | | }); | |______- argument requires that `x` is borrowed for `'static` LL | } | - `x` dropped here while still borrowed + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/regions-infer-proc-static-upvar.rs:4:19 + | +LL | fn foo<F:FnOnce()+'static>(_p: F) { } + | ^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/regions/regions-pattern-typing-issue-19552.stderr b/tests/ui/regions/regions-pattern-typing-issue-19552.stderr index 1d3d5e831c3..a8fd827bc69 100644 --- a/tests/ui/regions/regions-pattern-typing-issue-19552.stderr +++ b/tests/ui/regions/regions-pattern-typing-issue-19552.stderr @@ -10,6 +10,12 @@ LL | [ word ] => { assert_static(word); } LL | } LL | } | - `line` dropped here while still borrowed + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/regions-pattern-typing-issue-19552.rs:1:21 + | +LL | fn assert_static<T: 'static>(_t: T) {} + | ^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/static/static-lifetime-bound.stderr b/tests/ui/static/static-lifetime-bound.stderr index 8b0d3a0bf4c..51be79be5db 100644 --- a/tests/ui/static/static-lifetime-bound.stderr +++ b/tests/ui/static/static-lifetime-bound.stderr @@ -10,6 +10,12 @@ LL | f(&x); | argument requires that `x` is borrowed for `'static` LL | } | - `x` dropped here while still borrowed + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/static-lifetime-bound.rs:1:10 + | +LL | fn f<'a: 'static>(_: &'a i32) {} + | ^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/static/static-region-bound.stderr b/tests/ui/static/static-region-bound.stderr index a47c9457102..8472738daa4 100644 --- a/tests/ui/static/static-region-bound.stderr +++ b/tests/ui/static/static-region-bound.stderr @@ -7,6 +7,12 @@ LL | f(x); | ---- argument requires that borrow lasts for `'static` LL | } | - temporary value is freed at the end of this statement + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/static-region-bound.rs:3:8 + | +LL | fn f<T:'static>(_: T) {} + | ^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/auxiliary/hidden-struct.rs b/tests/ui/suggestions/auxiliary/hidden-struct.rs index 30d69acac20..1f495a9f222 100644 --- a/tests/ui/suggestions/auxiliary/hidden-struct.rs +++ b/tests/ui/suggestions/auxiliary/hidden-struct.rs @@ -1,3 +1,5 @@ +// `Foo` and `Bar` should not be suggested in diagnostics of dependents + #[doc(hidden)] pub mod hidden { pub struct Foo; @@ -5,13 +7,29 @@ pub mod hidden { pub mod hidden1 { #[doc(hidden)] - pub struct Foo; + pub struct Bar; } +// `Baz` and `Quux` *should* be suggested in diagnostics of dependents #[doc(hidden)] -pub(crate) mod hidden2 { - pub struct Bar; +pub mod hidden2 { + pub struct Baz; +} + +pub use hidden2::Baz; + +#[doc(hidden)] +pub(crate) mod hidden3 { + pub struct Quux; } -pub use hidden2::Bar; +pub use hidden3::Quux; + +pub trait Marker {} + +impl Marker for Option<u32> {} +impl Marker for hidden::Foo {} +impl Marker for hidden1::Bar {} +impl Marker for Baz {} +impl Marker for Quux {} diff --git a/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.rs b/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.rs index 281975dcc2f..a83e496f270 100644 --- a/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.rs +++ b/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.rs @@ -1,5 +1,4 @@ //@ aux-build:hidden-struct.rs -//@ compile-flags: --crate-type lib extern crate hidden_struct; @@ -9,7 +8,20 @@ mod local { } pub fn test(_: Foo) {} -//~^ ERROR cannot find type `Foo` in this scope +//~^ ERROR [E0412] pub fn test2(_: Bar) {} -//~^ ERROR cannot find type `Bar` in this scope +//~^ ERROR [E0412] + +pub fn test3(_: Baz) {} +//~^ ERROR [E0412] + +pub fn test4(_: Quux) {} +//~^ ERROR [E0412] + +fn test5<T: hidden_struct::Marker>() {} + +fn main() { + test5::<i32>(); + //~^ ERROR [E0277] +} diff --git a/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.stderr b/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.stderr index 7fb4d95ff9b..7036708756d 100644 --- a/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.stderr +++ b/tests/ui/suggestions/dont-suggest-foreign-doc-hidden.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Foo` in this scope - --> $DIR/dont-suggest-foreign-doc-hidden.rs:11:16 + --> $DIR/dont-suggest-foreign-doc-hidden.rs:10:16 | LL | pub fn test(_: Foo) {} | ^^^ not found in this scope @@ -10,16 +10,50 @@ LL + use local::Foo; | error[E0412]: cannot find type `Bar` in this scope - --> $DIR/dont-suggest-foreign-doc-hidden.rs:14:17 + --> $DIR/dont-suggest-foreign-doc-hidden.rs:13:17 | LL | pub fn test2(_: Bar) {} | ^^^ not found in this scope + +error[E0412]: cannot find type `Baz` in this scope + --> $DIR/dont-suggest-foreign-doc-hidden.rs:16:17 + | +LL | pub fn test3(_: Baz) {} + | ^^^ not found in this scope | help: consider importing this struct | -LL + use hidden_struct::Bar; +LL + use hidden_struct::Baz; + | + +error[E0412]: cannot find type `Quux` in this scope + --> $DIR/dont-suggest-foreign-doc-hidden.rs:19:17 + | +LL | pub fn test4(_: Quux) {} + | ^^^^ not found in this scope + | +help: consider importing this struct + | +LL + use hidden_struct::Quux; + | + +error[E0277]: the trait bound `i32: Marker` is not satisfied + --> $DIR/dont-suggest-foreign-doc-hidden.rs:25:13 + | +LL | test5::<i32>(); + | ^^^ the trait `Marker` is not implemented for `i32` + | + = help: the following other types implement trait `Marker`: + Baz + Option<u32> + Quux +note: required by a bound in `test5` + --> $DIR/dont-suggest-foreign-doc-hidden.rs:22:13 | +LL | fn test5<T: hidden_struct::Marker>() {} + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test5` -error: aborting due to 2 previous errors +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0277, E0412. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs b/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs index 2760c1696b5..f603ff1ec80 100644 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs +++ b/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs @@ -1,12 +1,5 @@ //@ revisions: current next //@[next] compile-flags: -Znext-solver -//@[next] failure-status: 101 -//@[next] known-bug: unknown -//@[next] normalize-stderr: "note: .*\n\n" -> "" -//@[next] normalize-stderr: "thread 'rustc' panicked.*\n.*\n" -> "" -//@[next] normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -//@[next] normalize-stderr: "delayed at .*" -> "" -//@[next] rustc-env:RUST_BACKTRACE=0 //@ check-pass trait Super { diff --git a/tests/ui/wf/wf-in-where-clause-static.current.stderr b/tests/ui/wf/wf-in-where-clause-static.current.stderr index d0bb89884c6..788fe2c3faa 100644 --- a/tests/ui/wf/wf-in-where-clause-static.current.stderr +++ b/tests/ui/wf/wf-in-where-clause-static.current.stderr @@ -6,6 +6,12 @@ LL | let s = foo(&String::from("blah blah blah")); | | | | | creates a temporary value which is freed while still in use | argument requires that borrow lasts for `'static` + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/wf-in-where-clause-static.rs:12:17 + | +LL | &'static S: Static, + | ^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/wf/wf-in-where-clause-static.next.stderr b/tests/ui/wf/wf-in-where-clause-static.next.stderr index d0bb89884c6..788fe2c3faa 100644 --- a/tests/ui/wf/wf-in-where-clause-static.next.stderr +++ b/tests/ui/wf/wf-in-where-clause-static.next.stderr @@ -6,6 +6,12 @@ LL | let s = foo(&String::from("blah blah blah")); | | | | | creates a temporary value which is freed while still in use | argument requires that borrow lasts for `'static` + | +note: requirement that the value outlives `'static` introduced here + --> $DIR/wf-in-where-clause-static.rs:12:17 + | +LL | &'static S: Static, + | ^^^^^^ error: aborting due to 1 previous error |
