diff options
Diffstat (limited to 'tests')
140 files changed, 1204 insertions, 734 deletions
diff --git a/tests/ui/consts/eval_type_mismatch.rs b/tests/crashes/121858.rs index 3d821ab538e..7d5bae37f84 100644 --- a/tests/ui/consts/eval_type_mismatch.rs +++ b/tests/crashes/121858.rs @@ -1,17 +1,14 @@ +//@ known-bug: #121858 #![feature(generic_const_exprs)] -#![allow(incomplete_features)] struct Outer<const A: i64, const B: usize>(); impl<const A: usize, const B: usize> Outer<A, B> -//~^ ERROR: `A` is not of type `i64` -//~| ERROR: mismatched types where [(); A + (B * 2)]:, { - fn o() {} + fn o() -> Union {} } fn main() { Outer::<1, 1>::o(); - //~^ ERROR: no function or associated item named `o` found } diff --git a/tests/crashes/122638.rs b/tests/crashes/122638.rs deleted file mode 100644 index af0fc5bbd50..00000000000 --- a/tests/crashes/122638.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ known-bug: #122638 -#![feature(min_specialization)] - -impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> { - fn next(&mut self) -> Option<Self::Item> {} -} - -struct ConstChunksExact<'a, T: '_, const assert: usize> {} - -impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { - type Item = &'a [T; N]; -} diff --git a/tests/crashes/123141-2.rs b/tests/crashes/123141-2.rs deleted file mode 100644 index 74f961c2a33..00000000000 --- a/tests/crashes/123141-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -//@ known-bug: #123141 - -trait ConstChunksExactTrait<T> { - fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'_, T, {N}>; -} - -impl <T> ConstChunksExactTrait<T> for [T] {} - -struct ConstChunksExact<'a, T: 'a, const N: usize> {} - -impl <'a, T: , const N: usize> Iterator for ConstChunksExact<'a, T, {rem}> { - type Item = &'a [T; N]; -} - -fn main() { - let slice = &[1i32, 2, 3, 4, 5, 6, 7, 7, 9, 1i32]; - - let mut iter = [[1, 2, 3], [4, 5, 6], [7, 8 ,9]].iter(); - - for a in slice.const_chunks_exact::<3>() { - assert_eq!(a, iter.next().unwrap()); - } -} diff --git a/tests/crashes/123141.rs b/tests/crashes/123141.rs index 99dfee7670e..07181387e04 100644 --- a/tests/crashes/123141.rs +++ b/tests/crashes/123141.rs @@ -1,22 +1,23 @@ //@ known-bug: #123141 -trait ConstChunksExactTrait<T> { - fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'_, T, { N }>; + +trait Trait { + fn next(self) -> Self::Item; + type Item; } -impl<T> ConstChunksExactTrait<T> for [T] {} +struct Foo<T: ?Sized>(T); -struct ConstChunksExact<'a, T: 'a, const N: usize> {} +impl<T: ?Sized, U> Trait for Foo<U> { + type Item = Foo<T>; + fn next(self) -> Self::Item { + loop {} + } +} -impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, { rem }> { - type Item = &'a [T; N]; +fn opaque() -> impl Trait { + Foo::<_>(10_u32) } fn main() { - let slice = &[1i32, 2, 3, 4, 5, 6, 7, 7, 9, 1i32]; - - let mut iter = [[1, 2, 3], [4, 5, 6], [7, 8, 9]].iter(); - - for a in slice.const_chunks_exact::<3>() { - assert_eq!(a, iter.next().unwrap()); - } + opaque().next(); } diff --git a/tests/run-make/rust-lld-by-default/rmake.rs b/tests/run-make/rust-lld-by-default/rmake.rs index 6a8dae1043e..8ab16394a91 100644 --- a/tests/run-make/rust-lld-by-default/rmake.rs +++ b/tests/run-make/rust-lld-by-default/rmake.rs @@ -17,8 +17,9 @@ fn main() { .input("main.rs") .run(); assert!( - find_lld_version_in_logs(output), - "the LLD version string should be present in the output logs" + find_lld_version_in_logs(&output), + "the LLD version string should be present in the output logs:\n{}", + std::str::from_utf8(&output.stderr).unwrap() ); // But it can still be disabled by turning the linker feature off. @@ -29,13 +30,14 @@ fn main() { .input("main.rs") .run(); assert!( - !find_lld_version_in_logs(output), - "the LLD version string should not be present in the output logs" + !find_lld_version_in_logs(&output), + "the LLD version string should not be present in the output logs:\n{}", + std::str::from_utf8(&output.stderr).unwrap() ); } -fn find_lld_version_in_logs(output: Output) -> bool { +fn find_lld_version_in_logs(output: &Output) -> bool { let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap(); let stderr = std::str::from_utf8(&output.stderr).unwrap(); - stderr.lines().any(|line| lld_version_re.is_match(line)) + stderr.lines().any(|line| lld_version_re.is_match(line.trim())) } diff --git a/tests/run-make/rust-lld-custom-target/rmake.rs b/tests/run-make/rust-lld-custom-target/rmake.rs index 9bdb69f47d8..e6c4a321d00 100644 --- a/tests/run-make/rust-lld-custom-target/rmake.rs +++ b/tests/run-make/rust-lld-custom-target/rmake.rs @@ -23,8 +23,9 @@ fn main() { .input("lib.rs") .run(); assert!( - find_lld_version_in_logs(output), - "the LLD version string should be present in the output logs" + find_lld_version_in_logs(&output), + "the LLD version string should be present in the output logs:\n{}", + std::str::from_utf8(&output.stderr).unwrap() ); // But it can also be disabled via linker features. @@ -37,13 +38,14 @@ fn main() { .input("lib.rs") .run(); assert!( - !find_lld_version_in_logs(output), - "the LLD version string should not be present in the output logs" + !find_lld_version_in_logs(&output), + "the LLD version string should not be present in the output logs:\n{}", + std::str::from_utf8(&output.stderr).unwrap() ); } -fn find_lld_version_in_logs(output: Output) -> bool { +fn find_lld_version_in_logs(output: &Output) -> bool { let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap(); let stderr = std::str::from_utf8(&output.stderr).unwrap(); - stderr.lines().any(|line| lld_version_re.is_match(line)) + stderr.lines().any(|line| lld_version_re.is_match(line.trim())) } diff --git a/tests/run-make/rust-lld/rmake.rs b/tests/run-make/rust-lld/rmake.rs index feeb82e709e..a74e858045d 100644 --- a/tests/run-make/rust-lld/rmake.rs +++ b/tests/run-make/rust-lld/rmake.rs @@ -21,8 +21,9 @@ fn main() { .input("main.rs") .run(); assert!( - find_lld_version_in_logs(output), - "the LLD version string should be present in the output logs" + find_lld_version_in_logs(&output), + "the LLD version string should be present in the output logs:\n{}", + std::str::from_utf8(&output.stderr).unwrap() ); // It should not be used when we explictly opt-out of lld. @@ -33,8 +34,9 @@ fn main() { .input("main.rs") .run(); assert!( - !find_lld_version_in_logs(output), - "the LLD version string should not be present in the output logs" + !find_lld_version_in_logs(&output), + "the LLD version string should not be present in the output logs:\n{}", + std::str::from_utf8(&output.stderr).unwrap() ); // While we're here, also check that the last linker feature flag "wins" when passed multiple @@ -50,13 +52,14 @@ fn main() { .input("main.rs") .run(); assert!( - find_lld_version_in_logs(output), - "the LLD version string should be present in the output logs" + find_lld_version_in_logs(&output), + "the LLD version string should be present in the output logs:\n{}", + std::str::from_utf8(&output.stderr).unwrap() ); } -fn find_lld_version_in_logs(output: Output) -> bool { +fn find_lld_version_in_logs(output: &Output) -> bool { let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap(); let stderr = std::str::from_utf8(&output.stderr).unwrap(); - stderr.lines().any(|line| lld_version_re.is_match(line)) + stderr.lines().any(|line| lld_version_re.is_match(line.trim())) } diff --git a/tests/rustdoc-ui/invalid_associated_const.rs b/tests/rustdoc-ui/invalid_associated_const.rs index 6f211a383a6..f93834268f6 100644 --- a/tests/rustdoc-ui/invalid_associated_const.rs +++ b/tests/rustdoc-ui/invalid_associated_const.rs @@ -2,8 +2,8 @@ trait T { type A: S<C<X = 0i32> = 34>; - //~^ ERROR associated type bindings are not allowed here - //~| ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here + //~| ERROR associated item constraints are not allowed here } trait S { diff --git a/tests/rustdoc-ui/invalid_associated_const.stderr b/tests/rustdoc-ui/invalid_associated_const.stderr index 5eaddc2b8c9..6e5ddc44982 100644 --- a/tests/rustdoc-ui/invalid_associated_const.stderr +++ b/tests/rustdoc-ui/invalid_associated_const.stderr @@ -1,22 +1,22 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/invalid_associated_const.rs:4:17 | LL | type A: S<C<X = 0i32> = 34>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<X = 0i32> = 34>; | ~~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/invalid_associated_const.rs:4:17 | LL | type A: S<C<X = 0i32> = 34>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<X = 0i32> = 34>; | ~~~~~~~~~~ diff --git a/tests/rustdoc-ui/issue-102467.rs b/tests/rustdoc-ui/issue-102467.rs index a27e6156979..d9bd48103d2 100644 --- a/tests/rustdoc-ui/issue-102467.rs +++ b/tests/rustdoc-ui/issue-102467.rs @@ -5,8 +5,8 @@ trait T { type A: S<C<X = 0i32> = 34>; - //~^ ERROR associated type bindings are not allowed here - //~| ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here + //~| ERROR associated item constraints are not allowed here } trait S { diff --git a/tests/rustdoc-ui/issue-102467.stderr b/tests/rustdoc-ui/issue-102467.stderr index 119ca949e99..99f91102319 100644 --- a/tests/rustdoc-ui/issue-102467.stderr +++ b/tests/rustdoc-ui/issue-102467.stderr @@ -1,22 +1,22 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102467.rs:7:17 | LL | type A: S<C<X = 0i32> = 34>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<X = 0i32> = 34>; | ~~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102467.rs:7:17 | LL | type A: S<C<X = 0i32> = 34>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<X = 0i32> = 34>; | ~~~~~~~~~~ diff --git a/tests/ui/associated-consts/issue-102335-const.rs b/tests/ui/associated-consts/issue-102335-const.rs index 969c2c43b71..fd922cd0f1d 100644 --- a/tests/ui/associated-consts/issue-102335-const.rs +++ b/tests/ui/associated-consts/issue-102335-const.rs @@ -2,8 +2,8 @@ trait T { type A: S<C<X = 0i32> = 34>; - //~^ ERROR associated type bindings are not allowed here - //~| ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here + //~| ERROR associated item constraints are not allowed here } trait S { diff --git a/tests/ui/associated-consts/issue-102335-const.stderr b/tests/ui/associated-consts/issue-102335-const.stderr index 905d7c75c20..dc1631220e2 100644 --- a/tests/ui/associated-consts/issue-102335-const.stderr +++ b/tests/ui/associated-consts/issue-102335-const.stderr @@ -1,22 +1,22 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-const.rs:4:17 | LL | type A: S<C<X = 0i32> = 34>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<X = 0i32> = 34>; | ~~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-const.rs:4:17 | LL | type A: S<C<X = 0i32> = 34>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<X = 0i32> = 34>; | ~~~~~~~~~~ diff --git a/tests/ui/associated-type-bounds/issue-102335-ty.rs b/tests/ui/associated-type-bounds/issue-102335-ty.rs index b2df68b18ae..86bde6367a4 100644 --- a/tests/ui/associated-type-bounds/issue-102335-ty.rs +++ b/tests/ui/associated-type-bounds/issue-102335-ty.rs @@ -1,13 +1,13 @@ trait T { type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint - //~^ ERROR associated type bindings are not allowed here - //~| ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here + //~| ERROR associated item constraints are not allowed here } trait T2 { type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints - //~^ ERROR associated type bindings are not allowed here - //~| ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here + //~| ERROR associated item constraints are not allowed here } trait Q {} diff --git a/tests/ui/associated-type-bounds/issue-102335-ty.stderr b/tests/ui/associated-type-bounds/issue-102335-ty.stderr index cf30b0a4f6c..cd585f7f7d8 100644 --- a/tests/ui/associated-type-bounds/issue-102335-ty.stderr +++ b/tests/ui/associated-type-bounds/issue-102335-ty.stderr @@ -1,45 +1,45 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-ty.rs:2:17 | LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint - | ^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint | ~~~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-ty.rs:2:17 | LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint - | ^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<i32 = u32> = ()>; // Just one erroneous equality constraint | ~~~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-ty.rs:8:17 | LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints - | ^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints | ~~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-ty.rs:8:17 | LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints - | ^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<i32 = u32, X = i32> = ()>; // More than one erroneous equality constraints | ~~~~~~~~~~ diff --git a/tests/ui/associated-type-bounds/no-gat-position.rs b/tests/ui/associated-type-bounds/no-gat-position.rs index 5005c5027f4..cb62c882468 100644 --- a/tests/ui/associated-type-bounds/no-gat-position.rs +++ b/tests/ui/associated-type-bounds/no-gat-position.rs @@ -4,7 +4,7 @@ pub trait Iter { type Item<'a>: 'a where Self: 'a; fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>; - //~^ ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here } impl Iter for () { diff --git a/tests/ui/associated-type-bounds/no-gat-position.stderr b/tests/ui/associated-type-bounds/no-gat-position.stderr index c348d33c3a9..e167ac1fda4 100644 --- a/tests/ui/associated-type-bounds/no-gat-position.stderr +++ b/tests/ui/associated-type-bounds/no-gat-position.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/no-gat-position.rs:6:56 | LL | fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>; - | ^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^ associated item constraint not allowed here error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/associated-types-eq-2.rs b/tests/ui/associated-types/associated-types-eq-2.rs index 43b0208461e..f0a7d1e46b1 100644 --- a/tests/ui/associated-types/associated-types-eq-2.rs +++ b/tests/ui/associated-types/associated-types-eq-2.rs @@ -18,14 +18,14 @@ impl Tr1 for isize { // Test for when the assoc type is // specified as an equality constraint impl Tr1<A = usize> for usize { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR not all trait items implemented, missing: `A` fn boo(&self) -> usize { 42 } } // Test for a wronngly used equality constraint in a func arg fn baz<I: Tr1>(_x: &<I as Tr1<A=Bar>>::A) {} -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here @@ -38,28 +38,28 @@ trait Tr2<T1, T2, T3> { // (Note: E0229 is emitted only for the first erroneous equality // constraint (T2) not for any subequent ones (e.g. T3)) impl Tr2<i32, T2 = Qux, T3 = usize> for Bar { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR trait takes 3 generic arguments but 1 generic argument was supplied } // Test for when equality constraint's ident matches a // generic param's ident but has different case impl Tr2<i32, t2 = Qux, T3 = usize> for Qux { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR trait takes 3 generic arguments but 1 generic argument was supplied } // Test for when equality constraint's ident // matches none of the generic param idents impl Tr2<i32, X = Qux, Y = usize> for Bar { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR trait takes 3 generic arguments but 1 generic argument was supplied } // Test for when the term in equality constraint is itself generic struct GenericTerm<T> { _t: T } impl Tr2<i32, Qux, T3 = GenericTerm<i32>> for Bar { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR trait takes 3 generic arguments but 2 generic arguments were supplied } @@ -74,7 +74,7 @@ trait Tr3<const N: i32, T2, T3> { // (Deliberately spread over multiple lines to test that // our suggestion spans are kosher in the face of such formatting) impl Tr3<N -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR associated const equality is incomplete //~| ERROR trait takes 3 generic arguments but 0 generic arguments were supplied = 42, T2 = Qux, T3 = usize> for Bar { @@ -83,7 +83,7 @@ impl Tr3<N // Test for when equality constraint's ident // matches the const param's ident but has a different case impl Tr3<n = 42, T2 = Qux, T3 = usize> for Qux { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR associated const equality is incomplete //~| ERROR trait takes 3 generic arguments but 0 generic arguments were supplied } @@ -91,14 +91,14 @@ impl Tr3<n = 42, T2 = Qux, T3 = usize> for Qux { // Test for when equality constraint's ident // matches the const param ident but the constraint is a type arg impl Tr3<N = u32, T2 = Qux, T3 = usize> for Bar { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR trait takes 3 generic arguments but 0 generic arguments were supplied } // Test for when equality constraint's ident // matches a type param ident but the constraint is a const arg impl Tr3<42, T2 = 42, T3 = usize> for Bar { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR associated const equality is incomplete //~| ERROR trait takes 3 generic arguments but 1 generic argument was supplied } @@ -106,7 +106,7 @@ impl Tr3<42, T2 = 42, T3 = usize> for Bar { // Test for when equality constraint's ident // matches none of the param idents impl Tr3<X = 42, Y = Qux, Z = usize> for Bar { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR associated const equality is incomplete //~| ERROR trait takes 3 generic arguments but 0 generic arguments were supplied } @@ -117,7 +117,7 @@ impl Tr3<X = 42, Y = Qux, Z = usize> for Bar { struct St<'a, T> { v: &'a T } impl<'a, T> St<'a , T = Qux> { -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR struct takes 1 generic argument but 0 generic arguments were supplied } diff --git a/tests/ui/associated-types/associated-types-eq-2.stderr b/tests/ui/associated-types/associated-types-eq-2.stderr index b68c82f590c..53e4e59128e 100644 --- a/tests/ui/associated-types/associated-types-eq-2.stderr +++ b/tests/ui/associated-types/associated-types-eq-2.stderr @@ -43,13 +43,13 @@ LL | impl Tr3<X = 42, Y = Qux, Z = usize> for Bar { = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:20:10 | LL | impl Tr1<A = usize> for usize { - | ^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | impl Tr1<A = usize> for usize { | ~~~~~~~~~~~ @@ -63,13 +63,13 @@ LL | type A; LL | impl Tr1<A = usize> for usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `A` in implementation -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:27:31 | LL | fn baz<I: Tr1>(_x: &<I as Tr1<A=Bar>>::A) {} - | ^^^^^ associated type not allowed here + | ^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | fn baz<I: Tr1>(_x: &<I as Tr1<A=Bar>>::A) {} | ~~~~~~~ @@ -92,11 +92,11 @@ help: add missing generic arguments LL | impl Tr2<i32, T2, T3, T2 = Qux, T3 = usize> for Bar { | ++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:40:15 | LL | impl Tr2<i32, T2 = Qux, T3 = usize> for Bar { - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | help: to use `Qux` as a generic argument specify it directly | @@ -121,13 +121,13 @@ help: add missing generic arguments LL | impl Tr2<i32, T2, T3, t2 = Qux, T3 = usize> for Qux { | ++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:47:15 | LL | impl Tr2<i32, t2 = Qux, T3 = usize> for Qux { - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | impl Tr2<i32, t2 = Qux, T3 = usize> for Qux { | ~~~~~~~~~~ @@ -150,13 +150,13 @@ help: add missing generic arguments LL | impl Tr2<i32, T2, T3, X = Qux, Y = usize> for Bar { | ++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:54:15 | LL | impl Tr2<i32, X = Qux, Y = usize> for Bar { - | ^^^^^^^ associated type not allowed here + | ^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | impl Tr2<i32, X = Qux, Y = usize> for Bar { | ~~~~~~~~~ @@ -179,11 +179,11 @@ help: add missing generic argument LL | impl Tr2<i32, Qux, T3, T3 = GenericTerm<i32>> for Bar { | ++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:61:20 | LL | impl Tr2<i32, Qux, T3 = GenericTerm<i32>> for Bar { - | ^^^^^^^^^^^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^^^^^^^^^^^ associated item constraint not allowed here | help: to use `GenericTerm<i32>` as a generic argument specify it directly | @@ -206,7 +206,7 @@ help: add missing generic arguments LL | impl Tr3<N, T2, T3, N | ++++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:76:10 | LL | impl Tr3<N @@ -215,7 +215,7 @@ LL | | LL | | LL | | LL | | = 42, T2 = Qux, T3 = usize> for Bar { - | |____^ associated type not allowed here + | |____^ associated item constraint not allowed here | help: to use `42` as a generic argument specify it directly | @@ -238,13 +238,13 @@ help: add missing generic arguments LL | impl Tr3<N, T2, T3, n = 42, T2 = Qux, T3 = usize> for Qux { | ++++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:85:10 | LL | impl Tr3<n = 42, T2 = Qux, T3 = usize> for Qux { - | ^^^^^^ associated type not allowed here + | ^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | impl Tr3<n = 42, T2 = Qux, T3 = usize> for Qux { | ~~~~~~~ @@ -265,13 +265,13 @@ help: add missing generic arguments LL | impl Tr3<N, T2, T3, N = u32, T2 = Qux, T3 = usize> for Bar { | ++++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:93:10 | LL | impl Tr3<N = u32, T2 = Qux, T3 = usize> for Bar { - | ^^^^^^^ associated type not allowed here + | ^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | impl Tr3<N = u32, T2 = Qux, T3 = usize> for Bar { | ~~~~~~~~ @@ -294,13 +294,13 @@ help: add missing generic arguments LL | impl Tr3<42, T2, T3, T2 = 42, T3 = usize> for Bar { | ++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:100:14 | LL | impl Tr3<42, T2 = 42, T3 = usize> for Bar { - | ^^^^^^^ associated type not allowed here + | ^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | impl Tr3<42, T2 = 42, T3 = usize> for Bar { | ~~~~~~~~~ @@ -321,13 +321,13 @@ help: add missing generic arguments LL | impl Tr3<N, T2, T3, X = 42, Y = Qux, Z = usize> for Bar { | ++++++++++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:108:10 | LL | impl Tr3<X = 42, Y = Qux, Z = usize> for Bar { - | ^^^^^^ associated type not allowed here + | ^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | impl Tr3<X = 42, Y = Qux, Z = usize> for Bar { | ~~~~~~~ @@ -348,11 +348,11 @@ help: add missing generic argument LL | impl<'a, T> St<'a, T , T = Qux> { | +++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:119:21 | LL | impl<'a, T> St<'a , T = Qux> { - | ^^^^^^^ associated type not allowed here + | ^^^^^^^ associated item constraint not allowed here | help: to use `Qux` as a generic argument specify it directly | diff --git a/tests/ui/associated-types/associated-types-eq-expr-path.rs b/tests/ui/associated-types/associated-types-eq-expr-path.rs index 143992f29f1..4561e596c66 100644 --- a/tests/ui/associated-types/associated-types-eq-expr-path.rs +++ b/tests/ui/associated-types/associated-types-eq-expr-path.rs @@ -11,6 +11,6 @@ impl Foo for isize { } pub fn main() { - let x: isize = Foo::<A=usize>::bar(); - //~^ ERROR associated type bindings are not allowed here + let x: isize = Foo::<A = usize>::bar(); + //~^ ERROR associated item constraints are not allowed here } diff --git a/tests/ui/associated-types/associated-types-eq-expr-path.stderr b/tests/ui/associated-types/associated-types-eq-expr-path.stderr index 7559f3b7c2e..3d0e3e61eca 100644 --- a/tests/ui/associated-types/associated-types-eq-expr-path.stderr +++ b/tests/ui/associated-types/associated-types-eq-expr-path.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-expr-path.rs:14:26 | -LL | let x: isize = Foo::<A=usize>::bar(); - | ^^^^^^^ associated type not allowed here +LL | let x: isize = Foo::<A = usize>::bar(); + | ^^^^^^^^^ associated item constraint not allowed here error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/defaults-suitability.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 82b35a48637..3cdeaa93a34 100644 --- a/tests/ui/associated-types/defaults-suitability.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `NotClone: Clone` is not satisfied - --> $DIR/defaults-suitability.rs:13:22 + --> $DIR/defaults-suitability.rs:16:22 | LL | type Ty: Clone = NotClone; | ^^^^^^^^ the trait `Clone` is not implemented for `NotClone` | note: required by a bound in `Tr::Ty` - --> $DIR/defaults-suitability.rs:13:14 + --> $DIR/defaults-suitability.rs:16:14 | LL | type Ty: Clone = NotClone; | ^^^^^ required by this bound in `Tr::Ty` @@ -16,13 +16,13 @@ LL | struct NotClone; | error[E0277]: the trait bound `NotClone: Clone` is not satisfied - --> $DIR/defaults-suitability.rs:22:15 + --> $DIR/defaults-suitability.rs:25:15 | LL | type Ty = NotClone; | ^^^^^^^^ the trait `Clone` is not implemented for `NotClone` | note: required by a bound in `Tr2::Ty` - --> $DIR/defaults-suitability.rs:20:15 + --> $DIR/defaults-suitability.rs:23:15 | LL | Self::Ty: Clone, | ^^^^^ required by this bound in `Tr2::Ty` @@ -36,14 +36,14 @@ LL | struct NotClone; | error[E0277]: the trait bound `T: Clone` is not satisfied - --> $DIR/defaults-suitability.rs:28:23 + --> $DIR/defaults-suitability.rs:31:23 | LL | type Bar: Clone = Vec<T>; | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `Vec<T>: Clone` | = note: required for `Vec<T>` to implement `Clone` note: required by a bound in `Foo::Bar` - --> $DIR/defaults-suitability.rs:28:15 + --> $DIR/defaults-suitability.rs:31:15 | LL | type Bar: Clone = Vec<T>; | ^^^^^ required by this bound in `Foo::Bar` @@ -53,30 +53,30 @@ LL | trait Foo<T: std::clone::Clone> { | +++++++++++++++++++ error[E0277]: the trait bound `(): Foo<Self>` is not satisfied - --> $DIR/defaults-suitability.rs:34:29 + --> $DIR/defaults-suitability.rs:37:29 | LL | type Assoc: Foo<Self> = (); | ^^ the trait `Foo<Self>` is not implemented for `()` | help: this trait has no implementations, consider adding one - --> $DIR/defaults-suitability.rs:27:1 + --> $DIR/defaults-suitability.rs:30:1 | LL | trait Foo<T> { | ^^^^^^^^^^^^ note: required by a bound in `Bar::Assoc` - --> $DIR/defaults-suitability.rs:34:17 + --> $DIR/defaults-suitability.rs:37:17 | LL | type Assoc: Foo<Self> = (); | ^^^^^^^^^ required by this bound in `Bar::Assoc` error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied - --> $DIR/defaults-suitability.rs:56:18 + --> $DIR/defaults-suitability.rs:59:18 | LL | type Assoc = NotClone; | ^^^^^^^^ the trait `IsU8<NotClone>` is not implemented for `NotClone` | note: required by a bound in `D::Assoc` - --> $DIR/defaults-suitability.rs:53:18 + --> $DIR/defaults-suitability.rs:56:18 | LL | Self::Assoc: IsU8<Self::Assoc>, | ^^^^^^^^^^^^^^^^^ required by this bound in `D::Assoc` @@ -85,14 +85,14 @@ LL | type Assoc = NotClone; | ----- required by a bound in this associated type error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied - --> $DIR/defaults-suitability.rs:65:23 + --> $DIR/defaults-suitability.rs:68:23 | LL | type Bar: Clone = Vec<Self::Baz>; | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz`, which is required by `Vec<<Self as Foo2<T>>::Baz>: Clone` | = note: required for `Vec<<Self as Foo2<T>>::Baz>` to implement `Clone` note: required by a bound in `Foo2::Bar` - --> $DIR/defaults-suitability.rs:65:15 + --> $DIR/defaults-suitability.rs:68:15 | LL | type Bar: Clone = Vec<Self::Baz>; | ^^^^^ required by this bound in `Foo2::Bar` @@ -102,14 +102,14 @@ LL | trait Foo2<T> where <Self as Foo2<T>>::Baz: Clone { | +++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: Clone` is not satisfied - --> $DIR/defaults-suitability.rs:74:23 + --> $DIR/defaults-suitability.rs:77:23 | LL | type Bar: Clone = Vec<Self::Baz>; | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz`, which is required by `Vec<<Self as Foo25<T>>::Baz>: Clone` | = note: required for `Vec<<Self as Foo25<T>>::Baz>` to implement `Clone` note: required by a bound in `Foo25::Bar` - --> $DIR/defaults-suitability.rs:74:15 + --> $DIR/defaults-suitability.rs:77:15 | LL | type Bar: Clone = Vec<Self::Baz>; | ^^^^^ required by this bound in `Foo25::Bar` @@ -119,13 +119,13 @@ LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: Clone { | ++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `T: Clone` is not satisfied - --> $DIR/defaults-suitability.rs:87:16 + --> $DIR/defaults-suitability.rs:90:16 | LL | type Baz = T; | ^ the trait `Clone` is not implemented for `T` | note: required by a bound in `Foo3::Baz` - --> $DIR/defaults-suitability.rs:84:16 + --> $DIR/defaults-suitability.rs:87:16 | LL | Self::Baz: Clone, | ^^^^^ required by this bound in `Foo3::Baz` diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr new file mode 100644 index 00000000000..3cdeaa93a34 --- /dev/null +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -0,0 +1,142 @@ +error[E0277]: the trait bound `NotClone: Clone` is not satisfied + --> $DIR/defaults-suitability.rs:16:22 + | +LL | type Ty: Clone = NotClone; + | ^^^^^^^^ the trait `Clone` is not implemented for `NotClone` + | +note: required by a bound in `Tr::Ty` + --> $DIR/defaults-suitability.rs:16:14 + | +LL | type Ty: Clone = NotClone; + | ^^^^^ required by this bound in `Tr::Ty` +help: consider annotating `NotClone` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct NotClone; + | + +error[E0277]: the trait bound `NotClone: Clone` is not satisfied + --> $DIR/defaults-suitability.rs:25:15 + | +LL | type Ty = NotClone; + | ^^^^^^^^ the trait `Clone` is not implemented for `NotClone` + | +note: required by a bound in `Tr2::Ty` + --> $DIR/defaults-suitability.rs:23:15 + | +LL | Self::Ty: Clone, + | ^^^^^ required by this bound in `Tr2::Ty` +LL | { +LL | type Ty = NotClone; + | -- required by a bound in this associated type +help: consider annotating `NotClone` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct NotClone; + | + +error[E0277]: the trait bound `T: Clone` is not satisfied + --> $DIR/defaults-suitability.rs:31:23 + | +LL | type Bar: Clone = Vec<T>; + | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `Vec<T>: Clone` + | + = note: required for `Vec<T>` to implement `Clone` +note: required by a bound in `Foo::Bar` + --> $DIR/defaults-suitability.rs:31:15 + | +LL | type Bar: Clone = Vec<T>; + | ^^^^^ required by this bound in `Foo::Bar` +help: consider restricting type parameter `T` + | +LL | trait Foo<T: std::clone::Clone> { + | +++++++++++++++++++ + +error[E0277]: the trait bound `(): Foo<Self>` is not satisfied + --> $DIR/defaults-suitability.rs:37:29 + | +LL | type Assoc: Foo<Self> = (); + | ^^ the trait `Foo<Self>` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/defaults-suitability.rs:30:1 + | +LL | trait Foo<T> { + | ^^^^^^^^^^^^ +note: required by a bound in `Bar::Assoc` + --> $DIR/defaults-suitability.rs:37:17 + | +LL | type Assoc: Foo<Self> = (); + | ^^^^^^^^^ required by this bound in `Bar::Assoc` + +error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied + --> $DIR/defaults-suitability.rs:59:18 + | +LL | type Assoc = NotClone; + | ^^^^^^^^ the trait `IsU8<NotClone>` is not implemented for `NotClone` + | +note: required by a bound in `D::Assoc` + --> $DIR/defaults-suitability.rs:56:18 + | +LL | Self::Assoc: IsU8<Self::Assoc>, + | ^^^^^^^^^^^^^^^^^ required by this bound in `D::Assoc` +... +LL | type Assoc = NotClone; + | ----- required by a bound in this associated type + +error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied + --> $DIR/defaults-suitability.rs:68:23 + | +LL | type Bar: Clone = Vec<Self::Baz>; + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz`, which is required by `Vec<<Self as Foo2<T>>::Baz>: Clone` + | + = note: required for `Vec<<Self as Foo2<T>>::Baz>` to implement `Clone` +note: required by a bound in `Foo2::Bar` + --> $DIR/defaults-suitability.rs:68:15 + | +LL | type Bar: Clone = Vec<Self::Baz>; + | ^^^^^ required by this bound in `Foo2::Bar` +help: consider further restricting the associated type + | +LL | trait Foo2<T> where <Self as Foo2<T>>::Baz: Clone { + | +++++++++++++++++++++++++++++++++++ + +error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: Clone` is not satisfied + --> $DIR/defaults-suitability.rs:77:23 + | +LL | type Bar: Clone = Vec<Self::Baz>; + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz`, which is required by `Vec<<Self as Foo25<T>>::Baz>: Clone` + | + = note: required for `Vec<<Self as Foo25<T>>::Baz>` to implement `Clone` +note: required by a bound in `Foo25::Bar` + --> $DIR/defaults-suitability.rs:77:15 + | +LL | type Bar: Clone = Vec<Self::Baz>; + | ^^^^^ required by this bound in `Foo25::Bar` +help: consider further restricting the associated type + | +LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: Clone { + | ++++++++++++++++++++++++++++++++++++ + +error[E0277]: the trait bound `T: Clone` is not satisfied + --> $DIR/defaults-suitability.rs:90:16 + | +LL | type Baz = T; + | ^ the trait `Clone` is not implemented for `T` + | +note: required by a bound in `Foo3::Baz` + --> $DIR/defaults-suitability.rs:87:16 + | +LL | Self::Baz: Clone, + | ^^^^^ required by this bound in `Foo3::Baz` +... +LL | type Baz = T; + | --- required by a bound in this associated type +help: consider further restricting type parameter `T` + | +LL | Self::Baz: Clone, T: std::clone::Clone + | ~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/defaults-suitability.rs b/tests/ui/associated-types/defaults-suitability.rs index 504c957d987..bab2f004ac7 100644 --- a/tests/ui/associated-types/defaults-suitability.rs +++ b/tests/ui/associated-types/defaults-suitability.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //! Checks that associated type defaults are properly validated. //! //! This means: diff --git a/tests/ui/associated-types/defaults-unsound-62211-1.current.stderr b/tests/ui/associated-types/defaults-unsound-62211-1.current.stderr index 9d52e923ade..8b6f0a47aed 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-1.current.stderr +++ b/tests/ui/associated-types/defaults-unsound-62211-1.current.stderr @@ -1,12 +1,12 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-1.rs:26:96 + --> $DIR/defaults-unsound-62211-1.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ `Self` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:26:86 + --> $DIR/defaults-unsound-62211-1.rs:24:86 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -16,13 +16,13 @@ LL | trait UncheckedCopy: Sized + std::fmt::Display { | +++++++++++++++++++ error[E0277]: cannot add-assign `&'static str` to `Self` - --> $DIR/defaults-unsound-62211-1.rs:26:96 + --> $DIR/defaults-unsound-62211-1.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ no implementation for `Self += &'static str` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:26:47 + --> $DIR/defaults-unsound-62211-1.rs:24:47 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -32,13 +32,13 @@ LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { | +++++++++++++++++++++++++ error[E0277]: the trait bound `Self: Deref` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:26:96 + --> $DIR/defaults-unsound-62211-1.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ the trait `Deref` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:26:25 + --> $DIR/defaults-unsound-62211-1.rs:24:25 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -48,13 +48,13 @@ LL | trait UncheckedCopy: Sized + Deref { | +++++++ error[E0277]: the trait bound `Self: Copy` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:26:96 + --> $DIR/defaults-unsound-62211-1.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ the trait `Copy` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:26:18 + --> $DIR/defaults-unsound-62211-1.rs:24:18 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ required by this bound in `UncheckedCopy::Output` diff --git a/tests/ui/associated-types/defaults-unsound-62211-1.next.stderr b/tests/ui/associated-types/defaults-unsound-62211-1.next.stderr index ffb02eccc77..0fc1bb0b00f 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-1.next.stderr +++ b/tests/ui/associated-types/defaults-unsound-62211-1.next.stderr @@ -1,17 +1,81 @@ -warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/defaults-unsound-62211-1.rs:52:5 +error[E0277]: `Self` doesn't implement `std::fmt::Display` + --> $DIR/defaults-unsound-62211-1.rs:24:96 | -LL | drop(origin); - | ^^^^^------^ - | | - | argument has type `<T as UncheckedCopy>::Output` +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ `Self` cannot be formatted with the default formatter | - = note: `#[warn(dropping_copy_types)]` on by default -help: use `let _ = ...` to ignore the expression or result + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:24:86 | -LL - drop(origin); -LL + let _ = origin; +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` | +LL | trait UncheckedCopy: Sized + std::fmt::Display { + | +++++++++++++++++++ -warning: 1 warning emitted +error[E0277]: cannot add-assign `&'static str` to `Self` + --> $DIR/defaults-unsound-62211-1.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ no implementation for `Self += &'static str` + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:24:47 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` + | +LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { + | +++++++++++++++++++++++++ + +error[E0271]: type mismatch resolving `<Self as Deref>::Target == str` + --> $DIR/defaults-unsound-62211-1.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ types differ + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:24:31 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` + +error[E0277]: the trait bound `Self: Deref` is not satisfied + --> $DIR/defaults-unsound-62211-1.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ the trait `Deref` is not implemented for `Self` + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:24:25 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` + | +LL | trait UncheckedCopy: Sized + Deref { + | +++++++ + +error[E0277]: the trait bound `Self: Copy` is not satisfied + --> $DIR/defaults-unsound-62211-1.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ the trait `Copy` is not implemented for `Self` + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-1.rs:24:18 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` + | +LL | trait UncheckedCopy: Sized + Copy { + | ++++++ + +error: aborting due to 5 previous errors +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-types/defaults-unsound-62211-1.rs b/tests/ui/associated-types/defaults-unsound-62211-1.rs index d9cf5aa97ac..f054611ed78 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-1.rs +++ b/tests/ui/associated-types/defaults-unsound-62211-1.rs @@ -1,8 +1,6 @@ //@ revisions: current next //@[next] compile-flags: -Znext-solver //@ ignore-compare-mode-next-solver (explicit revisions) -//@[next] known-bug: rust-lang/trait-system-refactor-initiative#46 -//@[next] check-pass //! Regression test for https://github.com/rust-lang/rust/issues/62211 //! @@ -24,10 +22,11 @@ trait UncheckedCopy: Sized { // This Output is said to be Copy. Yet we default to Self // and it's accepted, not knowing if Self ineed is Copy type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - //[current]~^ ERROR the trait bound `Self: Copy` is not satisfied - //[current]~| ERROR the trait bound `Self: Deref` is not satisfied - //[current]~| ERROR cannot add-assign `&'static str` to `Self` - //[current]~| ERROR `Self` doesn't implement `std::fmt::Display` + //~^ ERROR the trait bound `Self: Copy` is not satisfied + //~| ERROR the trait bound `Self: Deref` is not satisfied + //~| ERROR cannot add-assign `&'static str` to `Self` + //~| ERROR `Self` doesn't implement `std::fmt::Display` + //[next]~| ERROR type mismatch resolving `<Self as Deref>::Target == str` // We said the Output type was Copy, so we can Copy it freely! fn unchecked_copy(other: &Self::Output) -> Self::Output { diff --git a/tests/ui/associated-types/defaults-unsound-62211-2.current.stderr b/tests/ui/associated-types/defaults-unsound-62211-2.current.stderr index 4fd2ca6408a..7552b089133 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-2.current.stderr +++ b/tests/ui/associated-types/defaults-unsound-62211-2.current.stderr @@ -1,12 +1,12 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-2.rs:26:96 + --> $DIR/defaults-unsound-62211-2.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ `Self` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:26:86 + --> $DIR/defaults-unsound-62211-2.rs:24:86 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -16,13 +16,13 @@ LL | trait UncheckedCopy: Sized + std::fmt::Display { | +++++++++++++++++++ error[E0277]: cannot add-assign `&'static str` to `Self` - --> $DIR/defaults-unsound-62211-2.rs:26:96 + --> $DIR/defaults-unsound-62211-2.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ no implementation for `Self += &'static str` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:26:47 + --> $DIR/defaults-unsound-62211-2.rs:24:47 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -32,13 +32,13 @@ LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { | +++++++++++++++++++++++++ error[E0277]: the trait bound `Self: Deref` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:26:96 + --> $DIR/defaults-unsound-62211-2.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ the trait `Deref` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:26:25 + --> $DIR/defaults-unsound-62211-2.rs:24:25 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -48,13 +48,13 @@ LL | trait UncheckedCopy: Sized + Deref { | +++++++ error[E0277]: the trait bound `Self: Copy` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:26:96 + --> $DIR/defaults-unsound-62211-2.rs:24:96 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ the trait `Copy` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:26:18 + --> $DIR/defaults-unsound-62211-2.rs:24:18 | LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; | ^^^^ required by this bound in `UncheckedCopy::Output` diff --git a/tests/ui/associated-types/defaults-unsound-62211-2.next.stderr b/tests/ui/associated-types/defaults-unsound-62211-2.next.stderr index e6ae8183e77..751352d7c16 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-2.next.stderr +++ b/tests/ui/associated-types/defaults-unsound-62211-2.next.stderr @@ -1,17 +1,81 @@ -warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing - --> $DIR/defaults-unsound-62211-2.rs:52:5 +error[E0277]: `Self` doesn't implement `std::fmt::Display` + --> $DIR/defaults-unsound-62211-2.rs:24:96 | -LL | drop(origin); - | ^^^^^------^ - | | - | argument has type `<T as UncheckedCopy>::Output` +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ `Self` cannot be formatted with the default formatter | - = note: `#[warn(dropping_copy_types)]` on by default -help: use `let _ = ...` to ignore the expression or result + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:24:86 | -LL - drop(origin); -LL + let _ = origin; +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` | +LL | trait UncheckedCopy: Sized + std::fmt::Display { + | +++++++++++++++++++ -warning: 1 warning emitted +error[E0277]: cannot add-assign `&'static str` to `Self` + --> $DIR/defaults-unsound-62211-2.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ no implementation for `Self += &'static str` + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:24:47 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` + | +LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { + | +++++++++++++++++++++++++ + +error[E0271]: type mismatch resolving `<Self as Deref>::Target == str` + --> $DIR/defaults-unsound-62211-2.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ types differ + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:24:31 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` + +error[E0277]: the trait bound `Self: Deref` is not satisfied + --> $DIR/defaults-unsound-62211-2.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ the trait `Deref` is not implemented for `Self` + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:24:25 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` + | +LL | trait UncheckedCopy: Sized + Deref { + | +++++++ + +error[E0277]: the trait bound `Self: Copy` is not satisfied + --> $DIR/defaults-unsound-62211-2.rs:24:96 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ the trait `Copy` is not implemented for `Self` + | +note: required by a bound in `UncheckedCopy::Output` + --> $DIR/defaults-unsound-62211-2.rs:24:18 + | +LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; + | ^^^^ required by this bound in `UncheckedCopy::Output` +help: consider further restricting `Self` + | +LL | trait UncheckedCopy: Sized + Copy { + | ++++++ + +error: aborting due to 5 previous errors +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-types/defaults-unsound-62211-2.rs b/tests/ui/associated-types/defaults-unsound-62211-2.rs index 6cbac1bf236..956f14df0d5 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-2.rs +++ b/tests/ui/associated-types/defaults-unsound-62211-2.rs @@ -1,8 +1,6 @@ //@ revisions: current next //@[next] compile-flags: -Znext-solver //@ ignore-compare-mode-next-solver (explicit revisions) -//@[next] known-bug: rust-lang/trait-system-refactor-initiative#46 -//@[next] check-pass //! Regression test for https://github.com/rust-lang/rust/issues/62211 //! @@ -24,10 +22,11 @@ trait UncheckedCopy: Sized { // This Output is said to be Copy. Yet we default to Self // and it's accepted, not knowing if Self ineed is Copy type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self; - //[current]~^ ERROR the trait bound `Self: Copy` is not satisfied - //[current]~| ERROR the trait bound `Self: Deref` is not satisfied - //[current]~| ERROR cannot add-assign `&'static str` to `Self` - //[current]~| ERROR `Self` doesn't implement `std::fmt::Display` + //~^ ERROR the trait bound `Self: Copy` is not satisfied + //~| ERROR the trait bound `Self: Deref` is not satisfied + //~| ERROR cannot add-assign `&'static str` to `Self` + //~| ERROR `Self` doesn't implement `std::fmt::Display` + //[next]~| ERROR type mismatch resolving `<Self as Deref>::Target == str` // We said the Output type was Copy, so we can Copy it freely! fn unchecked_copy(other: &Self::Output) -> Self::Output { diff --git a/tests/ui/associated-types/issue-54108.stderr b/tests/ui/associated-types/issue-54108.current.stderr index f300208fcc8..8850b4548e3 100644 --- a/tests/ui/associated-types/issue-54108.stderr +++ b/tests/ui/associated-types/issue-54108.current.stderr @@ -1,12 +1,12 @@ error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize` - --> $DIR/issue-54108.rs:19:17 + --> $DIR/issue-54108.rs:23:17 | LL | type Size = <Self as SubEncoder>::ActualSize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `<T as SubEncoder>::ActualSize + <T as SubEncoder>::ActualSize` | = help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize` note: required by a bound in `Encoder::Size` - --> $DIR/issue-54108.rs:4:16 + --> $DIR/issue-54108.rs:8:16 | LL | type Size: Add<Output = Self::Size>; | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr new file mode 100644 index 00000000000..9f6f00e7ca8 --- /dev/null +++ b/tests/ui/associated-types/issue-54108.next.stderr @@ -0,0 +1,33 @@ +error[E0271]: type mismatch resolving `<<T as SubEncoder>::ActualSize as Add>::Output == <T as SubEncoder>::ActualSize` + --> $DIR/issue-54108.rs:23:17 + | +LL | type Size = <Self as SubEncoder>::ActualSize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + | +note: required by a bound in `Encoder::Size` + --> $DIR/issue-54108.rs:8:20 + | +LL | type Size: Add<Output = Self::Size>; + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` + +error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize` + --> $DIR/issue-54108.rs:23:17 + | +LL | type Size = <Self as SubEncoder>::ActualSize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `<T as SubEncoder>::ActualSize + <T as SubEncoder>::ActualSize` + | + = help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize` +note: required by a bound in `Encoder::Size` + --> $DIR/issue-54108.rs:8:16 + | +LL | type Size: Add<Output = Self::Size>; + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` +help: consider further restricting the associated type + | +LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-types/issue-54108.rs b/tests/ui/associated-types/issue-54108.rs index 87f67ce4b52..7c652fd7f49 100644 --- a/tests/ui/associated-types/issue-54108.rs +++ b/tests/ui/associated-types/issue-54108.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + use std::ops::Add; pub trait Encoder { @@ -18,6 +22,7 @@ where { type Size = <Self as SubEncoder>::ActualSize; //~^ ERROR: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize` + //[next]~| ERROR type mismatch resolving `<<T as SubEncoder>::ActualSize as Add>::Output == <T as SubEncoder>::ActualSize` fn foo(&self) -> Self::Size { self.bar() + self.bar() diff --git a/tests/ui/associated-types/issue-63593.stderr b/tests/ui/associated-types/issue-63593.current.stderr index 67151431a67..76fdefeb4e5 100644 --- a/tests/ui/associated-types/issue-63593.stderr +++ b/tests/ui/associated-types/issue-63593.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/issue-63593.rs:9:17 + --> $DIR/issue-63593.rs:13:17 | LL | type This = Self; | ^^^^ doesn't have a size known at compile-time | note: required by a bound in `MyTrait::This` - --> $DIR/issue-63593.rs:9:5 + --> $DIR/issue-63593.rs:13:5 | LL | type This = Self; | ^^^^^^^^^^^^^^^^^ required by this bound in `MyTrait::This` diff --git a/tests/ui/associated-types/issue-63593.next.stderr b/tests/ui/associated-types/issue-63593.next.stderr new file mode 100644 index 00000000000..76fdefeb4e5 --- /dev/null +++ b/tests/ui/associated-types/issue-63593.next.stderr @@ -0,0 +1,19 @@ +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-63593.rs:13:17 + | +LL | type This = Self; + | ^^^^ doesn't have a size known at compile-time + | +note: required by a bound in `MyTrait::This` + --> $DIR/issue-63593.rs:13:5 + | +LL | type This = Self; + | ^^^^^^^^^^^^^^^^^ required by this bound in `MyTrait::This` +help: consider further restricting `Self` + | +LL | trait MyTrait: Sized { + | +++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-63593.rs b/tests/ui/associated-types/issue-63593.rs index 8dbc24c0673..dea81f729b4 100644 --- a/tests/ui/associated-types/issue-63593.rs +++ b/tests/ui/associated-types/issue-63593.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + #![feature(associated_type_defaults)] // Tests that `Self` is not assumed to implement `Sized` when used as an diff --git a/tests/ui/async-await/async-drop.rs b/tests/ui/async-await/async-drop.rs index 6d02dcebc0b..12f120a0b12 100644 --- a/tests/ui/async-await/async-drop.rs +++ b/tests/ui/async-await/async-drop.rs @@ -1,6 +1,10 @@ //@ run-pass //@ check-run-results +// WARNING: If you would ever want to modify this test, +// please consider modifying miri's async drop test at +// `src/tools/miri/tests/pass/async-drop.rs`. + #![feature(async_drop, impl_trait_in_assoc_type, noop_waker, async_closure)] #![allow(incomplete_features, dead_code)] @@ -13,9 +17,21 @@ use core::mem::{self, ManuallyDrop}; use core::pin::{pin, Pin}; use core::task::{Context, Poll, Waker}; -async fn test_async_drop<T>(x: T) { +async fn test_async_drop<T>(x: T, _size: usize) { let mut x = mem::MaybeUninit::new(x); let dtor = pin!(unsafe { async_drop_in_place(x.as_mut_ptr()) }); + + // FIXME(zetanumbers): This check fully depends on the layout of + // the coroutine state, since async destructor combinators are just + // async functions. + #[cfg(target_pointer_width = "64")] + assert_eq!( + mem::size_of_val(&*dtor), + _size, + "sizes did not match for async destructor of type {}", + core::any::type_name::<T>(), + ); + test_idempotency(dtor).await; } @@ -36,51 +52,58 @@ fn main() { let i = 13; let fut = pin!(async { - test_async_drop(Int(0)).await; - test_async_drop(AsyncInt(0)).await; - test_async_drop([AsyncInt(1), AsyncInt(2)]).await; - test_async_drop((AsyncInt(3), AsyncInt(4))).await; - test_async_drop(5).await; + test_async_drop(Int(0), 0).await; + test_async_drop(AsyncInt(0), 104).await; + test_async_drop([AsyncInt(1), AsyncInt(2)], 152).await; + test_async_drop((AsyncInt(3), AsyncInt(4)), 488).await; + test_async_drop(5, 0).await; let j = 42; - test_async_drop(&i).await; - test_async_drop(&j).await; - test_async_drop(AsyncStruct { b: AsyncInt(8), a: AsyncInt(7), i: 6 }).await; - test_async_drop(ManuallyDrop::new(AsyncInt(9))).await; + test_async_drop(&i, 0).await; + test_async_drop(&j, 0).await; + test_async_drop(AsyncStruct { b: AsyncInt(8), a: AsyncInt(7), i: 6 }, 1688).await; + test_async_drop(ManuallyDrop::new(AsyncInt(9)), 0).await; let foo = AsyncInt(10); - test_async_drop(AsyncReference { foo: &foo }).await; + test_async_drop(AsyncReference { foo: &foo }, 104).await; let foo = AsyncInt(11); - test_async_drop(|| { - black_box(foo); - let foo = AsyncInt(10); - foo - }).await; - - test_async_drop(AsyncEnum::A(AsyncInt(12))).await; - test_async_drop(AsyncEnum::B(SyncInt(13))).await; - - test_async_drop(SyncInt(14)).await; - test_async_drop(SyncThenAsync { - i: 15, - a: AsyncInt(16), - b: SyncInt(17), - c: AsyncInt(18), - }).await; + test_async_drop( + || { + black_box(foo); + let foo = AsyncInt(10); + foo + }, + 120, + ) + .await; + + test_async_drop(AsyncEnum::A(AsyncInt(12)), 680).await; + test_async_drop(AsyncEnum::B(SyncInt(13)), 680).await; + + test_async_drop(SyncInt(14), 16).await; + test_async_drop( + SyncThenAsync { i: 15, a: AsyncInt(16), b: SyncInt(17), c: AsyncInt(18) }, + 3064, + ) + .await; let async_drop_fut = pin!(core::future::async_drop(AsyncInt(19))); test_idempotency(async_drop_fut).await; let foo = AsyncInt(20); - test_async_drop(async || { - black_box(foo); - let foo = AsyncInt(19); - // Await point there, but this is async closure so it's fine - black_box(core::future::ready(())).await; - foo - }).await; - - test_async_drop(AsyncUnion { signed: 21 }).await; + test_async_drop( + async || { + black_box(foo); + let foo = AsyncInt(19); + // Await point there, but this is async closure so it's fine + black_box(core::future::ready(())).await; + foo + }, + 120, + ) + .await; + + test_async_drop(AsyncUnion { signed: 21 }, 32).await; }); let res = fut.poll(&mut cx); assert_eq!(res, Poll::Ready(())); diff --git a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs index 68a750778ad..637678692bd 100644 --- a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs +++ b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs @@ -8,7 +8,7 @@ trait Super1<'a> { } impl Super1<'_, bar(): Send> for () {} -//~^ ERROR associated type bindings are not allowed here +//~^ ERROR associated item constraints are not allowed here //~| ERROR not all trait items implemented fn main() {} diff --git a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr index d925c7316b6..b07c5735dff 100644 --- a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr +++ b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr @@ -7,11 +7,11 @@ LL | #![feature(return_type_notation)] = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information = note: `#[warn(incomplete_features)]` on by default -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/rtn-in-impl-signature.rs:10:17 | LL | impl Super1<'_, bar(): Send> for () {} - | ^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^ associated item constraint not allowed here error[E0046]: not all trait items implemented, missing: `bar` --> $DIR/rtn-in-impl-signature.rs:10:1 diff --git a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs index 89d0b74d403..fa0b0fdc136 100644 --- a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs +++ b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs @@ -8,5 +8,6 @@ impl<const N: u8> Trait for [(); N] {} //~^ ERROR: mismatched types impl<const N: i8> Trait for [(); N] {} //~^ ERROR: mismatched types +//~| ERROR: conflicting implementations of trait `Trait` fn main() {} diff --git a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr index d1950254660..d65450845bc 100644 --- a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr +++ b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr @@ -1,3 +1,12 @@ +error[E0119]: conflicting implementations of trait `Trait` for type `[(); _]` + --> $DIR/generic_const_type_mismatch.rs:9:1 + | +LL | impl<const N: u8> Trait for [(); N] {} + | ----------------------------------- first implementation here +LL | +LL | impl<const N: i8> Trait for [(); N] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[(); _]` + error[E0308]: mismatched types --> $DIR/generic_const_type_mismatch.rs:7:34 | @@ -10,6 +19,7 @@ error[E0308]: mismatched types LL | impl<const N: i8> Trait for [(); N] {} | ^ expected `usize`, found `i8` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0119, E0308. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/occurs-check/associated-type.next.stderr b/tests/ui/coherence/occurs-check/associated-type.next.stderr index 7443459b830..d809a6948f3 100644 --- a/tests/ui/coherence/occurs-check/associated-type.next.stderr +++ b/tests/ui/coherence/occurs-check/associated-type.next.stderr @@ -1,7 +1,7 @@ -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())` --> $DIR/associated-type.rs:31:1 | diff --git a/tests/ui/coherence/occurs-check/associated-type.old.stderr b/tests/ui/coherence/occurs-check/associated-type.old.stderr index 38a02c906d4..329086ab7df 100644 --- a/tests/ui/coherence/occurs-check/associated-type.old.stderr +++ b/tests/ui/coherence/occurs-check/associated-type.old.stderr @@ -1,11 +1,11 @@ -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>` for type `for<'a> fn(&'a (), _)` --> $DIR/associated-type.rs:31:1 | diff --git a/tests/crashes/114456.rs b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs index e347327e738..8035fce0914 100644 --- a/tests/crashes/114456.rs +++ b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs @@ -1,5 +1,7 @@ -//@ known-bug: #114456 +//@ check-pass #![feature(adt_const_params, lazy_type_alias)] +//~^ WARN: the feature `adt_const_params` is incomplete +//~| WARN: the feature `lazy_type_alias` is incomplete pub type Matrix = [usize; 1]; const EMPTY_MATRIX: Matrix = [0; 1]; diff --git a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.stderr b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.stderr new file mode 100644 index 00000000000..5c6981077b2 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.stderr @@ -0,0 +1,19 @@ +warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/alias_const_param_ty-1.rs:2:12 + | +LL | #![feature(adt_const_params, lazy_type_alias)] + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/alias_const_param_ty-1.rs:2:30 + | +LL | #![feature(adt_const_params, lazy_type_alias)] + | ^^^^^^^^^^^^^^^ + | + = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information + +warning: 2 warnings emitted + diff --git a/tests/crashes/114456-2.rs b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-2.rs index eca27febb96..a576b75341c 100644 --- a/tests/crashes/114456-2.rs +++ b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-2.rs @@ -1,5 +1,6 @@ -//@ known-bug: #114456 +//@ check-pass #![feature(adt_const_params)] +//~^ WARN: the feature `adt_const_params` is incomplete const EMPTY_MATRIX: <Type as Trait>::Matrix = [0; 1]; @@ -12,8 +13,12 @@ impl Walk<EMPTY_MATRIX> { } pub enum Type {} -pub trait Trait { type Matrix; } -impl Trait for Type { type Matrix = [usize; 1]; } +pub trait Trait { + type Matrix; +} +impl Trait for Type { + type Matrix = [usize; 1]; +} fn main() { let _ = Walk::new(); diff --git a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-2.stderr b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-2.stderr new file mode 100644 index 00000000000..dbc8ab71636 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-2.stderr @@ -0,0 +1,11 @@ +warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/alias_const_param_ty-2.rs:2:12 + | +LL | #![feature(adt_const_params)] + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/const-generics/bad-subst-const-kind.rs b/tests/ui/const-generics/bad-subst-const-kind.rs index 88f98a54b6e..d5913879191 100644 --- a/tests/ui/const-generics/bad-subst-const-kind.rs +++ b/tests/ui/const-generics/bad-subst-const-kind.rs @@ -10,5 +10,7 @@ impl<const N: u64> Q for [u8; N] { const ASSOC: usize = 1; } -pub fn test() -> [u8; <[u8; 13] as Q>::ASSOC] { todo!() } -//~^ ERROR: `[u8; 13]: Q` is not satisfied +pub fn test() -> [u8; <[u8; 13] as Q>::ASSOC] { + //~^ ERROR: the constant `13` is not of type `u64` + todo!() +} diff --git a/tests/ui/const-generics/bad-subst-const-kind.stderr b/tests/ui/const-generics/bad-subst-const-kind.stderr index 6cf9fa743b3..6725f6762e4 100644 --- a/tests/ui/const-generics/bad-subst-const-kind.stderr +++ b/tests/ui/const-generics/bad-subst-const-kind.stderr @@ -1,10 +1,16 @@ -error[E0277]: the trait bound `[u8; 13]: Q` is not satisfied +error: the constant `13` is not of type `u64` --> $DIR/bad-subst-const-kind.rs:13:24 | -LL | pub fn test() -> [u8; <[u8; 13] as Q>::ASSOC] { todo!() } - | ^^^^^^^^ the trait `Q` is not implemented for `[u8; 13]` +LL | pub fn test() -> [u8; <[u8; 13] as Q>::ASSOC] { + | ^^^^^^^^ expected `u64`, found `usize` | - = help: the trait `Q` is implemented for `[u8; N]` +note: required for `[u8; 13]` to implement `Q` + --> $DIR/bad-subst-const-kind.rs:8:20 + | +LL | impl<const N: u64> Q for [u8; N] { + | ------------ ^ ^^^^^^^ + | | + | unsatisfied trait bound introduced here error[E0308]: mismatched types --> $DIR/bad-subst-const-kind.rs:8:31 @@ -14,5 +20,4 @@ LL | impl<const N: u64> Q for [u8; N] { error: aborting due to 2 previous errors -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/defaults/doesnt_infer.rs b/tests/ui/const-generics/defaults/doesnt_infer.rs index e14c08fc148..016685eee9d 100644 --- a/tests/ui/const-generics/defaults/doesnt_infer.rs +++ b/tests/ui/const-generics/defaults/doesnt_infer.rs @@ -3,7 +3,9 @@ struct Foo<const N: u32 = 2>; impl<const N: u32> Foo<N> { - fn foo() -> Self { loop {} } + fn foo() -> Self { + loop {} + } } fn main() { diff --git a/tests/ui/const-generics/defaults/doesnt_infer.stderr b/tests/ui/const-generics/defaults/doesnt_infer.stderr index 93d58603397..1e779f75ce0 100644 --- a/tests/ui/const-generics/defaults/doesnt_infer.stderr +++ b/tests/ui/const-generics/defaults/doesnt_infer.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed for `Foo<_>` - --> $DIR/doesnt_infer.rs:11:9 + --> $DIR/doesnt_infer.rs:13:9 | LL | let foo = Foo::foo(); | ^^^ diff --git a/tests/ui/const-generics/generic_arg_infer/issue-91614.rs b/tests/ui/const-generics/generic_arg_infer/issue-91614.rs index b45e2cbc737..cfbc5faecd9 100644 --- a/tests/ui/const-generics/generic_arg_infer/issue-91614.rs +++ b/tests/ui/const-generics/generic_arg_infer/issue-91614.rs @@ -4,5 +4,5 @@ use std::simd::Mask; fn main() { let y = Mask::<_, _>::splat(false); - //~^ ERROR: type annotations needed for + //~^ ERROR: type annotations needed } diff --git a/tests/ui/const-generics/generic_const_exprs/ice-125520-layout-mismatch-mulwithoverflow.rs b/tests/ui/const-generics/generic_const_exprs/ice-125520-layout-mismatch-mulwithoverflow.rs deleted file mode 100644 index cd2dc3f4fe8..00000000000 --- a/tests/ui/const-generics/generic_const_exprs/ice-125520-layout-mismatch-mulwithoverflow.rs +++ /dev/null @@ -1,27 +0,0 @@ -// issue: rust-lang/rust#125520 -#![feature(generic_const_exprs)] -//~^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - -struct Outer<const A: i64, const B: i64>(); -impl<const A: usize, const B: usize> Outer<A, B> -//~^ ERROR the constant `A` is not of type `i64` -//~| ERROR the constant `B` is not of type `i64` -//~| ERROR mismatched types -//~| ERROR mismatched types -where - [(); A + (B * 2)]:, -{ - fn i() -> Self { - //~^ ERROR the constant `A` is not of type `i64` - //~| ERROR the constant `B` is not of type `i64` - Self - //~^ ERROR mismatched types - //~| ERROR the constant `A` is not of type `i64` - //~| ERROR the constant `B` is not of type `i64` - } -} - -fn main() { - Outer::<1, 1>::o(); - //~^ ERROR no function or associated item named `o` found for struct `Outer` in the current scope -} diff --git a/tests/ui/const-generics/generic_const_exprs/ice-125520-layout-mismatch-mulwithoverflow.stderr b/tests/ui/const-generics/generic_const_exprs/ice-125520-layout-mismatch-mulwithoverflow.stderr deleted file mode 100644 index 2dbd69fd3bc..00000000000 --- a/tests/ui/const-generics/generic_const_exprs/ice-125520-layout-mismatch-mulwithoverflow.stderr +++ /dev/null @@ -1,125 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:2:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: the constant `A` is not of type `i64` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:6:38 - | -LL | impl<const A: usize, const B: usize> Outer<A, B> - | ^^^^^^^^^^^ expected `i64`, found `usize` - | -note: required by a bound in `Outer` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:5:14 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ^^^^^^^^^^^^ required by this bound in `Outer` - -error: the constant `B` is not of type `i64` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:6:38 - | -LL | impl<const A: usize, const B: usize> Outer<A, B> - | ^^^^^^^^^^^ expected `i64`, found `usize` - | -note: required by a bound in `Outer` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:5:28 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ^^^^^^^^^^^^ required by this bound in `Outer` - -error: the constant `A` is not of type `i64` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:14:15 - | -LL | fn i() -> Self { - | ^^^^ expected `i64`, found `usize` - | -note: required by a bound in `Outer` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:5:14 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ^^^^^^^^^^^^ required by this bound in `Outer` - -error: the constant `B` is not of type `i64` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:14:15 - | -LL | fn i() -> Self { - | ^^^^ expected `i64`, found `usize` - | -note: required by a bound in `Outer` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:5:28 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ^^^^^^^^^^^^ required by this bound in `Outer` - -error[E0308]: mismatched types - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:17:9 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ---------------------------------------- `Outer` defines a struct constructor here, which should be called -... -LL | fn i() -> Self { - | ---- expected `Outer<A, B>` because of return type -... -LL | Self - | ^^^^ expected `Outer<A, B>`, found struct constructor - | - = note: expected struct `Outer<A, B>` - found struct constructor `fn() -> Outer<A, B> {Outer::<A, B>}` -help: use parentheses to construct this tuple struct - | -LL | Self() - | ++ - -error: the constant `A` is not of type `i64` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:17:9 - | -LL | Self - | ^^^^ expected `i64`, found `usize` - | -note: required by a bound in `Outer` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:5:14 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ^^^^^^^^^^^^ required by this bound in `Outer` - -error: the constant `B` is not of type `i64` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:17:9 - | -LL | Self - | ^^^^ expected `i64`, found `usize` - | -note: required by a bound in `Outer` - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:5:28 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ^^^^^^^^^^^^ required by this bound in `Outer` - -error[E0599]: no function or associated item named `o` found for struct `Outer` in the current scope - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:25:20 - | -LL | struct Outer<const A: i64, const B: i64>(); - | ---------------------------------------- function or associated item `o` not found for this struct -... -LL | Outer::<1, 1>::o(); - | ^ function or associated item not found in `Outer<1, 1>` - -error[E0308]: mismatched types - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:6:44 - | -LL | impl<const A: usize, const B: usize> Outer<A, B> - | ^ expected `i64`, found `usize` - -error[E0308]: mismatched types - --> $DIR/ice-125520-layout-mismatch-mulwithoverflow.rs:6:47 - | -LL | impl<const A: usize, const B: usize> Outer<A, B> - | ^ expected `i64`, found `usize` - -error: aborting due to 10 previous errors; 1 warning emitted - -Some errors have detailed explanations: E0308, E0599. -For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs index 285f9dee6c2..6b0d9e047db 100644 --- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs +++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs @@ -10,7 +10,7 @@ impl<const N: u64> Q for [u8; N] {} //~| ERROR mismatched types pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {} -//~^ ERROR `[u8; 13]: Q` is not satisfied +//~^ ERROR the constant `13` is not of type `u64` //~| ERROR mismatched types pub fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr index a63a56dd675..bb6d650b7ab 100644 --- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr +++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr @@ -7,13 +7,19 @@ LL | const ASSOC: usize; LL | impl<const N: u64> Q for [u8; N] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation -error[E0277]: the trait bound `[u8; 13]: Q` is not satisfied +error: the constant `13` is not of type `u64` --> $DIR/type_mismatch.rs:12:26 | LL | pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {} - | ^^^^^^^^ the trait `Q` is not implemented for `[u8; 13]` + | ^^^^^^^^ expected `u64`, found `usize` | - = help: the trait `Q` is implemented for `[u8; N]` +note: required for `[u8; 13]` to implement `Q` + --> $DIR/type_mismatch.rs:8:20 + | +LL | impl<const N: u64> Q for [u8; N] {} + | ------------ ^ ^^^^^^^ + | | + | unsatisfied trait bound introduced here error[E0308]: mismatched types --> $DIR/type_mismatch.rs:12:20 @@ -31,5 +37,5 @@ LL | impl<const N: u64> Q for [u8; N] {} error: aborting due to 4 previous errors -Some errors have detailed explanations: E0046, E0277, E0308. +Some errors have detailed explanations: E0046, E0308. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/const-generics/issues/issue-105821.rs b/tests/ui/const-generics/issues/issue-105821.rs index e55da461605..ecbae4d9f35 100644 --- a/tests/ui/const-generics/issues/issue-105821.rs +++ b/tests/ui/const-generics/issues/issue-105821.rs @@ -1,10 +1,7 @@ -//@ failure-status: 101 -//@ known-bug: rust-lang/rust#125451 -//@ normalize-stderr-test "note: .*\n\n" -> "" -//@ normalize-stderr-test "thread 'rustc' panicked.*\n.*\n" -> "" -//@ normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -//@ normalize-stderr-test "delayed at .*" -> "" -//@ rustc-env:RUST_BACKTRACE=0 +//@ check-pass +// If this test starts failing because it ICEs due to not being able to convert a `ReErased` to +// something then feel free to just convert this to a known-bug. I'm pretty sure this is still +// a failing test, we just started masking the bug. #![allow(incomplete_features)] #![feature(adt_const_params, generic_const_exprs)] diff --git a/tests/ui/const-generics/issues/issue-105821.stderr b/tests/ui/const-generics/issues/issue-105821.stderr deleted file mode 100644 index 1f0fc0f33ce..00000000000 --- a/tests/ui/const-generics/issues/issue-105821.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:LL:CC: cannot convert `'{erased}` to a region vid - -query stack during panic: -#0 [mir_borrowck] borrow-checking `<impl at $DIR/issue-105821.rs:21:1: 23:24>::R` -#1 [analysis] running analysis passes on this crate -end of query stack -error: aborting due to 1 previous error - diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs index 79743abe409..fbf1553c182 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs @@ -8,7 +8,7 @@ const T: usize = 42; impl Foo<N = 3> for Bar { //~^ ERROR trait takes 1 generic argument but 0 generic arguments were supplied -//~| ERROR associated type bindings are not allowed here +//~| ERROR associated item constraints are not allowed here //~| ERROR associated const equality is incomplete fn do_x(&self) -> [u8; 3] { [0u8; 3] diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr index 941764a575e..a132859b412 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr @@ -24,11 +24,11 @@ help: add missing generic argument LL | impl Foo<N, N = 3> for Bar { | ++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-89013-no-kw.rs:9:10 | LL | impl Foo<N = 3> for Bar { - | ^^^^^ associated type not allowed here + | ^^^^^ associated item constraint not allowed here | help: to use `3` as a generic argument specify it directly | diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013.rs b/tests/ui/const-generics/parser-error-recovery/issue-89013.rs index 335d0d94e83..c9c7ff3a170 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013.rs +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013.rs @@ -9,7 +9,7 @@ const T: usize = 42; impl Foo<N = const 3> for Bar { //~^ ERROR expected lifetime, type, or constant, found keyword `const` //~| ERROR trait takes 1 generic -//~| ERROR associated type bindings are not allowed here +//~| ERROR associated item constraints are not allowed here //~| ERROR associated const equality is incomplete fn do_x(&self) -> [u8; 3] { [0u8; 3] diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr index a4c9e065c15..2fdd1208565 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr @@ -36,11 +36,11 @@ help: add missing generic argument LL | impl Foo<N, N = const 3> for Bar { | ++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-89013.rs:9:10 | LL | impl Foo<N = const 3> for Bar { - | ^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^ associated item constraint not allowed here | help: to use `3` as a generic argument specify it directly | diff --git a/tests/ui/consts/eval_type_mismatch.stderr b/tests/ui/consts/eval_type_mismatch.stderr deleted file mode 100644 index 38d6e33d406..00000000000 --- a/tests/ui/consts/eval_type_mismatch.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error: the constant `A` is not of type `i64` - --> $DIR/eval_type_mismatch.rs:5:38 - | -LL | impl<const A: usize, const B: usize> Outer<A, B> - | ^^^^^^^^^^^ expected `i64`, found `usize` - | -note: required by a bound in `Outer` - --> $DIR/eval_type_mismatch.rs:4:14 - | -LL | struct Outer<const A: i64, const B: usize>(); - | ^^^^^^^^^^^^ required by this bound in `Outer` - -error[E0599]: no function or associated item named `o` found for struct `Outer<1, 1>` in the current scope - --> $DIR/eval_type_mismatch.rs:15:20 - | -LL | struct Outer<const A: i64, const B: usize>(); - | ------------------------------------------ function or associated item `o` not found for this struct -... -LL | Outer::<1, 1>::o(); - | ^ function or associated item not found in `Outer<1, 1>` - | - = note: the function or associated item was found for - - `Outer<A, B>` - -error[E0308]: mismatched types - --> $DIR/eval_type_mismatch.rs:5:44 - | -LL | impl<const A: usize, const B: usize> Outer<A, B> - | ^ expected `i64`, found `usize` - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0308, E0599. -For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/error-codes/E0229.rs b/tests/ui/error-codes/E0229.rs index 558baae37f7..da2758dfba8 100644 --- a/tests/ui/error-codes/E0229.rs +++ b/tests/ui/error-codes/E0229.rs @@ -10,10 +10,10 @@ impl Foo for isize { fn boo(&self) -> usize { 42 } } -fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} -//~^ ERROR associated type bindings are not allowed here [E0229] -//~| ERROR associated type bindings are not allowed here [E0229] -//~| ERROR associated type bindings are not allowed here [E0229] +fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} +//~^ ERROR associated item constraints are not allowed here [E0229] +//~| ERROR associated item constraints are not allowed here [E0229] +//~| ERROR associated item constraints are not allowed here [E0229] //~| ERROR the trait bound `I: Foo` is not satisfied //~| ERROR the trait bound `I: Foo` is not satisfied diff --git a/tests/ui/error-codes/E0229.stderr b/tests/ui/error-codes/E0229.stderr index ae7dc9ac265..7d9cedc3bdc 100644 --- a/tests/ui/error-codes/E0229.stderr +++ b/tests/ui/error-codes/E0229.stderr @@ -1,58 +1,58 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/E0229.rs:13:25 | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ^^^^^ associated type not allowed here +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ~~~~~~~ +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/E0229.rs:13:25 | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ^^^^^ associated type not allowed here +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ~~~~~~~ +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/E0229.rs:13:25 | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ^^^^^ associated type not allowed here +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ~~~~~~~ +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ~~~~~~~~~ error[E0277]: the trait bound `I: Foo` is not satisfied --> $DIR/E0229.rs:13:15 | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I` +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I` | help: consider restricting type parameter `I` | -LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {} +LL | fn baz<I: Foo>(x: &<I as Foo<A = Bar>>::A) {} | +++++ error[E0277]: the trait bound `I: Foo` is not satisfied - --> $DIR/E0229.rs:13:37 + --> $DIR/E0229.rs:13:39 | -LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} - | ^^ the trait `Foo` is not implemented for `I` +LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} + | ^^ the trait `Foo` is not implemented for `I` | help: consider restricting type parameter `I` | -LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {} +LL | fn baz<I: Foo>(x: &<I as Foo<A = Bar>>::A) {} | +++++ error: aborting due to 5 previous errors diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs index b8ce9c85b72..ff528274c59 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs @@ -16,7 +16,7 @@ impl Fn<()> for Foo { } struct Foo1; impl FnOnce() for Foo1 { - //~^ ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here //~| ERROR manual implementations of `FnOnce` are experimental //~| ERROR not all trait items implemented extern "rust-call" fn call_once(self, args: ()) -> () {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index c3f161469e3..ed9ecc732b5 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -105,11 +105,11 @@ LL | impl FnOnce() for Foo1 { | = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 | LL | impl FnOnce() for Foo1 { - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | help: parenthesized trait syntax expands to `FnOnce<(), Output=()>` --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 diff --git a/tests/ui/fn/issue-39259.rs b/tests/ui/fn/issue-39259.rs index 16983b652fc..d4569a9094b 100644 --- a/tests/ui/fn/issue-39259.rs +++ b/tests/ui/fn/issue-39259.rs @@ -4,7 +4,7 @@ struct S; impl Fn(u32) -> u32 for S { - //~^ ERROR associated type bindings are not allowed here [E0229] + //~^ ERROR associated item constraints are not allowed here [E0229] //~| ERROR expected a `FnMut(u32)` closure, found `S` fn call(&self) -> u32 { //~^ ERROR method `call` has 1 parameter but the declaration in trait `call` has 2 diff --git a/tests/ui/fn/issue-39259.stderr b/tests/ui/fn/issue-39259.stderr index 47150a3c155..095a5c47231 100644 --- a/tests/ui/fn/issue-39259.stderr +++ b/tests/ui/fn/issue-39259.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-39259.rs:6:17 | LL | impl Fn(u32) -> u32 for S { - | ^^^ associated type not allowed here + | ^^^ associated item constraint not allowed here | help: parenthesized trait syntax expands to `Fn<(u32,), Output=u32>` --> $DIR/issue-39259.rs:6:6 diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr index 2097115af00..c5c4f2c4d23 100644 --- a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr +++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr @@ -1,16 +1,16 @@ error[E0277]: the trait bound `<Self as Foo>::Bar<()>: Eq<i32>` is not satisfied - --> $DIR/assume-gat-normalization-for-nested-goals.rs:10:30 + --> $DIR/assume-gat-normalization-for-nested-goals.rs:9:30 | LL | type Bar<T>: Baz<Self> = i32; | ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`, which is required by `i32: Baz<Self>` | note: required for `i32` to implement `Baz<Self>` - --> $DIR/assume-gat-normalization-for-nested-goals.rs:17:23 + --> $DIR/assume-gat-normalization-for-nested-goals.rs:16:23 | LL | impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {} | ^^^^^^ ^^^ ------- unsatisfied trait bound introduced here note: required by a bound in `Foo::Bar` - --> $DIR/assume-gat-normalization-for-nested-goals.rs:10:18 + --> $DIR/assume-gat-normalization-for-nested-goals.rs:9:18 | LL | type Bar<T>: Baz<Self> = i32; | ^^^^^^^^^ required by this bound in `Foo::Bar` diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr new file mode 100644 index 00000000000..2c372b6c3a7 --- /dev/null +++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr @@ -0,0 +1,24 @@ +error[E0277]: the trait bound `i32: Baz<Self>` is not satisfied + --> $DIR/assume-gat-normalization-for-nested-goals.rs:9:30 + | +LL | type Bar<T>: Baz<Self> = i32; + | ^^^ the trait `Eq<i32>` is not implemented for `i32`, which is required by `i32: Baz<Self>` + | +note: required for `i32` to implement `Baz<Self>` + --> $DIR/assume-gat-normalization-for-nested-goals.rs:16:23 + | +LL | impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {} + | ^^^^^^ ^^^ ------- unsatisfied trait bound introduced here +note: required by a bound in `Foo::Bar` + --> $DIR/assume-gat-normalization-for-nested-goals.rs:9:18 + | +LL | type Bar<T>: Baz<Self> = i32; + | ^^^^^^^^^ required by this bound in `Foo::Bar` +help: consider further restricting the associated type + | +LL | trait Foo where <Self as Foo>::Bar<()>: Eq<i32> { + | +++++++++++++++++++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs index 56b50594e52..4050b6fc425 100644 --- a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs +++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs @@ -1,8 +1,7 @@ //@ revisions: current next //@[next] compile-flags: -Znext-solver //@ ignore-compare-mode-next-solver (explicit revisions) -//@[current] known-bug: #117606 -//@[next] check-pass +//@ known-bug: #117606 #![feature(associated_type_defaults)] diff --git a/tests/ui/generic-associated-types/issue-102335-gat.rs b/tests/ui/generic-associated-types/issue-102335-gat.rs index 3a4a0c10771..0be6ee3930f 100644 --- a/tests/ui/generic-associated-types/issue-102335-gat.rs +++ b/tests/ui/generic-associated-types/issue-102335-gat.rs @@ -1,7 +1,7 @@ trait T { type A: S<C<(), i32 = ()> = ()>; - //~^ ERROR associated type bindings are not allowed here - //~| ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here + //~| ERROR associated item constraints are not allowed here } trait Q {} diff --git a/tests/ui/generic-associated-types/issue-102335-gat.stderr b/tests/ui/generic-associated-types/issue-102335-gat.stderr index 23b114a3a55..b4772486e6e 100644 --- a/tests/ui/generic-associated-types/issue-102335-gat.stderr +++ b/tests/ui/generic-associated-types/issue-102335-gat.stderr @@ -1,22 +1,22 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-gat.rs:2:21 | LL | type A: S<C<(), i32 = ()> = ()>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<(), i32 = ()> = ()>; | ~~~~~~~~~~ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-102335-gat.rs:2:21 | LL | type A: S<C<(), i32 = ()> = ()>; - | ^^^^^^^^ associated type not allowed here + | ^^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | LL | type A: S<C<(), i32 = ()> = ()>; | ~~~~~~~~~~ diff --git a/tests/ui/generic-associated-types/issue-74816.stderr b/tests/ui/generic-associated-types/issue-74816.current.stderr index 45018e6976c..335486c6538 100644 --- a/tests/ui/generic-associated-types/issue-74816.stderr +++ b/tests/ui/generic-associated-types/issue-74816.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Self: Trait1` is not satisfied - --> $DIR/issue-74816.rs:8:31 + --> $DIR/issue-74816.rs:12:31 | LL | type Associated: Trait1 = Self; | ^^^^ the trait `Trait1` is not implemented for `Self` | note: required by a bound in `Trait2::Associated` - --> $DIR/issue-74816.rs:8:22 + --> $DIR/issue-74816.rs:12:22 | LL | type Associated: Trait1 = Self; | ^^^^^^ required by this bound in `Trait2::Associated` @@ -15,13 +15,13 @@ LL | trait Trait2: Trait1 { | ++++++++ error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/issue-74816.rs:8:31 + --> $DIR/issue-74816.rs:12:31 | LL | type Associated: Trait1 = Self; | ^^^^ doesn't have a size known at compile-time | note: required by a bound in `Trait2::Associated` - --> $DIR/issue-74816.rs:8:5 + --> $DIR/issue-74816.rs:12:5 | LL | type Associated: Trait1 = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated` diff --git a/tests/ui/generic-associated-types/issue-74816.next.stderr b/tests/ui/generic-associated-types/issue-74816.next.stderr new file mode 100644 index 00000000000..335486c6538 --- /dev/null +++ b/tests/ui/generic-associated-types/issue-74816.next.stderr @@ -0,0 +1,35 @@ +error[E0277]: the trait bound `Self: Trait1` is not satisfied + --> $DIR/issue-74816.rs:12:31 + | +LL | type Associated: Trait1 = Self; + | ^^^^ the trait `Trait1` is not implemented for `Self` + | +note: required by a bound in `Trait2::Associated` + --> $DIR/issue-74816.rs:12:22 + | +LL | type Associated: Trait1 = Self; + | ^^^^^^ required by this bound in `Trait2::Associated` +help: consider further restricting `Self` + | +LL | trait Trait2: Trait1 { + | ++++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-74816.rs:12:31 + | +LL | type Associated: Trait1 = Self; + | ^^^^ doesn't have a size known at compile-time + | +note: required by a bound in `Trait2::Associated` + --> $DIR/issue-74816.rs:12:5 + | +LL | type Associated: Trait1 = Self; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated` +help: consider further restricting `Self` + | +LL | trait Trait2: Sized { + | +++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generic-associated-types/issue-74816.rs b/tests/ui/generic-associated-types/issue-74816.rs index 344afb87f99..e2f4ddc7485 100644 --- a/tests/ui/generic-associated-types/issue-74816.rs +++ b/tests/ui/generic-associated-types/issue-74816.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + #![feature(associated_type_defaults)] trait Trait1 { diff --git a/tests/ui/generic-associated-types/issue-74824.stderr b/tests/ui/generic-associated-types/issue-74824.current.stderr index 942d9583be1..b06c7f127ac 100644 --- a/tests/ui/generic-associated-types/issue-74824.stderr +++ b/tests/ui/generic-associated-types/issue-74824.current.stderr @@ -1,17 +1,17 @@ error[E0277]: the trait bound `Box<T>: Copy` is not satisfied - --> $DIR/issue-74824.rs:6:26 + --> $DIR/issue-74824.rs:10:26 | LL | type Copy<T>: Copy = Box<T>; | ^^^^^^ the trait `Copy` is not implemented for `Box<T>` | note: required by a bound in `UnsafeCopy::Copy` - --> $DIR/issue-74824.rs:6:19 + --> $DIR/issue-74824.rs:10:19 | LL | type Copy<T>: Copy = Box<T>; | ^^^^ required by this bound in `UnsafeCopy::Copy` error[E0277]: the trait bound `T: Clone` is not satisfied - --> $DIR/issue-74824.rs:6:26 + --> $DIR/issue-74824.rs:10:26 | LL | type Copy<T>: Copy = Box<T>; | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `<Self as UnsafeCopy>::Copy<T>: Copy` @@ -19,7 +19,7 @@ LL | type Copy<T>: Copy = Box<T>; = note: required for `Box<T>` to implement `Clone` = note: required for `<Self as UnsafeCopy>::Copy<T>` to implement `Copy` note: required by a bound in `UnsafeCopy::Copy` - --> $DIR/issue-74824.rs:6:19 + --> $DIR/issue-74824.rs:10:19 | LL | type Copy<T>: Copy = Box<T>; | ^^^^ required by this bound in `UnsafeCopy::Copy` diff --git a/tests/ui/generic-associated-types/issue-74824.next.stderr b/tests/ui/generic-associated-types/issue-74824.next.stderr new file mode 100644 index 00000000000..b06c7f127ac --- /dev/null +++ b/tests/ui/generic-associated-types/issue-74824.next.stderr @@ -0,0 +1,33 @@ +error[E0277]: the trait bound `Box<T>: Copy` is not satisfied + --> $DIR/issue-74824.rs:10:26 + | +LL | type Copy<T>: Copy = Box<T>; + | ^^^^^^ the trait `Copy` is not implemented for `Box<T>` + | +note: required by a bound in `UnsafeCopy::Copy` + --> $DIR/issue-74824.rs:10:19 + | +LL | type Copy<T>: Copy = Box<T>; + | ^^^^ required by this bound in `UnsafeCopy::Copy` + +error[E0277]: the trait bound `T: Clone` is not satisfied + --> $DIR/issue-74824.rs:10:26 + | +LL | type Copy<T>: Copy = Box<T>; + | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `<Self as UnsafeCopy>::Copy<T>: Copy` + | + = note: required for `Box<T>` to implement `Clone` + = note: required for `<Self as UnsafeCopy>::Copy<T>` to implement `Copy` +note: required by a bound in `UnsafeCopy::Copy` + --> $DIR/issue-74824.rs:10:19 + | +LL | type Copy<T>: Copy = Box<T>; + | ^^^^ required by this bound in `UnsafeCopy::Copy` +help: consider restricting type parameter `T` + | +LL | type Copy<T: std::clone::Clone>: Copy = Box<T>; + | +++++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generic-associated-types/issue-74824.rs b/tests/ui/generic-associated-types/issue-74824.rs index 10c45d13364..7cfb862abed 100644 --- a/tests/ui/generic-associated-types/issue-74824.rs +++ b/tests/ui/generic-associated-types/issue-74824.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + #![feature(associated_type_defaults)] use std::ops::Deref; diff --git a/tests/ui/higher-ranked/structually-relate-aliases.stderr b/tests/ui/higher-ranked/structually-relate-aliases.stderr index 59fab52b221..2f1dfd19c48 100644 --- a/tests/ui/higher-ranked/structually-relate-aliases.stderr +++ b/tests/ui/higher-ranked/structually-relate-aliases.stderr @@ -1,5 +1,5 @@ -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied --> $DIR/structually-relate-aliases.rs:13:36 | diff --git a/tests/ui/inference/issue-83606.rs b/tests/ui/inference/issue-83606.rs index 4454b5e60f0..e6e291c3a92 100644 --- a/tests/ui/inference/issue-83606.rs +++ b/tests/ui/inference/issue-83606.rs @@ -6,5 +6,5 @@ fn foo<const N: usize>(_: impl std::fmt::Display) -> [usize; N] { fn main() { let _ = foo("foo"); - //~^ ERROR type annotations needed for `[usize; _]` + //~^ ERROR type annotations needed } diff --git a/tests/ui/inline-const/uninit_local.rs b/tests/ui/inline-const/uninit_local.rs new file mode 100644 index 00000000000..548c053affc --- /dev/null +++ b/tests/ui/inline-const/uninit_local.rs @@ -0,0 +1,6 @@ +fn main() { + let _my_usize = const { + let x: bool; + while x {} //~ ERROR: `x` isn't initialized + }; +} diff --git a/tests/ui/inline-const/uninit_local.stderr b/tests/ui/inline-const/uninit_local.stderr new file mode 100644 index 00000000000..37b78e337e7 --- /dev/null +++ b/tests/ui/inline-const/uninit_local.stderr @@ -0,0 +1,16 @@ +error[E0381]: used binding `x` isn't initialized + --> $DIR/uninit_local.rs:4:15 + | +LL | let x: bool; + | - binding declared here but left uninitialized +LL | while x {} + | ^ `x` used here but it isn't initialized + | +help: consider assigning a value + | +LL | let x: bool = false; + | +++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr b/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr index 4d8d7e1560d..5df6aaf9804 100644 --- a/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr +++ b/tests/ui/instrument-coverage/mcdc-condition-limit.bad.stderr @@ -1,4 +1,4 @@ -warning: Conditions number of the decision (7) exceeds limit (6). MCDC analysis will not count this expression. +warning: Number of conditions in decision (7) exceeds limit (6). MC/DC analysis will not count this expression. --> $DIR/mcdc-condition-limit.rs:29:8 | LL | if a && b && c && d && e && f && g { diff --git a/tests/ui/instrument-coverage/mcdc-condition-limit.rs b/tests/ui/instrument-coverage/mcdc-condition-limit.rs index 64c5f8e9b77..de3770b5709 100644 --- a/tests/ui/instrument-coverage/mcdc-condition-limit.rs +++ b/tests/ui/instrument-coverage/mcdc-condition-limit.rs @@ -26,7 +26,7 @@ fn main() { fn main() { // 7 conditions is too many, so issue a diagnostic. let [a, b, c, d, e, f, g] = <[bool; 7]>::default(); - if a && b && c && d && e && f && g { //[bad]~ WARNING Conditions number of the decision + if a && b && c && d && e && f && g { //[bad]~ WARNING Number of conditions in decision core::hint::black_box("hello"); } } diff --git a/tests/ui/issues/issue-23543.rs b/tests/ui/issues/issue-23543.rs index 843e1a8a83a..248bf77a708 100644 --- a/tests/ui/issues/issue-23543.rs +++ b/tests/ui/issues/issue-23543.rs @@ -5,7 +5,7 @@ struct Foo; pub trait D { fn f<T>(self) where T<Bogus = Foo>: A; - //~^ ERROR associated type bindings are not allowed here [E0229] + //~^ ERROR associated item constraints are not allowed here [E0229] } fn main() {} diff --git a/tests/ui/issues/issue-23543.stderr b/tests/ui/issues/issue-23543.stderr index d917a4c51d5..17243aefbbc 100644 --- a/tests/ui/issues/issue-23543.stderr +++ b/tests/ui/issues/issue-23543.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-23543.rs:7:17 | LL | where T<Bogus = Foo>: A; - | ^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^ associated item constraint not allowed here error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23544.rs b/tests/ui/issues/issue-23544.rs index 6ad00b2fba4..bbd05a59353 100644 --- a/tests/ui/issues/issue-23544.rs +++ b/tests/ui/issues/issue-23544.rs @@ -3,7 +3,7 @@ pub trait A: Copy {} pub trait D { fn f<T>(self) where T<Bogus = Self::AlsoBogus>: A; - //~^ ERROR associated type bindings are not allowed here [E0229] + //~^ ERROR associated item constraints are not allowed here [E0229] } fn main() {} diff --git a/tests/ui/issues/issue-23544.stderr b/tests/ui/issues/issue-23544.stderr index 2a7e93f0eb7..8d652a9da27 100644 --- a/tests/ui/issues/issue-23544.stderr +++ b/tests/ui/issues/issue-23544.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-23544.rs:5:17 | LL | where T<Bogus = Self::AlsoBogus>: A; - | ^^^^^^^^^^^^^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^^^^^^^^^^^^^ associated item constraint not allowed here error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-24682.rs b/tests/ui/issues/issue-24682.rs index 0d1ab73417c..1bd42f3cbe3 100644 --- a/tests/ui/issues/issue-24682.rs +++ b/tests/ui/issues/issue-24682.rs @@ -2,17 +2,17 @@ trait A: Sized { type N; fn x() -> Self< - N= //~ ERROR associated type bindings are not allowed here + N= //~ ERROR associated item constraints are not allowed here Self::N> { loop {} } fn y(&self) -> std - <N=()> //~ ERROR associated type bindings are not allowed here + <N=()> //~ ERROR associated item constraints are not allowed here ::option::Option<()> { None } fn z(&self) -> - u32<N=()> //~ ERROR associated type bindings are not allowed here + u32<N=()> //~ ERROR associated item constraints are not allowed here { 42 } } diff --git a/tests/ui/issues/issue-24682.stderr b/tests/ui/issues/issue-24682.stderr index e1943bf4d68..a107e8b52cd 100644 --- a/tests/ui/issues/issue-24682.stderr +++ b/tests/ui/issues/issue-24682.stderr @@ -1,21 +1,21 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-24682.rs:5:11 | LL | / N= LL | | Self::N> { - | |_________________^ associated type not allowed here + | |_________________^ associated item constraint not allowed here -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-24682.rs:11:13 | LL | <N=()> - | ^^^^ associated type not allowed here + | ^^^^ associated item constraint not allowed here -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-24682.rs:15:13 | LL | u32<N=()> - | ^^^^ associated type not allowed here + | ^^^^ associated item constraint not allowed here error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-39687.rs b/tests/ui/issues/issue-39687.rs index cbb721fbb57..58f981b63d1 100644 --- a/tests/ui/issues/issue-39687.rs +++ b/tests/ui/issues/issue-39687.rs @@ -2,5 +2,5 @@ fn main() { <fn() as Fn()>::call; - //~^ ERROR associated type bindings are not allowed here [E0229] + //~^ ERROR associated item constraints are not allowed here [E0229] } diff --git a/tests/ui/issues/issue-39687.stderr b/tests/ui/issues/issue-39687.stderr index f4742115a19..87e5fdc2d8f 100644 --- a/tests/ui/issues/issue-39687.stderr +++ b/tests/ui/issues/issue-39687.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-39687.rs:4:14 | LL | <fn() as Fn()>::call; - | ^^^^ associated type not allowed here + | ^^^^ associated item constraint not allowed here error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-43431.rs b/tests/ui/issues/issue-43431.rs index e7ec35105f7..0286336910e 100644 --- a/tests/ui/issues/issue-43431.rs +++ b/tests/ui/issues/issue-43431.rs @@ -7,7 +7,7 @@ trait CallSingle<A, B> { impl<A, B, F: Fn(A) -> B> CallSingle<A, B> for F { fn call(&self, a: A) -> B { <Self as Fn(A) -> B>::call(self, (a,)) - //~^ ERROR associated type bindings are not allowed here + //~^ ERROR associated item constraints are not allowed here } } diff --git a/tests/ui/issues/issue-43431.stderr b/tests/ui/issues/issue-43431.stderr index 6d47ba27162..27a720408e4 100644 --- a/tests/ui/issues/issue-43431.stderr +++ b/tests/ui/issues/issue-43431.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-43431.rs:9:27 | LL | <Self as Fn(A) -> B>::call(self, (a,)) - | ^ associated type not allowed here + | ^ associated item constraint not allowed here error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs b/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs index a47e71afcf0..78069e682c1 100644 --- a/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs +++ b/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs @@ -3,6 +3,6 @@ struct Foo {} impl Foo { fn bar(foo: Foo<Target = usize>) {} - //~^ associated type bindings are not allowed here + //~^ associated item constraints are not allowed here } fn main() {} diff --git a/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.stderr b/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.stderr index d6da842e6ab..f8d919fd68b 100644 --- a/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.stderr +++ b/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.stderr @@ -1,10 +1,10 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-83753-invalid-associated-type-supertrait-hrtb.rs:5:21 | LL | fn bar(foo: Foo<Target = usize>) {} - | ^^^^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | fn bar(foo: Foo<Target = usize>) {} | ~~~~~~~~~~~~~~~~ diff --git a/tests/ui/lifetimes/issue-95023.rs b/tests/ui/lifetimes/issue-95023.rs index ee39a8c49c0..7a67297c763 100644 --- a/tests/ui/lifetimes/issue-95023.rs +++ b/tests/ui/lifetimes/issue-95023.rs @@ -2,7 +2,7 @@ struct ErrorKind; struct Error(ErrorKind); impl Fn(&isize) for Error { //~^ ERROR manual implementations of `Fn` are experimental [E0183] - //~^^ ERROR associated type bindings are not allowed here [E0229] + //~^^ ERROR associated item constraints are not allowed here [E0229] //~| ERROR not all trait items implemented //~| ERROR expected a `FnMut(&isize)` closure, found `Error` fn foo<const N: usize>(&self) -> Self::B<{ N }>; diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr index c4285dbf4bd..feec4f83f78 100644 --- a/tests/ui/lifetimes/issue-95023.stderr +++ b/tests/ui/lifetimes/issue-95023.stderr @@ -20,11 +20,11 @@ LL | impl Fn(&isize) for Error { | = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-95023.rs:3:6 | LL | impl Fn(&isize) for Error { - | ^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^ associated item constraint not allowed here | help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>` --> $DIR/issue-95023.rs:3:6 diff --git a/tests/ui/methods/method-call-type-binding.rs b/tests/ui/methods/method-call-type-binding.rs index f547ca8d1c2..290c66fabe3 100644 --- a/tests/ui/methods/method-call-type-binding.rs +++ b/tests/ui/methods/method-call-type-binding.rs @@ -1,3 +1,3 @@ fn main() { - 0.clone::<T = u8>(); //~ ERROR associated type bindings are not allowed here + 0.clone::<T = u8>(); //~ ERROR associated item constraints are not allowed here } diff --git a/tests/ui/methods/method-call-type-binding.stderr b/tests/ui/methods/method-call-type-binding.stderr index 54d855d340e..1acb0b2e12b 100644 --- a/tests/ui/methods/method-call-type-binding.stderr +++ b/tests/ui/methods/method-call-type-binding.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/method-call-type-binding.rs:2:15 | LL | 0.clone::<T = u8>(); - | ^^^^^^ associated type not allowed here + | ^^^^^^ associated item constraint not allowed here error: aborting due to 1 previous error diff --git a/tests/ui/rust-2024/unsafe-env-suggestion.fixed b/tests/ui/rust-2024/unsafe-env-suggestion.fixed new file mode 100644 index 00000000000..d9c738edfac --- /dev/null +++ b/tests/ui/rust-2024/unsafe-env-suggestion.fixed @@ -0,0 +1,20 @@ +//@ run-rustfix + +#![deny(deprecated_safe)] + +use std::env; + +#[deny(unused_unsafe)] +fn main() { + unsafe { env::set_var("FOO", "BAR") }; + //~^ ERROR call to deprecated safe function + //~| WARN this is accepted in the current edition + unsafe { env::remove_var("FOO") }; + //~^ ERROR call to deprecated safe function + //~| WARN this is accepted in the current edition + + unsafe { + env::set_var("FOO", "BAR"); + env::remove_var("FOO"); + } +} diff --git a/tests/ui/rust-2024/unsafe-env-suggestion.rs b/tests/ui/rust-2024/unsafe-env-suggestion.rs new file mode 100644 index 00000000000..3bd169973e3 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-env-suggestion.rs @@ -0,0 +1,20 @@ +//@ run-rustfix + +#![deny(deprecated_safe)] + +use std::env; + +#[deny(unused_unsafe)] +fn main() { + env::set_var("FOO", "BAR"); + //~^ ERROR call to deprecated safe function + //~| WARN this is accepted in the current edition + env::remove_var("FOO"); + //~^ ERROR call to deprecated safe function + //~| WARN this is accepted in the current edition + + unsafe { + env::set_var("FOO", "BAR"); + env::remove_var("FOO"); + } +} diff --git a/tests/ui/rust-2024/unsafe-env-suggestion.stderr b/tests/ui/rust-2024/unsafe-env-suggestion.stderr new file mode 100644 index 00000000000..90c91c2a474 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-env-suggestion.stderr @@ -0,0 +1,33 @@ +error: call to deprecated safe function `std::env::set_var` is unsafe and requires unsafe block + --> $DIR/unsafe-env-suggestion.rs:9:5 + | +LL | env::set_var("FOO", "BAR"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #27970 <https://github.com/rust-lang/rust/issues/27970> +note: the lint level is defined here + --> $DIR/unsafe-env-suggestion.rs:3:9 + | +LL | #![deny(deprecated_safe)] + | ^^^^^^^^^^^^^^^ +help: you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code + | +LL | unsafe { env::set_var("FOO", "BAR") }; + | ++++++++ + + +error: call to deprecated safe function `std::env::remove_var` is unsafe and requires unsafe block + --> $DIR/unsafe-env-suggestion.rs:12:5 + | +LL | env::remove_var("FOO"); + | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #27970 <https://github.com/rust-lang/rust/issues/27970> +help: you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code + | +LL | unsafe { env::remove_var("FOO") }; + | ++++++++ + + +error: aborting due to 2 previous errors + diff --git a/tests/ui/rust-2024/unsafe-env.e2021.stderr b/tests/ui/rust-2024/unsafe-env.e2021.stderr new file mode 100644 index 00000000000..cc40ec2e466 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-env.e2021.stderr @@ -0,0 +1,23 @@ +error[E0133]: call to unsafe function `unsafe_fn` is unsafe and requires unsafe function or block + --> $DIR/unsafe-env.rs:23:5 + | +LL | unsafe_fn(); + | ^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: unnecessary `unsafe` block + --> $DIR/unsafe-env.rs:26:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/unsafe-env.rs:11:8 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/rust-2024/unsafe-env.e2024.stderr b/tests/ui/rust-2024/unsafe-env.e2024.stderr new file mode 100644 index 00000000000..b43f817cf72 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-env.e2024.stderr @@ -0,0 +1,39 @@ +error[E0133]: call to unsafe function `set_var` is unsafe and requires unsafe block + --> $DIR/unsafe-env.rs:13:5 + | +LL | env::set_var("FOO", "BAR"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function `remove_var` is unsafe and requires unsafe block + --> $DIR/unsafe-env.rs:15:5 + | +LL | env::remove_var("FOO"); + | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error[E0133]: call to unsafe function `unsafe_fn` is unsafe and requires unsafe block + --> $DIR/unsafe-env.rs:23:5 + | +LL | unsafe_fn(); + | ^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: unnecessary `unsafe` block + --> $DIR/unsafe-env.rs:26:5 + | +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/unsafe-env.rs:11:8 + | +LL | #[deny(unused_unsafe)] + | ^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/rust-2024/unsafe-env.rs b/tests/ui/rust-2024/unsafe-env.rs new file mode 100644 index 00000000000..a882f077b9b --- /dev/null +++ b/tests/ui/rust-2024/unsafe-env.rs @@ -0,0 +1,30 @@ +//@ revisions: e2021 e2024 +//@[e2021] edition: 2021 +//@[e2024] edition: 2024 +//@[e2024] compile-flags: -Zunstable-options + +use std::env; + +unsafe fn unsafe_fn() {} +fn safe_fn() {} + +#[deny(unused_unsafe)] +fn main() { + env::set_var("FOO", "BAR"); + //[e2024]~^ ERROR call to unsafe function `set_var` is unsafe + env::remove_var("FOO"); + //[e2024]~^ ERROR call to unsafe function `remove_var` is unsafe + + unsafe { + env::set_var("FOO", "BAR"); + env::remove_var("FOO"); + } + + unsafe_fn(); + //~^ ERROR call to unsafe function `unsafe_fn` is unsafe + + unsafe { + //~^ ERROR unnecessary `unsafe` block + safe_fn(); + } +} diff --git a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr index bd0519f66c0..6fff086a89c 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr @@ -9,7 +9,7 @@ LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 { = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) -ERROR rustc_hir_typeck::method::confirm Foo was a subtype of &Foo but now is not? + ERROR rustc_hir_typeck::method::confirm Foo was a subtype of &Foo but now is not? error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.rs b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.rs new file mode 100644 index 00000000000..59a015da84e --- /dev/null +++ b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.rs @@ -0,0 +1,19 @@ +#![feature(specialization)] +#![allow(incomplete_features)] + +trait Trait { + type Type; +} + +impl Trait for i32 { + default type Type = i32; +} + +struct Wrapper<const C: <i32 as Trait>::Type> {} +//~^ ERROR `<i32 as Trait>::Type` is forbidden as the type of a const generic parameter + +impl<const C: usize> Wrapper<C> {} +//~^ ERROR the constant `C` is not of type `<i32 as Trait>::Type` +//~^^ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr new file mode 100644 index 00000000000..b4c14c2294e --- /dev/null +++ b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr @@ -0,0 +1,36 @@ +error: `<i32 as Trait>::Type` is forbidden as the type of a const generic parameter + --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:12:25 + | +LL | struct Wrapper<const C: <i32 as Trait>::Type> {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + +error: the constant `C` is not of type `<i32 as Trait>::Type` + --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:15:22 + | +LL | impl<const C: usize> Wrapper<C> {} + | ^^^^^^^^^^ expected associated type, found `usize` + | + = help: consider constraining the associated type `<i32 as Trait>::Type` to `usize` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: required by a bound in `Wrapper` + --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:12:16 + | +LL | struct Wrapper<const C: <i32 as Trait>::Type> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper` + +error[E0308]: mismatched types + --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:15:30 + | +LL | impl<const C: usize> Wrapper<C> {} + | ^ expected associated type, found `usize` + | + = note: expected associated type `<i32 as Trait>::Type` + found type `usize` + = help: consider constraining the associated type `<i32 as Trait>::Type` to `usize` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs index 4d1cd4332fe..f89a463bc58 100644 --- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs @@ -7,8 +7,7 @@ struct S<const L: usize>; impl<const N: i32> Copy for S<N> {} //~^ ERROR: mismatched types -//~| ERROR: the trait bound `S<N>: Clone` is not satisfied -//~| ERROR: the constant `N` is not of type `usize` impl<const M: usize> Copy for S<M> {} +//~^ ERROR: conflicting implementations of trait `Copy` for type `S<_>` fn main() {} diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr index 716a4787948..1dac58e1f69 100644 --- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr @@ -1,29 +1,11 @@ -error[E0277]: the trait bound `S<N>: Clone` is not satisfied - --> $DIR/bad-const-wf-doesnt-specialize.rs:8:29 +error[E0119]: conflicting implementations of trait `Copy` for type `S<_>` + --> $DIR/bad-const-wf-doesnt-specialize.rs:10:1 | LL | impl<const N: i32> Copy for S<N> {} - | ^^^^ the trait `Clone` is not implemented for `S<N>` - | - = help: the trait `Clone` is implemented for `S<L>` -note: required by a bound in `Copy` - --> $SRC_DIR/core/src/marker.rs:LL:COL -help: consider annotating `S<N>` with `#[derive(Clone)]` - | -LL + #[derive(Clone)] -LL | struct S<const L: usize>; - | - -error: the constant `N` is not of type `usize` - --> $DIR/bad-const-wf-doesnt-specialize.rs:8:29 - | -LL | impl<const N: i32> Copy for S<N> {} - | ^^^^ expected `usize`, found `i32` - | -note: required by a bound in `S` - --> $DIR/bad-const-wf-doesnt-specialize.rs:6:10 - | -LL | struct S<const L: usize>; - | ^^^^^^^^^^^^^^ required by this bound in `S` + | -------------------------------- first implementation here +LL | +LL | impl<const M: usize> Copy for S<M> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<_>` error[E0308]: mismatched types --> $DIR/bad-const-wf-doesnt-specialize.rs:8:31 @@ -31,7 +13,7 @@ error[E0308]: mismatched types LL | impl<const N: i32> Copy for S<N> {} | ^ expected `usize`, found `i32` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0119, E0308. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr b/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr index 78d77a78e0e..e9498a00317 100644 --- a/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr +++ b/tests/ui/specialization/specialization-default-items-drop-coherence.next.stderr @@ -7,13 +7,6 @@ LL | impl Overlap for u32 { LL | impl Overlap for <u32 as Default>::Id { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32` -error[E0282]: type annotations needed - --> $DIR/specialization-default-items-drop-coherence.rs:18:23 - | -LL | default type Id = T; - | ^ cannot infer type for associated type `<T as Default>::Id` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0119, E0282. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/specialization/specialization-default-items-drop-coherence.rs b/tests/ui/specialization/specialization-default-items-drop-coherence.rs index fad041f2ee1..6dc01277639 100644 --- a/tests/ui/specialization/specialization-default-items-drop-coherence.rs +++ b/tests/ui/specialization/specialization-default-items-drop-coherence.rs @@ -15,7 +15,7 @@ trait Default { } impl<T> Default for T { - default type Id = T; //[next]~ ERROR type annotations needed + default type Id = T; } trait Overlap { diff --git a/tests/ui/specialization/specialization-overlap-projection.next.stderr b/tests/ui/specialization/specialization-overlap-projection.next.stderr index ab040193fa4..5b17696162e 100644 --- a/tests/ui/specialization/specialization-overlap-projection.next.stderr +++ b/tests/ui/specialization/specialization-overlap-projection.next.stderr @@ -9,7 +9,7 @@ LL | #![feature(specialization)] = note: `#[warn(incomplete_features)]` on by default error[E0119]: conflicting implementations of trait `Foo` for type `u32` - --> $DIR/specialization-overlap-projection.rs:28:1 + --> $DIR/specialization-overlap-projection.rs:25:1 | LL | impl Foo for u32 {} | ---------------- first implementation here @@ -17,7 +17,7 @@ LL | impl Foo for <u8 as Assoc>::Output {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32` error[E0119]: conflicting implementations of trait `Foo` for type `u32` - --> $DIR/specialization-overlap-projection.rs:30:1 + --> $DIR/specialization-overlap-projection.rs:27:1 | LL | impl Foo for u32 {} | ---------------- first implementation here @@ -25,25 +25,6 @@ LL | impl Foo for u32 {} LL | impl Foo for <u16 as Assoc>::Output {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32` -error[E0282]: type annotations needed - --> $DIR/specialization-overlap-projection.rs:17:27 - | -LL | default type Output = bool; - | ^^^^ cannot infer type for associated type `<T as Assoc>::Output` - -error[E0282]: type annotations needed - --> $DIR/specialization-overlap-projection.rs:21:35 - | -LL | impl Assoc for u8 { type Output = u8; } - | ^^ cannot infer type for associated type `<u8 as Assoc>::Output` - -error[E0282]: type annotations needed - --> $DIR/specialization-overlap-projection.rs:23:36 - | -LL | impl Assoc for u16 { type Output = u16; } - | ^^^ cannot infer type for associated type `<u16 as Assoc>::Output` - -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted -Some errors have detailed explanations: E0119, E0282. -For more information about an error, try `rustc --explain E0119`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/specialization/specialization-overlap-projection.rs b/tests/ui/specialization/specialization-overlap-projection.rs index 78e75f623c4..16dccf82dcb 100644 --- a/tests/ui/specialization/specialization-overlap-projection.rs +++ b/tests/ui/specialization/specialization-overlap-projection.rs @@ -15,13 +15,10 @@ trait Assoc { impl<T> Assoc for T { default type Output = bool; - //[next]~^ ERROR type annotations needed } impl Assoc for u8 { type Output = u8; } -//[next]~^ ERROR type annotations needed impl Assoc for u16 { type Output = u16; } -//[next]~^ ERROR type annotations needed trait Foo {} impl Foo for u32 {} diff --git a/tests/ui/suggestions/issue-85347.rs b/tests/ui/suggestions/issue-85347.rs index 95e76e76cfa..5d1a902af30 100644 --- a/tests/ui/suggestions/issue-85347.rs +++ b/tests/ui/suggestions/issue-85347.rs @@ -3,12 +3,12 @@ trait Foo { type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments were supplied //~| HELP add missing - //~| ERROR associated type bindings are not allowed here - //~| HELP consider removing this type binding + //~| ERROR associated item constraints are not allowed here + //~| HELP consider removing this associated item binding //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments were supplied //~| HELP add missing - //~| ERROR associated type bindings are not allowed here - //~| HELP consider removing this type binding + //~| ERROR associated item constraints are not allowed here + //~| HELP consider removing this associated item binding } fn main() {} diff --git a/tests/ui/suggestions/issue-85347.stderr b/tests/ui/suggestions/issue-85347.stderr index de0aa09ce49..b3616041c4c 100644 --- a/tests/ui/suggestions/issue-85347.stderr +++ b/tests/ui/suggestions/issue-85347.stderr @@ -14,13 +14,13 @@ help: add missing lifetime argument LL | type Bar<'a>: Deref<Target = <Self>::Bar<'a, Target = Self>>; | +++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-85347.rs:3:46 | LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; - | ^^^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^^^ associated item constraint not allowed here | -help: consider removing this type binding +help: consider removing this associated item binding | LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; | ~~~~~~~~~~~~~~~ @@ -42,14 +42,14 @@ help: add missing lifetime argument LL | type Bar<'a>: Deref<Target = <Self>::Bar<'a, Target = Self>>; | +++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-85347.rs:3:46 | LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; - | ^^^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^^^ associated item constraint not allowed here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider removing this type binding +help: consider removing this associated item binding | LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; | ~~~~~~~~~~~~~~~ diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.rs b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.rs index c98eec4af01..99f943d71e9 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.rs +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.rs @@ -8,5 +8,5 @@ fn main() { //~| HELP you might have meant to write a path instead of an associated type bound //~| ERROR struct takes at least 1 generic argument but 0 generic arguments were supplied //~| HELP add missing generic argument - //~| ERROR associated type bindings are not allowed here + //~| ERROR associated item constraints are not allowed here } diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 834c141ec3e..56b6a69a283 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -20,11 +20,11 @@ help: add missing generic argument LL | let _: Vec<T, A:B> = A::B; | ++ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/type-ascription-instead-of-path-in-type.rs:6:16 | LL | let _: Vec<A:B> = A::B; - | ^^^ associated type not allowed here + | ^^^ associated item constraint not allowed here error: aborting due to 3 previous errors diff --git a/tests/ui/traits/issue-87558.rs b/tests/ui/traits/issue-87558.rs index 76f0f7453dd..61a24f6b967 100644 --- a/tests/ui/traits/issue-87558.rs +++ b/tests/ui/traits/issue-87558.rs @@ -2,7 +2,7 @@ struct ErrorKind; struct Error(ErrorKind); impl Fn(&isize) for Error { //~^ ERROR manual implementations of `Fn` are experimental - //~| ERROR associated type bindings are not allowed here + //~| ERROR associated item constraints are not allowed here //~| ERROR closure, found `Error` //~| ERROR not all trait items implemented, missing: `call` fn from() {} //~ ERROR method `from` is not a member of trait `Fn` diff --git a/tests/ui/traits/issue-87558.stderr b/tests/ui/traits/issue-87558.stderr index 1ce273a9f25..21d8fc0f567 100644 --- a/tests/ui/traits/issue-87558.stderr +++ b/tests/ui/traits/issue-87558.stderr @@ -12,11 +12,11 @@ LL | impl Fn(&isize) for Error { | = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-87558.rs:3:6 | LL | impl Fn(&isize) for Error { - | ^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^ associated item constraint not allowed here | help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>` --> $DIR/issue-87558.rs:3:6 diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr index 2e0566cad08..17da1f52479 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr +++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr @@ -25,10 +25,10 @@ help: this trait has no implementations, consider adding one LL | trait ToUnit<'a> { | ^^^^^^^^^^^^^^^^ -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } -WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)` --> $DIR/issue-118950-root-region.rs:19:1 | diff --git a/tests/ui/traits/next-solver/specialization-transmute.rs b/tests/ui/traits/next-solver/specialization-transmute.rs index caa3bfc552e..9e31fed9b18 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.rs +++ b/tests/ui/traits/next-solver/specialization-transmute.rs @@ -10,7 +10,7 @@ trait Default { } impl<T> Default for T { - default type Id = T; //~ ERROR type annotations needed + default type Id = T; // This will be fixed by #111994 fn intu(&self) -> &Self::Id { //~^ ERROR type annotations needed diff --git a/tests/ui/traits/next-solver/specialization-transmute.stderr b/tests/ui/traits/next-solver/specialization-transmute.stderr index 76ae08fdb7a..524522bef09 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.stderr +++ b/tests/ui/traits/next-solver/specialization-transmute.stderr @@ -34,13 +34,6 @@ note: required by a bound in `transmute` LL | fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U { | ^^^^^^ required by this bound in `transmute` -error[E0282]: type annotations needed - --> $DIR/specialization-transmute.rs:13:23 - | -LL | default type Id = T; - | ^ cannot infer type for associated type `<T as Default>::Id` - -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 4 previous errors; 1 warning emitted -Some errors have detailed explanations: E0282, E0284. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/next-solver/specialization-unconstrained.rs b/tests/ui/traits/next-solver/specialization-unconstrained.rs index f4046fba20b..e44246a1262 100644 --- a/tests/ui/traits/next-solver/specialization-unconstrained.rs +++ b/tests/ui/traits/next-solver/specialization-unconstrained.rs @@ -11,7 +11,7 @@ trait Default { } impl<T> Default for T { - default type Id = T; //~ ERROR type annotations needed + default type Id = T; } fn test<T: Default<Id = U>, U>() {} diff --git a/tests/ui/traits/next-solver/specialization-unconstrained.stderr b/tests/ui/traits/next-solver/specialization-unconstrained.stderr index 68232aacc0c..a6f6a4f260d 100644 --- a/tests/ui/traits/next-solver/specialization-unconstrained.stderr +++ b/tests/ui/traits/next-solver/specialization-unconstrained.stderr @@ -20,13 +20,6 @@ note: required by a bound in `test` LL | fn test<T: Default<Id = U>, U>() {} | ^^^^^^ required by this bound in `test` -error[E0282]: type annotations needed - --> $DIR/specialization-unconstrained.rs:14:22 - | -LL | default type Id = T; - | ^ cannot infer type for associated type `<T as Default>::Id` - -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 1 previous error; 1 warning emitted -Some errors have detailed explanations: E0282, E0284. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/next-solver/unsound-region-obligation.rs b/tests/ui/traits/next-solver/unsound-region-obligation.rs index 32a510d1654..733be204354 100644 --- a/tests/ui/traits/next-solver/unsound-region-obligation.rs +++ b/tests/ui/traits/next-solver/unsound-region-obligation.rs @@ -1,4 +1,4 @@ -//~ ERROR the type `<() as StaticTy>::Item<'a>` does not fulfill the required lifetime +//~ ERROR the type `&'a ()` does not fulfill the required lifetime //@ compile-flags: -Znext-solver // Regression test for rust-lang/trait-system-refactor-initiative#59 diff --git a/tests/ui/traits/next-solver/unsound-region-obligation.stderr b/tests/ui/traits/next-solver/unsound-region-obligation.stderr index 518de7ea3e0..fe96a184f43 100644 --- a/tests/ui/traits/next-solver/unsound-region-obligation.stderr +++ b/tests/ui/traits/next-solver/unsound-region-obligation.stderr @@ -1,4 +1,4 @@ -error[E0477]: the type `<() as StaticTy>::Item<'a>` does not fulfill the required lifetime +error[E0477]: the type `&'a ()` does not fulfill the required lifetime | = note: type must satisfy the static lifetime diff --git a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs index 050b7b44b4e..3defe0cb44d 100644 --- a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs +++ b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs @@ -5,6 +5,6 @@ type Pat<const START: u32, const END: u32> = std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>); //~^ ERROR type and const arguments are not allowed on const parameter `START` //~| ERROR type arguments are not allowed on const parameter `END` -//~| ERROR associated type bindings are not allowed here +//~| ERROR associated item constraints are not allowed here fn main() {} diff --git a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr index 40effe924da..7f4e6e314f5 100644 --- a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr +++ b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr @@ -26,11 +26,11 @@ note: const parameter `END` defined here LL | type Pat<const START: u32, const END: u32> = | ^^^ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/bad_const_generics_args_on_const_param.rs:5:67 | LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>); - | ^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^ associated item constraint not allowed here error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/escaping_bound_vars.rs b/tests/ui/typeck/escaping_bound_vars.rs index 985a3fdbccf..3cde041f185 100644 --- a/tests/ui/typeck/escaping_bound_vars.rs +++ b/tests/ui/typeck/escaping_bound_vars.rs @@ -10,7 +10,7 @@ pub fn test() where (): Test<{ 1 + (<() as Elide(&())>::call) }>, //~^ ERROR cannot capture late-bound lifetime in constant - //~| ERROR associated type bindings are not allowed here + //~| ERROR associated item constraints are not allowed here { } diff --git a/tests/ui/typeck/escaping_bound_vars.stderr b/tests/ui/typeck/escaping_bound_vars.stderr index bd9c95fab97..f383099ce13 100644 --- a/tests/ui/typeck/escaping_bound_vars.stderr +++ b/tests/ui/typeck/escaping_bound_vars.stderr @@ -6,11 +6,11 @@ LL | (): Test<{ 1 + (<() as Elide(&())>::call) }>, | | | lifetime defined here -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/escaping_bound_vars.rs:11:28 | LL | (): Test<{ 1 + (<() as Elide(&())>::call) }>, - | ^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^ associated item constraint not allowed here error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-83693.rs b/tests/ui/typeck/issue-83693.rs index a4255822056..02a0bb30d7c 100644 --- a/tests/ui/typeck/issue-83693.rs +++ b/tests/ui/typeck/issue-83693.rs @@ -8,12 +8,12 @@ impl F { fn call() { <Self as Fn(&TestResult)>::call //~^ ERROR: cannot find type `TestResult` in this scope [E0412] - //~| associated type bindings are not allowed here [E0229] + //~| associated item constraints are not allowed here [E0229] } } fn call() { <x as Fn(&usize)>::call //~^ ERROR: cannot find type `x` in this scope [E0412] - //~| ERROR: associated type bindings are not allowed here [E0229] + //~| ERROR: associated item constraints are not allowed here [E0229] } diff --git a/tests/ui/typeck/issue-83693.stderr b/tests/ui/typeck/issue-83693.stderr index ce4f73b820a..34bca426116 100644 --- a/tests/ui/typeck/issue-83693.stderr +++ b/tests/ui/typeck/issue-83693.stderr @@ -19,17 +19,17 @@ error[E0412]: cannot find type `x` in this scope LL | <x as Fn(&usize)>::call | ^ not found in this scope -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-83693.rs:9:18 | LL | <Self as Fn(&TestResult)>::call - | ^^^^^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^^^^^ associated item constraint not allowed here -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-83693.rs:16:11 | LL | <x as Fn(&usize)>::call - | ^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^ associated item constraint not allowed here error: aborting due to 5 previous errors diff --git a/tests/ui/typeck/issue-84768.rs b/tests/ui/typeck/issue-84768.rs index ffa92823b42..3ba5dffcf07 100644 --- a/tests/ui/typeck/issue-84768.rs +++ b/tests/ui/typeck/issue-84768.rs @@ -5,6 +5,6 @@ fn transform_mut<F>(f: F) where F: for<'b> FnOnce(&'b mut u8) { <F as FnOnce(&mut u8)>::call_once(f, 1) - //~^ ERROR: associated type bindings are not allowed here [E0229] + //~^ ERROR: associated item constraints are not allowed here [E0229] //~| ERROR: mismatched types [E0308] } diff --git a/tests/ui/typeck/issue-84768.stderr b/tests/ui/typeck/issue-84768.stderr index 3d2d53f5c76..72784ba59c9 100644 --- a/tests/ui/typeck/issue-84768.stderr +++ b/tests/ui/typeck/issue-84768.stderr @@ -1,8 +1,8 @@ -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-84768.rs:7:11 | LL | <F as FnOnce(&mut u8)>::call_once(f, 1) - | ^^^^^^^^^^^^^^^ associated type not allowed here + | ^^^^^^^^^^^^^^^ associated item constraint not allowed here error[E0308]: mismatched types --> $DIR/issue-84768.rs:7:42 diff --git a/tests/ui/typeck/issue-91267.rs b/tests/ui/typeck/issue-91267.rs index 4e39cfab5b4..1bffa09e643 100644 --- a/tests/ui/typeck/issue-91267.rs +++ b/tests/ui/typeck/issue-91267.rs @@ -3,6 +3,6 @@ fn main() { type_ascribe!(0, u8<e<5>=e>) //~^ ERROR: cannot find type `e` in this scope [E0412] - //~| ERROR: associated type bindings are not allowed here [E0229] + //~| ERROR: associated item constraints are not allowed here [E0229] //~| ERROR: mismatched types [E0308] } diff --git a/tests/ui/typeck/issue-91267.stderr b/tests/ui/typeck/issue-91267.stderr index 399309d0ec4..d16b1997e9f 100644 --- a/tests/ui/typeck/issue-91267.stderr +++ b/tests/ui/typeck/issue-91267.stderr @@ -4,11 +4,11 @@ error[E0412]: cannot find type `e` in this scope LL | type_ascribe!(0, u8<e<5>=e>) | ^ not found in this scope -error[E0229]: associated type bindings are not allowed here +error[E0229]: associated item constraints are not allowed here --> $DIR/issue-91267.rs:4:25 | LL | type_ascribe!(0, u8<e<5>=e>) - | ^^^^^^ associated type not allowed here + | ^^^^^^ associated item constraint not allowed here error[E0308]: mismatched types --> $DIR/issue-91267.rs:4:5 |
