diff --git a/tests/ui/abi/bad-custom.stderr b/tests/ui/abi/bad-custom.stderr index 472c0041234e6..478425fd4cb3c 100644 --- a/tests/ui/abi/bad-custom.stderr +++ b/tests/ui/abi/bad-custom.stderr @@ -423,9 +423,6 @@ error[E0277]: expected an `Fn()` closure, found `unsafe extern "custom" fn()` | LL | fn no_promotion_to_fn_trait(f: unsafe extern "custom" fn()) -> impl Fn() { | ^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }` -LL | -LL | f - | - return type was inferred to be `unsafe extern "custom" fn()` here | = help: the trait `Fn()` is not implemented for `unsafe extern "custom" fn()` = note: wrap the `unsafe extern "custom" fn()` in a closure with no arguments: `|| { /* code */ }` diff --git a/tests/ui/allocator/159445-unsize-pin-box.stderr b/tests/ui/allocator/159445-unsize-pin-box.stderr index c17019be03799..dcdf3b7bd9d77 100644 --- a/tests/ui/allocator/159445-unsize-pin-box.stderr +++ b/tests/ui/allocator/159445-unsize-pin-box.stderr @@ -23,6 +23,7 @@ help: the following other types implement trait `StaticAllocator` | = note: `std::alloc::Global` = note: required for `Box` to implement `PinSafePointer` + = note: required for `Pin>` to implement `CoerceUnsized>>` = note: required for the cast from `Pin>` to `Pin>` error: aborting due to 1 previous error diff --git a/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr b/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr index 1304bef4211d0..2c6a2ebfe18d7 100644 --- a/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr +++ b/tests/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr @@ -1,18 +1,16 @@ -error[E0308]: const not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/associated-const-impl-wrong-lifetime.rs:7:5 | LL | const NAME: &'a str = "unit"; - | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^ | - = note: expected reference `&'static _` - found reference `&'a _` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/associated-const-impl-wrong-lifetime.rs:6:6 | LL | impl<'a> Foo for &'a () { | ^^ - = note: ...does not necessarily outlive the static lifetime + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/associated-consts/associated-const-in-trait.stderr b/tests/ui/associated-consts/associated-const-in-trait.stderr index 64ac88856fdc4..074fe4855814a 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.stderr +++ b/tests/ui/associated-consts/associated-const-in-trait.stderr @@ -30,6 +30,19 @@ LL | const N: usize; | ^ ...because it contains associated const `N` = help: consider moving `N` to another trait -error: aborting due to 2 previous errors +error[E0277]: the trait bound `(dyn Trait + 'static): Trait` is not satisfied + --> $DIR/associated-const-in-trait.rs:9:29 + | +LL | const fn n() -> usize { Self::N } + | ^^^^ the trait `Trait` is not implemented for `(dyn Trait + 'static)` + | +help: this trait has no implementations, consider adding one + --> $DIR/associated-const-in-trait.rs:3:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0277. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr index 8202342c65daf..1ab176b92ec22 100644 --- a/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr +++ b/tests/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr @@ -1,18 +1,14 @@ -error: constant expression depends on a generic parameter - --> $DIR/associated-const-type-parameter-arrays-2.rs:16:22 +error[E0282]: type annotations needed for `[{integer}; _]` + --> $DIR/associated-const-type-parameter-arrays-2.rs:16:9 | LL | let _array = [4; ::Y]; - | ^^^^^^^^^^^^^ + | ^^^^^^ - type must be known at this point | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/associated-const-type-parameter-arrays-2.rs:16:18 - | -LL | let _array = [4; ::Y]; - | ^^^^^^^^^^^^^^^^^^ +help: consider giving `_array` an explicit type, where the placeholders `_` are specified | - = note: this may fail depending on what value the parameter takes +LL | let _array: [{integer}; _] = [4; ::Y]; + | ++++++++++++++++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr index d6b37ae1e94cb..bef8014d98d71 100644 --- a/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr +++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr @@ -16,13 +16,6 @@ error[E0277]: the trait bound `String: Copy` is not satisfied | LL | const _: Ty::Pr = String::new(); | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` - | -note: required by a bound in `Ty::Pr` - --> $DIR/generic-associated-types-bad.rs:10:16 - | -LL | impl Ty { -LL | type Pr = T; - | ^^^^ required by this bound in `Ty::Pr` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr index 69efe563e8e15..20d3e7c8ba06c 100644 --- a/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr +++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr @@ -3,13 +3,6 @@ error[E0277]: the trait bound `Vec<()>: Copy` is not satisfied | LL | let _: Ty::Pr>; | ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<()>` - | -note: required by a bound in `Ty::Pr` - --> $DIR/generic-associated-types-bad.rs:10:16 - | -LL | impl Ty { -LL | type Pr = T; - | ^^^^ required by this bound in `Ty::Pr` error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.stderr b/tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.stderr index efb8a38e09955..a6c61da24b110 100644 --- a/tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.stderr +++ b/tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.stderr @@ -11,22 +11,25 @@ LL | LL ~ impl<'a> Foo { | -error[E0308]: mismatched types +error[E0271]: type mismatch resolving `Foo::Assoc == &()` --> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:11 | LL | fn foo(_: for<'a> fn(Foo::Assoc)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + +error[E0271]: type mismatch resolving `Foo::Assoc == &()` + --> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:8 | - = note: expected struct `Foo fn(&'a ())>` - found struct `Foo fn(&'a ())>` +LL | fn foo(_: for<'a> fn(Foo::Assoc)) {} + | ^ types differ -error: higher-ranked subtype error +error[E0271]: type mismatch resolving `Foo::Assoc == &()` --> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:1 | LL | fn foo(_: for<'a> fn(Foo::Assoc)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0207, E0308. +Some errors have detailed explanations: E0207, E0271. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr index db860a64826d6..003bc7eb134ed 100644 --- a/tests/ui/associated-inherent-types/issue-109789.stderr +++ b/tests/ui/associated-inherent-types/issue-109789.stderr @@ -1,44 +1,23 @@ -error[E0308]: mismatched types +error[E0271]: type mismatch resolving `Foo::Assoc == u32` --> $DIR/issue-109789.rs:18:11 | LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected struct `Foo` - found struct `Foo fn(&'a ())>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ -error[E0308]: mismatched types +error: the type `Foo fn(&'a ())>::Assoc` is not well-formed --> $DIR/issue-109789.rs:18:11 | LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected struct `Foo` - found struct `Foo fn(&'a ())>` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: higher-ranked subtype error - --> $DIR/issue-109789.rs:18:1 - | -LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: higher-ranked subtype error - --> $DIR/issue-109789.rs:18:1 - | -LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: higher-ranked subtype error - --> $DIR/issue-109789.rs:18:1 +error[E0271]: type mismatch resolving `Foo::Assoc == u32` + --> $DIR/issue-109789.rs:18:11 | LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-inherent-types/issue-111879-0.stderr b/tests/ui/associated-inherent-types/issue-111879-0.stderr index 144f6486b3b9f..6b67712857dee 100644 --- a/tests/ui/associated-inherent-types/issue-111879-0.stderr +++ b/tests/ui/associated-inherent-types/issue-111879-0.stderr @@ -1,8 +1,15 @@ -error: overflow evaluating associated type `Carrier<'b>::Focus` +error[E0275]: overflow evaluating the requirement `for<'b> Carrier<'b>::Focus == _` --> $DIR/issue-111879-0.rs:9:5 | LL | pub type Focus = &'a mut for<'b> fn(Carrier<'b>::Focus); | ^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating whether `&'a mut for<'b> fn(Carrier<'b>::Focus)` is well-formed + --> $DIR/issue-111879-0.rs:9:5 + | +LL | pub type Focus = &'a mut for<'b> fn(Carrier<'b>::Focus); + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-inherent-types/regionck-1.stderr b/tests/ui/associated-inherent-types/regionck-1.stderr index 4e0ecc3c80e5c..ac4bd0265447a 100644 --- a/tests/ui/associated-inherent-types/regionck-1.stderr +++ b/tests/ui/associated-inherent-types/regionck-1.stderr @@ -5,31 +5,26 @@ LL | type NoTyOutliv<'a, T> = &'a T; | ^^^^^^^^^^^^^^^^--^^^^ | | | | | the parameter type `T` must be valid for the lifetime `'a` as defined here... - | ...so that the reference type `&'a T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | LL | type NoTyOutliv<'a, T: 'a> = &'a T; | ++++ -error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references +error[E0477]: the type `&'b ()` does not fulfill the required lifetime --> $DIR/regionck-1.rs:10:5 | LL | type NoReOutliv<'a, 'b> = &'a &'b (); | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/regionck-1.rs:10:21 | LL | type NoReOutliv<'a, 'b> = &'a &'b (); | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regionck-1.rs:10:25 - | -LL | type NoReOutliv<'a, 'b> = &'a &'b (); - | ^^ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0309, E0491. +Some errors have detailed explanations: E0309, E0477. For more information about an error, try `rustc --explain E0309`. diff --git a/tests/ui/associated-inherent-types/regionck-2.stderr b/tests/ui/associated-inherent-types/regionck-2.stderr index 82f5c6a72c008..0703776ce9185 100644 --- a/tests/ui/associated-inherent-types/regionck-2.stderr +++ b/tests/ui/associated-inherent-types/regionck-2.stderr @@ -1,17 +1,15 @@ -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/regionck-2.rs:12:12 | LL | fn test(_: Lexer::Cursor) {} - | ^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^ | - = note: expected struct `Lexer<'static>` - found struct `Lexer<'_>` -note: the anonymous lifetime defined here... +note: lifetime parameter instantiated with the anonymous lifetime defined here --> $DIR/regionck-2.rs:12:12 | LL | fn test(_: Lexer::Cursor) {} | ^^^^^ - = note: ...does not necessarily outlive the static lifetime + = note: but lifetime parameter must outlive the static lifetime error: lifetime may not live long enough --> $DIR/regionck-2.rs:12:1 @@ -24,4 +22,4 @@ LL | fn test(_: Lexer::Cursor) {} error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr b/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr index faf4a599734d6..5fa3f9322457f 100644 --- a/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr +++ b/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr @@ -3,14 +3,6 @@ error[E0277]: the trait bound `String: Copy` is not satisfied | LL | let _: S<_>::T = String::new(); | ^^^^^^^ the trait `Copy` is not implemented for `String` - | -note: required by a bound in `S::T` - --> $DIR/unsatisfied-bounds-inferred-type.rs:6:9 - | -LL | impl S { - | ^^^^ required by this bound in `S::T` -LL | type T = T; - | error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr b/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr index 2edf7faa440e1..b9d7a6310c740 100644 --- a/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr +++ b/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr @@ -3,15 +3,6 @@ error[E0277]: the trait bound `String: Copy` is not satisfied | LL | let _: S::::X; | ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` - | -note: required by a bound in `S::X` - --> $DIR/unsatisfied-bounds-where-clause-on-assoc-ty.rs:9:12 - | -LL | impl S { -LL | type X = () -LL | where -LL | T: Copy; - | ^^^^ required by this bound in `S::X` error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/duplicate-bound-err.stderr b/tests/ui/associated-type-bounds/duplicate-bound-err.stderr index accee989fe02d..65158489150ca 100644 --- a/tests/ui/associated-type-bounds/duplicate-bound-err.stderr +++ b/tests/ui/associated-type-bounds/duplicate-bound-err.stderr @@ -4,6 +4,7 @@ error[E0282]: type annotations needed LL | iter::empty() | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` | + = note: cannot infer type of hidden type of opaque help: consider specifying a concrete type for the type parameter `T` | LL | iter::empty::() @@ -15,6 +16,7 @@ error[E0282]: type annotations needed LL | iter::empty() | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` | + = note: cannot infer type of hidden type of opaque help: consider specifying a concrete type for the type parameter `T` | LL | iter::empty::() @@ -26,6 +28,7 @@ error[E0282]: type annotations needed LL | iter::empty() | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `empty` | + = note: cannot infer type of hidden type of opaque help: consider specifying a concrete type for the type parameter `T` | LL | iter::empty::() @@ -84,9 +87,6 @@ error[E0277]: `*const ()` cannot be sent between threads safely | LL | fn mismatch() -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely -LL | -LL | iter::empty::<*const ()>() - | -------------------------- return type was inferred to be `std::iter::Empty<*const ()>` here | = help: the trait `Send` is not implemented for `*const ()` @@ -95,32 +95,18 @@ error[E0277]: the trait bound `String: Copy` is not satisfied | LL | fn mismatch_2() -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` -LL | -LL | iter::empty::() - | ----------------------- return type was inferred to be `std::iter::Empty` here error[E0271]: expected `IntoIter` to be an iterator that yields `i32`, but it yields `u32` --> $DIR/duplicate-bound-err.rs:103:17 | LL | fn foo() -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` -... -LL | [2u32].into_iter() - | ------------------ return type was inferred to be `std::array::IntoIter` here - | -note: the method call chain might not have had the expected associated types - --> $DIR/duplicate-bound-err.rs:106:16 - | -LL | [2u32].into_iter() - | ------ ^^^^^^^^^^^ `Iterator::Item` is `u32` here - | | - | this expression has type `[u32; 1]` -error[E0271]: expected `impl Iterator` to be an iterator that yields `i32`, but it yields `u32` +error[E0284]: type annotations needed: cannot satisfy ` as Iterator>::Item == i32` --> $DIR/duplicate-bound-err.rs:103:17 | LL | fn foo() -> impl Iterator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy ` as Iterator>::Item == i32` | note: required by a bound in `Trait3::foo::{anon_assoc#0}` --> $DIR/duplicate-bound-err.rs:99:31 @@ -273,5 +259,5 @@ LL | fn uncallable_rtn(_: impl Trait, foo(..): Trait> Trait for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `func` in implementation -error[E0275]: overflow evaluating the requirement `impl Future { <() as Trait>::func(..) } == _` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:16:5 +error[E0275]: overflow evaluating the requirement `(): Trait` + --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:16:11 | LL | check(()); - | ^^^^^^^^^ + | ----- ^^ + | | + | required by a bound introduced by this call | -note: required for `()` to implement `Trait` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:10:32 - | -LL | impl> Trait for T {} - | ---- ^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 1 redundant requirement hidden - = note: required for `()` to implement `Trait` note: required by a bound in `check` --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:13:18 | diff --git a/tests/ui/associated-types/associated-types-eq-3.stderr b/tests/ui/associated-types/associated-types-eq-3.stderr index 5fef2a020b890..81d171933e25d 100644 --- a/tests/ui/associated-types/associated-types-eq-3.stderr +++ b/tests/ui/associated-types/associated-types-eq-3.stderr @@ -43,6 +43,8 @@ note: expected this to be `Bar` | LL | type A = usize; | ^^^^^ + = note: required because it appears within the type `isize` + = note: required for `&isize` to implement `CoerceUnsized<&dyn Foo>` = note: required for the cast from `&isize` to `&dyn Foo` error: aborting due to 3 previous errors diff --git a/tests/ui/associated-types/associated-types-eq-hr.stderr b/tests/ui/associated-types/associated-types-eq-hr.stderr index 4f85111897df5..a9eb522be017e 100644 --- a/tests/ui/associated-types/associated-types-eq-hr.stderr +++ b/tests/ui/associated-types/associated-types-eq-hr.stderr @@ -40,192 +40,67 @@ LL | where LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, | ^^^^^^^^^^^^^ required by this bound in `bar` -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:96:5 +error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied + --> $DIR/associated-types-eq-hr.rs:96:17 | LL | tuple_one::(); - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^ unsatisfied trait bound | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/associated-types-eq-hr.rs:59:8 - | -LL | fn tuple_one() -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_one` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +help: the trait `TheTrait<(&'x _, &'y _)>` is not implemented for `Tuple` + but trait `TheTrait<(&_, &_)>` is implemented for it --> $DIR/associated-types-eq-hr.rs:35:1 | LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:96:5 - | -LL | tuple_one::(); - | ^^^^^^^^^^^^^^^^^^^^ - | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: required by a bound in `tuple_one` --> $DIR/associated-types-eq-hr.rs:59:8 | LL | fn tuple_one() LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_one` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - --> $DIR/associated-types-eq-hr.rs:35:1 - | -LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:96:5 - | -LL | tuple_one::(); - | ^^^^^^^^^^^^^^^^^^^^ - | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/associated-types-eq-hr.rs:59:53 - | -LL | fn tuple_one() -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ^^^^^^^^^^^^^ required by this bound in `tuple_one` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - --> $DIR/associated-types-eq-hr.rs:35:1 - | -LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:96:5 - | -LL | tuple_one::(); - | ^^^^^^^^^^^^^^^^^^^^ - | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/associated-types-eq-hr.rs:59:53 - | -LL | fn tuple_one() -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ^^^^^^^^^^^^^ required by this bound in `tuple_one` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - --> $DIR/associated-types-eq-hr.rs:35:1 - | -LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:104:5 +error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied + --> $DIR/associated-types-eq-hr.rs:104:17 | LL | tuple_two::(); - | ^^^^^^^^^^^^^^^^^^^^ - | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/associated-types-eq-hr.rs:66:8 + | ^^^^^ unsatisfied trait bound | -LL | fn tuple_two() -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_two` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +help: the trait `TheTrait<(&'x _, &'y _)>` is not implemented for `Tuple` + but trait `TheTrait<(&_, &_)>` is implemented for it --> $DIR/associated-types-eq-hr.rs:35:1 | LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:104:5 - | -LL | tuple_two::(); - | ^^^^^^^^^^^^^^^^^^^^ - | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: required by a bound in `tuple_two` --> $DIR/associated-types-eq-hr.rs:66:8 | LL | fn tuple_two() LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_two` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - --> $DIR/associated-types-eq-hr.rs:35:1 - | -LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0308]: mismatched types - --> $DIR/associated-types-eq-hr.rs:104:5 - | -LL | tuple_two::(); - | ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected reference `&'x _` - found reference `&'y _` -note: the lifetime requirement is introduced here - --> $DIR/associated-types-eq-hr.rs:66:53 - | -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, - | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/associated-types-eq-hr.rs:104:5 - | -LL | tuple_two::(); - | ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected reference `&'x _` - found reference `&'y _` -note: the lifetime requirement is introduced here - --> $DIR/associated-types-eq-hr.rs:66:53 - | -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, - | ^^^^^^^^^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:116:5 +error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied + --> $DIR/associated-types-eq-hr.rs:116:18 | LL | tuple_four::(); - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^ unsatisfied trait bound | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/associated-types-eq-hr.rs:80:8 - | -LL | fn tuple_four() -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_four` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +help: the trait `TheTrait<(&'x _, &'y _)>` is not implemented for `Tuple` + but trait `TheTrait<(&_, &_)>` is implemented for it --> $DIR/associated-types-eq-hr.rs:35:1 | LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: implementation of `TheTrait` is not general enough - --> $DIR/associated-types-eq-hr.rs:116:5 - | -LL | tuple_four::(); - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: required by a bound in `tuple_four` --> $DIR/associated-types-eq-hr.rs:80:8 | LL | fn tuple_four() LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_four` -note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - --> $DIR/associated-types-eq-hr.rs:35:1 - | -LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 12 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0271, E0308. +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-cyclic-fail-1.stderr b/tests/ui/associated-types/defaults-cyclic-fail-1.stderr index 876fdaec29632..255520c4810f4 100644 --- a/tests/ui/associated-types/defaults-cyclic-fail-1.stderr +++ b/tests/ui/associated-types/defaults-cyclic-fail-1.stderr @@ -10,6 +10,30 @@ error[E0275]: overflow evaluating the requirement `::B == _` LL | type B = &'static Self::A; | ^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0275]: overflow evaluating the requirement `::B == _` + --> $DIR/defaults-cyclic-fail-1.rs:26:5 + | +LL | type A = Box; + | ^^^^^^ + +error[E0275]: overflow evaluating whether `Box<::B>` is well-formed + --> $DIR/defaults-cyclic-fail-1.rs:26:5 + | +LL | type A = Box; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `::A == _` + --> $DIR/defaults-cyclic-fail-1.rs:32:5 + | +LL | type B = &'static Self::A; + | ^^^^^^ + +error[E0275]: overflow evaluating whether `&'static ::A` is well-formed + --> $DIR/defaults-cyclic-fail-1.rs:32:5 + | +LL | type B = &'static Self::A; + | ^^^^^^ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/defaults-cyclic-fail-2.stderr b/tests/ui/associated-types/defaults-cyclic-fail-2.stderr index ec0c9973c0a2e..5a5eed7faa0af 100644 --- a/tests/ui/associated-types/defaults-cyclic-fail-2.stderr +++ b/tests/ui/associated-types/defaults-cyclic-fail-2.stderr @@ -10,6 +10,30 @@ error[E0275]: overflow evaluating the requirement `::B == _` LL | type B = &'static Self::A; | ^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0275]: overflow evaluating the requirement `::B == _` + --> $DIR/defaults-cyclic-fail-2.rs:27:5 + | +LL | type A = Box; + | ^^^^^^ + +error[E0275]: overflow evaluating whether `Box<::B>` is well-formed + --> $DIR/defaults-cyclic-fail-2.rs:27:5 + | +LL | type A = Box; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `::A == _` + --> $DIR/defaults-cyclic-fail-2.rs:33:5 + | +LL | type B = &'static Self::A; + | ^^^^^^ + +error[E0275]: overflow evaluating whether `&'static ::A` is well-formed + --> $DIR/defaults-cyclic-fail-2.rs:33:5 + | +LL | type B = &'static Self::A; + | ^^^^^^ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/fn-ptr-coercion-normalize-ice-132767.stderr b/tests/ui/associated-types/fn-ptr-coercion-normalize-ice-132767.stderr index fb9f3d4829b8c..fc2d8bf9a7126 100644 --- a/tests/ui/associated-types/fn-ptr-coercion-normalize-ice-132767.stderr +++ b/tests/ui/associated-types/fn-ptr-coercion-normalize-ice-132767.stderr @@ -3,9 +3,6 @@ error[E0277]: the trait bound `u32: Id` is not satisfied | LL | fn bar() -> impl Copy + Id { | ^^^^^^^^^^^^^^ the trait `Id` is not implemented for `u32` -LL | -LL | 0u32 - | ---- return type was inferred to be `u32` here | help: the trait `Id` is implemented for `i32` --> $DIR/fn-ptr-coercion-normalize-ice-132767.rs:16:1 diff --git a/tests/ui/associated-types/higher-ranked-projection.bad.stderr b/tests/ui/associated-types/higher-ranked-projection.bad.stderr index 09606a1944d57..2a57a4c089cf7 100644 --- a/tests/ui/associated-types/higher-ranked-projection.bad.stderr +++ b/tests/ui/associated-types/higher-ranked-projection.bad.stderr @@ -1,17 +1,23 @@ -error[E0308]: mismatched types - --> $DIR/higher-ranked-projection.rs:23:5 +error[E0271]: type mismatch resolving `<&_ as Mirror>::Image == &_` + --> $DIR/higher-ranked-projection.rs:23:9 | LL | foo(()); - | ^^^^^^^ one type is more general than the other + | --- ^^ type mismatch resolving `<&_ as Mirror>::Image == &_` + | | + | required by a bound introduced by this call | - = note: expected reference `&'a ()` - found reference `&()` -note: the lifetime requirement is introduced here +note: types differ + --> $DIR/higher-ranked-projection.rs:9:18 + | +LL | type Image = T; + | ^ +note: required by a bound in `foo` --> $DIR/higher-ranked-projection.rs:14:33 | +LL | fn foo(_t: T) LL | where for<'a> &'a T: Mirror - | ^^^^^^^ + | ^^^^^^^ required by this bound in `foo` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-2.stderr index 2a7d75ef29bef..8ef52cc960af6 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-2.stderr @@ -1,23 +1,52 @@ -error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>` +error[E0275]: overflow evaluating the requirement `for<'b> >::U == _` --> $DIR/hr-associated-type-bound-2.rs:11:1 | LL | / impl X<'_> for u32 LL | | where LL | | for<'b> >::U: Clone, | |______________________________________^ + +error[E0275]: overflow evaluating the requirement `for<'b> >::U == _` + --> $DIR/hr-associated-type-bound-2.rs:15:5 + | +LL | type U = str; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `>::U == str` + --> $DIR/hr-associated-type-bound-2.rs:19:10 | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`) -note: required for `u32` to implement `for<'b> X<'b>` - --> $DIR/hr-associated-type-bound-2.rs:11:6 +LL | 1u32.f("abc"); + | ^ + +error[E0275]: overflow evaluating the requirement `for<'b> >::U == _` + --> $DIR/hr-associated-type-bound-2.rs:19:5 + | +LL | 1u32.f("abc"); + | ^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `for<'b> >::U: Clone` + --> $DIR/hr-associated-type-bound-2.rs:19:10 | -LL | impl X<'_> for u32 - | ^^^^^ ^^^ +LL | 1u32.f("abc"); + | ^ + | +note: required by a bound in `X::f` + --> $DIR/hr-associated-type-bound-2.rs:3:33 + | +LL | trait X<'a> LL | where LL | for<'b> >::U: Clone, - | ----- unsatisfied trait bound introduced here - = note: 128 redundant requirements hidden - = note: required for `u32` to implement `for<'b> X<'b>` + | ^^^^^ required by this bound in `X::f` +... +LL | fn f(&self, x: &Self::U) { + | + +error[E0275]: overflow evaluating the requirement `u32: X<'_>` + --> $DIR/hr-associated-type-bound-2.rs:19:10 + | +LL | 1u32.f("abc"); + | ^ -error: aborting due to 1 previous error +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.stderr b/tests/ui/associated-types/hr-associated-type-bound-object.stderr index 0a6831ad8801b..95f292a9eb75f 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-object.stderr @@ -1,3 +1,21 @@ +error[E0277]: the trait bound `for<'b> >::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-object.rs:7:32 + | +LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) { + | ^^^^^^^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `>::U` + | +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-object.rs:3:33 + | +LL | trait X<'a> +LL | where +LL | for<'b> >::U: Clone, + | ^^^^^ required by this bound in `X` +help: consider further restricting the associated type + | +LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where for<'b> >::U: Clone { + | ++++++++++++++++++++++++++++++++++++ + error[E0277]: the trait bound `for<'b> >::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-object.rs:7:13 | @@ -37,17 +55,17 @@ help: consider further restricting the associated type LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where for<'b> >::U: Clone { | ++++++++++++++++++++++++++++++++++++ -error[E0277]: the trait bound `>::U: Clone` is not satisfied +error[E0277]: the trait bound `>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-object.rs:9:6 | LL | <>::U>::clone(x); - | ^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `>::U` + | ^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `>::U` | help: consider further restricting the associated type | -LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where >::U: Clone { +LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where >::U: Clone { | ++++++++++++++++++++++++++++ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr index b1a7e8ac4062a..0d3965fa3dce2 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -30,6 +30,22 @@ LL | trait Z<'a, T: ?Sized> LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-2.rs:9:20 + | +LL | fn h(&self, x: &T::W) { + | ^^^^^ the trait `Clone` is not implemented for `str` + | +help: the trait `Clone` is implemented for `String` + --> $SRC_DIR/alloc/src/string.rs:LL:COL +note: required by a bound in `Z` + --> $DIR/hr-associated-type-bound-param-2.rs:6:35 + | +LL | trait Z<'a, T: ?Sized> +... +LL | for<'b> >::W: Clone, + | ^^^^^ required by this bound in `Z` + error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-2.rs:3:8 | @@ -85,6 +101,6 @@ LL | for<'b> >::W: Clone, LL | fn h(&self, x: &T::W) { | -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr index 1f5dda9fc0eff..06fac042b547d 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr @@ -1,14 +1,59 @@ +error[E0277]: the trait bound `for<'b> >::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-6.rs:14:14 + | +LL | type U = str; + | ^^^ the trait `for<'b> Clone` is not implemented for `>::U` + | +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-6.rs:4:33 + | +LL | trait X<'a, T> +... +LL | for<'b> >::U: Clone, + | ^^^^^ required by this bound in `X` +help: consider further restricting the associated type + | +LL | impl X<'_, T> for (S,) where for<'b> >::U: Clone { + | +++++++++++++++++++++++++++++++++++++++ + error[E0277]: the trait bound `for<'b> T: X<'b, T>` is not satisfied --> $DIR/hr-associated-type-bound-param-6.rs:12:12 | LL | impl X<'_, T> for (S,) { | ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T` | +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-6.rs:3:16 + | +LL | trait X<'a, T> +LL | where +LL | for<'b> T: X<'b, T>, + | ^^^^^^^^ required by this bound in `X` help: consider restricting type parameter `T` with trait `X` | LL | impl X<'b, T>> X<'_, T> for (S,) { | ++++++++++++++++++ +error[E0277]: the size for values of type `>::U` cannot be known at compilation time + --> $DIR/hr-associated-type-bound-param-6.rs:14:14 + | +LL | type U = str; + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `for<'b> Sized` is not implemented for `>::U` + = note: required for `>::U` to implement `for<'b> Clone` +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-param-6.rs:4:33 + | +LL | trait X<'a, T> +... +LL | for<'b> >::U: Clone, + | ^^^^^ required by this bound in `X` +help: consider further restricting the associated type + | +LL | impl X<'_, T> for (S,) where for<'b> >::U: Sized { + | +++++++++++++++++++++++++++++++++++++++ + error[E0277]: the trait bound `for<'b> i32: X<'b, i32>` is not satisfied --> $DIR/hr-associated-type-bound-param-6.rs:18:18 | @@ -43,6 +88,23 @@ help: the trait `X<'_, T>` is implemented for `(S,)` LL | impl X<'_, T> for (S,) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error[E0277]: the trait bound `for<'b> >::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-6.rs:18:18 + | +LL | <(i32,) as X>::f("abc"); + | ^^^ the trait `for<'b> Clone` is not implemented for `>::U` + | +note: required by a bound in `X::f` + --> $DIR/hr-associated-type-bound-param-6.rs:4:33 + | +LL | trait X<'a, T> +... +LL | for<'b> >::U: Clone, + | ^^^^^ required by this bound in `X::f` +... +LL | fn f(x: &>::U) { + | + error[E0277]: the trait bound `i32: X<'_, i32>` is not satisfied --> $DIR/hr-associated-type-bound-param-6.rs:18:27 | @@ -55,6 +117,6 @@ help: the trait `X<'_, T>` is implemented for `(S,)` LL | impl X<'_, T> for (S,) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/impl-trait-return-missing-constraint.stderr b/tests/ui/associated-types/impl-trait-return-missing-constraint.stderr index 2c6c8ee5d190c..38e268844f61a 100644 --- a/tests/ui/associated-types/impl-trait-return-missing-constraint.stderr +++ b/tests/ui/associated-types/impl-trait-return-missing-constraint.stderr @@ -6,9 +6,6 @@ LL | fn bar() -> impl Bar { ... LL | fn baz() -> impl Bar { | ^^^^^^^^^^^^^^^^^^^^ expected `i32`, found associated type -LL | -LL | bar() - | ----- return type was inferred to be `impl Bar` here | = note: expected type `i32` found associated type `::Item` diff --git a/tests/ui/associated-types/impl-wf-cycle-1.stderr b/tests/ui/associated-types/impl-wf-cycle-1.stderr index d642f9f0e36a7..b50d34ac2da72 100644 --- a/tests/ui/associated-types/impl-wf-cycle-1.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-1.stderr @@ -1,3 +1,13 @@ +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::B == _` + --> $DIR/impl-wf-cycle-1.rs:15:1 + | +LL | / impl Grault for (T,) +LL | | +LL | | where +LL | | Self::A: Baz, +LL | | Self::B: Fiz, + | |_________________^ + error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` --> $DIR/impl-wf-cycle-1.rs:15:1 | @@ -7,25 +17,49 @@ LL | | where LL | | Self::A: Baz, LL | | Self::B: Fiz, | |_________________^ -LL | { -LL | type A = (); - | ------ associated type `<(T,) as Grault>::A` is specified here + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::B == _` + --> $DIR/impl-wf-cycle-1.rs:21:5 | -note: required for `(T,)` to implement `Grault` - --> $DIR/impl-wf-cycle-1.rs:15:17 +LL | type A = (); + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-1.rs:21:5 + | +LL | type A = (); + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::B == _` + --> $DIR/impl-wf-cycle-1.rs:22:5 + | +LL | type B = bool; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-1.rs:22:5 | -LL | impl Grault for (T,) - | ^^^^^^ ^^^^ -... -LL | Self::A: Baz, - | --- unsatisfied trait bound introduced here - = note: 1 redundant requirement hidden - = note: required for `(T,)` to implement `Grault` -help: associated type for the current `impl` cannot be restricted in `where` clauses, remove this bound +LL | type B = bool; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `(_,): Grault` + --> $DIR/impl-wf-cycle-1.rs:26:13 | -LL - Self::A: Baz, +LL | let x: <(_,) as Grault>::A = (); + | ^^^^ + +error[E0275]: overflow evaluating the requirement `<(_,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-1.rs:26:12 + | +LL | let x: <(_,) as Grault>::A = (); + | ^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating whether `<(_,) as Grault>::A` is well-formed + --> $DIR/impl-wf-cycle-1.rs:26:12 | +LL | let x: <(_,) as Grault>::A = (); + | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/impl-wf-cycle-2.stderr b/tests/ui/associated-types/impl-wf-cycle-2.stderr index 9454d1d669792..1972c6b1da6e0 100644 --- a/tests/ui/associated-types/impl-wf-cycle-2.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-2.stderr @@ -6,24 +6,13 @@ LL | | LL | | where LL | | Self::A: Copy, | |__________________^ -LL | { -LL | type A = (); - | ------ associated type `<(T,) as Grault>::A` is specified here - | -note: required for `(T,)` to implement `Grault` - --> $DIR/impl-wf-cycle-2.rs:7:17 - | -LL | impl Grault for (T,) - | ^^^^^^ ^^^^ -... -LL | Self::A: Copy, - | ---- unsatisfied trait bound introduced here -help: associated type for the current `impl` cannot be restricted in `where` clauses, remove this bound - | -LL - where -LL - Self::A: Copy, + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-2.rs:12:5 | +LL | type A = (); + | ^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/impl-wf-cycle-3.stderr b/tests/ui/associated-types/impl-wf-cycle-3.stderr index b97117a9aab69..0ae1a6f319101 100644 --- a/tests/ui/associated-types/impl-wf-cycle-3.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-3.stderr @@ -1,28 +1,27 @@ -error[E0275]: overflow evaluating the requirement `::Type == ::Type` +error[E0277]: the trait bound `T: B` is not satisfied --> $DIR/impl-wf-cycle-3.rs:7:1 | LL | / impl B for T LL | | where LL | | T: A, - | |_____________________^ -LL | { -LL | type Type = bool; - | --------- associated type `::Type` is specified here + | |_____________________^ the trait `B` is not implemented for `T` | -note: required for `T` to implement `B` - --> $DIR/impl-wf-cycle-3.rs:7:9 +help: consider further restricting type parameter `T` with trait `B` | -LL | impl B for T - | ^ ^ -LL | where -LL | T: A, - | ------------- unsatisfied trait bound introduced here -help: replace the associated type with the type specified in this `impl` +LL | T: A + B, + | +++ + +error[E0277]: the trait bound `T: B` is not satisfied + --> $DIR/impl-wf-cycle-3.rs:11:5 + | +LL | type Type = bool; + | ^^^^^^^^^ the trait `B` is not implemented for `T` | -LL - T: A, -LL + T: A, +help: consider further restricting type parameter `T` with trait `B` | +LL | T: A + B, + | +++ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/impl-wf-cycle-5.fixed b/tests/ui/associated-types/impl-wf-cycle-5.fixed index 1c2c0811a5006..88a0b762c37bf 100644 --- a/tests/ui/associated-types/impl-wf-cycle-5.fixed +++ b/tests/ui/associated-types/impl-wf-cycle-5.fixed @@ -23,6 +23,7 @@ impl Grault for (T,) //~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` where T: Grault, + Self::A: Baz, { type A = (); type B = bool; diff --git a/tests/ui/associated-types/impl-wf-cycle-5.stderr b/tests/ui/associated-types/impl-wf-cycle-5.stderr index 61edf18b43d97..c3764fbbb3d18 100644 --- a/tests/ui/associated-types/impl-wf-cycle-5.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-5.stderr @@ -7,25 +7,37 @@ LL | | where LL | | T: Grault, LL | | Self::A: Baz, | |_________________^ -LL | { -LL | type A = (); - | ------ associated type `<(T,) as Grault>::A` is specified here + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-5.rs:28:5 + | +LL | type A = (); + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-5.rs:29:5 | -note: required for `(T,)` to implement `Grault` - --> $DIR/impl-wf-cycle-5.rs:22:9 +LL | type B = bool; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `((),): Grault` + --> $DIR/impl-wf-cycle-5.rs:33:13 | -LL | impl Grault for (T,) - | ^^^^^^ ^^^^ -... -LL | Self::A: Baz, - | --- unsatisfied trait bound introduced here -help: associated type for the current `impl` cannot be restricted in `where` clauses, remove this bound +LL | let _: <((),) as Grault>::A = (); + | ^^^^^ + +error[E0275]: overflow evaluating the requirement `<((),) as Grault>::A == _` + --> $DIR/impl-wf-cycle-5.rs:33:12 | -LL - T: Grault, -LL - Self::A: Baz, -LL + T: Grault, +LL | let _: <((),) as Grault>::A = (); + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating whether `<((),) as Grault>::A` is well-formed + --> $DIR/impl-wf-cycle-5.rs:33:12 | +LL | let _: <((),) as Grault>::A = (); + | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/impl-wf-cycle-6.fixed b/tests/ui/associated-types/impl-wf-cycle-6.fixed index ce98b9c2f02a5..a05ffcd6b4c3e 100644 --- a/tests/ui/associated-types/impl-wf-cycle-6.fixed +++ b/tests/ui/associated-types/impl-wf-cycle-6.fixed @@ -21,6 +21,8 @@ impl Grault for () { impl Grault for (T,) //~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` +where + Self::A: Baz, { type A = (); type B = bool; diff --git a/tests/ui/associated-types/impl-wf-cycle-6.stderr b/tests/ui/associated-types/impl-wf-cycle-6.stderr index 1c7495033183f..2c28a5998b0b2 100644 --- a/tests/ui/associated-types/impl-wf-cycle-6.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-6.stderr @@ -6,24 +6,37 @@ LL | | LL | | where LL | | Self::A: Baz, | |_________________^ -LL | { -LL | type A = (); - | ------ associated type `<(T,) as Grault>::A` is specified here + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-6.rs:27:5 + | +LL | type A = (); + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` + --> $DIR/impl-wf-cycle-6.rs:28:5 | -note: required for `(T,)` to implement `Grault` - --> $DIR/impl-wf-cycle-6.rs:22:17 +LL | type B = bool; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `((),): Grault` + --> $DIR/impl-wf-cycle-6.rs:32:13 | -LL | impl Grault for (T,) - | ^^^^^^ ^^^^ -... -LL | Self::A: Baz, - | --- unsatisfied trait bound introduced here -help: associated type for the current `impl` cannot be restricted in `where` clauses, remove this bound +LL | let _: <((),) as Grault>::A = (); + | ^^^^^ + +error[E0275]: overflow evaluating the requirement `<((),) as Grault>::A == _` + --> $DIR/impl-wf-cycle-6.rs:32:12 | -LL - where -LL - Self::A: Baz, +LL | let _: <((),) as Grault>::A = (); + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating whether `<((),) as Grault>::A` is well-formed + --> $DIR/impl-wf-cycle-6.rs:32:12 | +LL | let _: <((),) as Grault>::A = (); + | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/issue-20005.stderr b/tests/ui/associated-types/issue-20005.stderr index 1600227c82da9..c75a6fc6edfde 100644 --- a/tests/ui/associated-types/issue-20005.stderr +++ b/tests/ui/associated-types/issue-20005.stderr @@ -1,3 +1,23 @@ +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-20005.rs:10:10 + | +LL | ) -> >::Result where Dst: From { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `From` + --> $DIR/issue-20005.rs:1:12 + | +LL | trait From { + | ^^^ required by the implicit `Sized` requirement on this type parameter in `From` +help: consider further restricting `Self` + | +LL | ) -> >::Result where Dst: From, Self: Sized { + | +++++++++++++ +help: consider relaxing the implicit `Sized` restriction + | +LL | trait From { + | ++++++++ + error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-20005.rs:10:49 | @@ -54,6 +74,6 @@ help: consider relaxing the implicit `Sized` restriction LL | trait From { | ++++++++ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr b/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr index 0815bdce16fc3..d6e7a7cbd8cb4 100644 --- a/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr +++ b/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr @@ -1,9 +1,10 @@ -error[E0277]: the trait bound `T: Copy` is not satisfied +error[E0277]: the trait bound `T: Copy` is not satisfied in `dyn Setup` --> $DIR/issue-27675-unchecked-bounds.rs:15:12 | LL | copy::>(t) - | ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^ within `dyn Setup`, the trait `Copy` is not implemented for `T` | + = note: required because it appears within the type `dyn Setup` note: required by a bound in `copy` --> $DIR/issue-27675-unchecked-bounds.rs:10:12 | @@ -14,6 +15,30 @@ help: consider restricting type parameter `T` with trait `Copy` LL | pub fn copy_any(t: &T) -> T { | +++++++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `T: Copy` is not satisfied in `dyn Setup` + --> $DIR/issue-27675-unchecked-bounds.rs:15:31 + | +LL | copy::>(t) + | ^ within `dyn Setup`, the trait `Copy` is not implemented for `T` + | + = note: required because it appears within the type `dyn Setup` +help: consider restricting type parameter `T` with trait `Copy` + | +LL | pub fn copy_any(t: &T) -> T { + | +++++++++++++++++++ + +error[E0277]: the trait bound `T: Copy` is not satisfied in `dyn Setup` + --> $DIR/issue-27675-unchecked-bounds.rs:15:5 + | +LL | copy::>(t) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `dyn Setup`, the trait `Copy` is not implemented for `T` + | + = note: required because it appears within the type `dyn Setup` +help: consider restricting type parameter `T` with trait `Copy` + | +LL | pub fn copy_any(t: &T) -> T { + | +++++++++++++++++++ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index 19f813156da5b..266352442243c 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -16,24 +16,6 @@ help: consider extending the `where` clause, but there might be an alternative b LL | Expr: Expression::Nullable>, ::SqlType: NotNull | +++++++++++++++++++++++++++++++++++++ -error[E0277]: the trait bound `::SqlType: IntoNullable` is not satisfied - --> $DIR/issue-38821.rs:41:22 - | -LL | Expr: Expression::Nullable>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here -help: consider extending the `where` clause, but there might be an alternative better way to express this requirement - | -LL | Expr: Expression::Nullable>, ::SqlType: NotNull - | +++++++++++++++++++++++++++++++++++++ - error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:10 | @@ -81,53 +63,6 @@ LL | impl IntoNullable for T { | unsatisfied trait bound introduced here = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:23:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:35:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -... -LL | pub enum ColumnInsertValue where - | ^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `ColumnInsertValue` to implement `Debug` - --> $DIR/issue-38821.rs:35:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -... -LL | pub enum ColumnInsertValue where - | ^^^^^^^^^^^^^^^^^ -... -LL | Expr: Expression::Nullable>, - | ------------------------------------------------ unsatisfied trait bound -help: consider further restricting the associated type - | -LL | Expr: Expression::Nullable>, ::SqlType: NotNull, - | +++++++++++++++++++++++++++++++++++++++ - error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:17 | @@ -146,38 +81,6 @@ help: consider further restricting the associated type LL | Expr: Expression::Nullable>, ::SqlType: NotNull, | +++++++++++++++++++++++++++++++++++++++ -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:35:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ---- in this derive macro expansion -... -LL | pub enum ColumnInsertValue where - | ^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `ColumnInsertValue` to implement `Copy` - --> $DIR/issue-38821.rs:35:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ---- in this derive macro expansion -... -LL | pub enum ColumnInsertValue where - | ^^^^^^^^^^^^^^^^^ -... -LL | Expr: Expression::Nullable>, - | ------------------------------------------------ unsatisfied trait bound -help: consider further restricting the associated type - | -LL | Expr: Expression::Nullable>, ::SqlType: NotNull, - | +++++++++++++++++++++++++++++++++++++++ - error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:23 | @@ -225,117 +128,6 @@ LL | impl IntoNullable for T { | unsatisfied trait bound introduced here = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:23:23 - | -LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:35:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -... -LL | pub enum ColumnInsertValue where - | ^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `ColumnInsertValue` to implement `Clone` - --> $DIR/issue-38821.rs:35:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -... -LL | pub enum ColumnInsertValue where - | ^^^^^^^^^^^^^^^^^ -... -LL | Expr: Expression::Nullable>, - | ------------------------------------------------ unsatisfied trait bound -help: consider further restricting the associated type - | -LL | Expr: Expression::Nullable>, ::SqlType: NotNull, - | +++++++++++++++++++++++++++++++++++++++ - -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:23:10 - | -LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:23:23 - | -LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:44:5 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -... -LL | Expression(Col, Expr), - | ^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:44:5 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -... -LL | Expression(Col, Expr), - | ^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `::SqlType` - | -note: required for `::SqlType` to implement `IntoNullable` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ------- ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - -error: aborting due to 18 previous errors +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-64855-2.stderr b/tests/ui/associated-types/issue-64855-2.stderr index 75da64505916b..c24aa52546257 100644 --- a/tests/ui/associated-types/issue-64855-2.stderr +++ b/tests/ui/associated-types/issue-64855-2.stderr @@ -1,3 +1,9 @@ +error[E0275]: overflow evaluating whether `&'a Bar<'a>` is well-formed + --> $DIR/issue-64855-2.rs:5:20 + | +LL | pub struct Bar<'a>(&'a Self) where Self: ; + | ^^^^^^^^ + error[E0275]: overflow evaluating whether `Bar<'a>` is well-formed --> $DIR/issue-64855-2.rs:5:36 | @@ -10,6 +16,6 @@ note: required by a bound in `Bar` LL | pub struct Bar<'a>(&'a Self) where Self: ; | ^^^^ required by this bound in `Bar` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/issue-64855.stderr b/tests/ui/associated-types/issue-64855.stderr index 9472dbf6adb60..6e8b6f2e23090 100644 --- a/tests/ui/associated-types/issue-64855.stderr +++ b/tests/ui/associated-types/issue-64855.stderr @@ -15,19 +15,6 @@ help: this trait has no implementations, consider adding one LL | pub trait Foo { | ^^^^^^^^^^^^^ -error[E0275]: overflow evaluating whether `Bar` is well-formed - --> $DIR/issue-64855.rs:9:46 - | -LL | pub struct Bar(::Type) where Self: ; - | ^^^^ - | -note: required by a bound in `Bar` - --> $DIR/issue-64855.rs:9:46 - | -LL | pub struct Bar(::Type) where Self: ; - | ^^^^ required by this bound in `Bar` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0275, E0277. -For more information about an error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-65774-1.stderr b/tests/ui/associated-types/issue-65774-1.stderr index 151e0bd1b4679..4fe7f08952722 100644 --- a/tests/ui/associated-types/issue-65774-1.stderr +++ b/tests/ui/associated-types/issue-65774-1.stderr @@ -21,7 +21,7 @@ LL | trait MPU { LL | type MpuConfig: MyDisplay = T; | ^^^^^^^^^ required by this bound in `MPU::MpuConfig` -error[E0277]: the trait bound `T: MyDisplay` is not satisfied +error[E0277]: the trait bound `&&mut T: CoerceUnsized<&dyn MyDisplay>` is not satisfied --> $DIR/issue-65774-1.rs:44:76 | LL | let closure = |config: &mut ::MpuConfig| writer.my_write(&config); @@ -44,6 +44,8 @@ LL | impl<'a, T: MyDisplay> MyDisplay for &'a mut T { } | --------- ^^^^^^^^^ ^^^^^^^^^ | | | unsatisfied trait bound introduced here + = note: required because it appears within the type `&mut T` + = note: required for `&&mut T` to implement `CoerceUnsized<&dyn MyDisplay>` = note: required for the cast from `&&mut T` to `&dyn MyDisplay` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-types/issue-65774-2.stderr b/tests/ui/associated-types/issue-65774-2.stderr index 2a93b1944dff9..aae59cebc8725 100644 --- a/tests/ui/associated-types/issue-65774-2.stderr +++ b/tests/ui/associated-types/issue-65774-2.stderr @@ -21,13 +21,13 @@ LL | trait MPU { LL | type MpuConfig: MyDisplay = T; | ^^^^^^^^^ required by this bound in `MPU::MpuConfig` -error[E0277]: the trait bound `T: MyDisplay` is not satisfied +error[E0277]: the trait bound `&T: CoerceUnsized<&dyn MyDisplay>` is not satisfied in `T` --> $DIR/issue-65774-2.rs:39:25 | LL | writer.my_write(valref) | ^^^^^^ unsatisfied trait bound | -help: the trait `MyDisplay` is not implemented for `T` +help: within `T`, the trait `MyDisplay` is not implemented for `T` --> $DIR/issue-65774-2.rs:7:1 | LL | struct T; @@ -37,6 +37,12 @@ help: the trait `MyDisplay` is implemented for `&'a mut T` | LL | impl<'a, T: MyDisplay> MyDisplay for &'a mut T { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `T` + --> $DIR/issue-65774-2.rs:7:8 + | +LL | struct T; + | ^ + = note: required for `&T` to implement `CoerceUnsized<&dyn MyDisplay>` = note: required for the cast from `&mut T` to `&dyn MyDisplay` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-types/mismatched-types-in-trait-impl-65230.stderr b/tests/ui/associated-types/mismatched-types-in-trait-impl-65230.stderr index c34685aacad5c..9373b62c6aeb2 100644 --- a/tests/ui/associated-types/mismatched-types-in-trait-impl-65230.stderr +++ b/tests/ui/associated-types/mismatched-types-in-trait-impl-65230.stderr @@ -1,18 +1,16 @@ -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/mismatched-types-in-trait-impl-65230.rs:9:13 | LL | impl T1 for &dyn T2 {} - | ^^^^^^^ lifetime mismatch + | ^^^^^^^ | - = note: expected trait `<&dyn T2 as T0>` - found trait `<&(dyn T2 + 'static) as T0>` -note: the anonymous lifetime as defined here... +note: lifetime parameter instantiated with the anonymous lifetime as defined here --> $DIR/mismatched-types-in-trait-impl-65230.rs:9:13 | LL | impl T1 for &dyn T2 {} | ^ - = note: ...does not necessarily outlive the static lifetime + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/associated-types/nested-assoc-type-projection-ice-109864.stderr b/tests/ui/associated-types/nested-assoc-type-projection-ice-109864.stderr index fdf55aa4c2bdb..5e4706acb9e61 100644 --- a/tests/ui/associated-types/nested-assoc-type-projection-ice-109864.stderr +++ b/tests/ui/associated-types/nested-assoc-type-projection-ice-109864.stderr @@ -7,34 +7,17 @@ LL | struct S2

(); = help: consider removing `P`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `P` to be a const parameter, use `const P: /* Type */` instead -error[E0277]: the trait bound `>::Out: Qux` is not satisfied - --> $DIR/nested-assoc-type-projection-ice-109864.rs:29:16 - | -LL | type Out = <>::Out as Bar< - | ________________^ -... | -LL | | >>::Out; - | |___________^ the trait `Qux` is not implemented for `>::Out` - | -help: consider further restricting the associated type - | -LL | impl, B> Fuzz> for S2 where >::Out: Qux { - | ++++++++++++++++++++++++++++++++ - -error[E0277]: the trait bound `>::Out: Bar, _>` is not satisfied +error[E0271]: type mismatch resolving ` as Fuzz>>::Out == _` --> $DIR/nested-assoc-type-projection-ice-109864.rs:29:16 | LL | type Out = <>::Out as Bar< | ________________^ ... | LL | | >>::Out; - | |___________^ the trait `Bar, _>` is not implemented for `>::Out` - | -help: this trait has no implementations, consider adding one - --> $DIR/nested-assoc-type-projection-ice-109864.rs:16:1 - | -LL | trait Bar { - | ^^^^^^^^^^^^^^^ + | | ^ + | | | + | |___________types differ + | type mismatch resolving ` as Fuzz>>::Out == _` error[E0277]: the trait bound `>::Out: Qux` is not satisfied --> $DIR/nested-assoc-type-projection-ice-109864.rs:34:10 @@ -47,19 +30,16 @@ help: consider further restricting the associated type LL | impl, B> Fuzz> for S2 where >::Out: Qux { | ++++++++++++++++++++++++++++++++ -error[E0277]: the trait bound `>::Out: Bar, _>` is not satisfied - --> $DIR/nested-assoc-type-projection-ice-109864.rs:29:5 - | -LL | type Out = <>::Out as Bar< - | ^^^^^^^^ the trait `Bar, _>` is not implemented for `>::Out` - | -help: this trait has no implementations, consider adding one - --> $DIR/nested-assoc-type-projection-ice-109864.rs:16:1 +error: the type `<>::Out as Bar, <<>::Out as Qux>::Out as Fuzz>>::Out>>::Out` is not well-formed + --> $DIR/nested-assoc-type-projection-ice-109864.rs:29:16 | -LL | trait Bar { - | ^^^^^^^^^^^^^^^ +LL | type Out = <>::Out as Bar< + | ________________^ +... | +LL | | >>::Out; + | |___________^ -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0277, E0392. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277, E0392. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-types/normalization-ice-issue-149746.stderr b/tests/ui/associated-types/normalization-ice-issue-149746.stderr index ae6f6bbbb52c9..865fb9a91e2d3 100644 --- a/tests/ui/associated-types/normalization-ice-issue-149746.stderr +++ b/tests/ui/associated-types/normalization-ice-issue-149746.stderr @@ -1,3 +1,15 @@ +error[E0271]: type mismatch resolving `<() as Owner>::Ty == _` + --> $DIR/normalization-ice-issue-149746.rs:6:24 + | +LL | _significant_drop: <() as Owner>::Ty, + | ^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Owner>::Ty == _` + | +note: types differ + --> $DIR/normalization-ice-issue-149746.rs:4:43 + | +LL | impl Owner for () { type Ty = T; } + | ^ + error[E0277]: expected an `FnMut()` closure, found `T` --> $DIR/normalization-ice-issue-149746.rs:6:24 | @@ -35,46 +47,44 @@ help: add a dummy let to cause `w` to be fully captured LL | _ = || { let _ = &w; w.field } | +++++++++++++ + -error[E0277]: expected an `FnMut()` closure, found `T` +error[E0271]: type mismatch resolving `<() as Owner>::Ty == _` --> $DIR/normalization-ice-issue-149746.rs:12:9 | LL | _ = || w.field - | ^^^^^^^^^^ expected an `FnMut()` closure, found `T` + | ^^^^^^^^^^ type mismatch resolving `<() as Owner>::Ty == _` | - = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` -note: required by a bound in `Owner::Ty` - --> $DIR/normalization-ice-issue-149746.rs:3:26 +note: types differ + --> $DIR/normalization-ice-issue-149746.rs:4:43 | -LL | trait Owner { type Ty; } - | ^^^^^^^ required by this bound in `Owner::Ty` +LL | impl Owner for () { type Ty = T; } + | ^ -error[E0277]: expected an `FnMut()` closure, found `T` +error[E0271]: type mismatch resolving `<() as Owner>::Ty == _` --> $DIR/normalization-ice-issue-149746.rs:10:16 | LL | pub fn test(w: Warns) { - | ^ expected an `FnMut()` closure, found `T` + | ^ type mismatch resolving `<() as Owner>::Ty == _` | - = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` -note: required by a bound in `Owner::Ty` - --> $DIR/normalization-ice-issue-149746.rs:3:26 +note: types differ + --> $DIR/normalization-ice-issue-149746.rs:4:43 | -LL | trait Owner { type Ty; } - | ^^^^^^^ required by this bound in `Owner::Ty` +LL | impl Owner for () { type Ty = T; } + | ^ -error[E0277]: expected an `FnMut()` closure, found `T` +error[E0271]: type mismatch resolving `<() as Owner>::Ty == _` --> $DIR/normalization-ice-issue-149746.rs:12:9 | LL | _ = || w.field - | ^^^^^^^^^^ expected an `FnMut()` closure, found `T` + | ^^^^^^^^^^ type mismatch resolving `<() as Owner>::Ty == _` | - = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` -note: required by a bound in `Owner::Ty` - --> $DIR/normalization-ice-issue-149746.rs:3:26 +note: types differ + --> $DIR/normalization-ice-issue-149746.rs:4:43 | -LL | trait Owner { type Ty; } - | ^^^^^^^ required by this bound in `Owner::Ty` +LL | impl Owner for () { type Ty = T; } + | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 5 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-types/projection-dyn-associated-type.stderr b/tests/ui/associated-types/projection-dyn-associated-type.stderr index 58eb8cff163db..931ca97e39e29 100644 --- a/tests/ui/associated-types/projection-dyn-associated-type.stderr +++ b/tests/ui/associated-types/projection-dyn-associated-type.stderr @@ -41,6 +41,12 @@ help: the trait `Mirror` is implemented for `dyn A` LL | impl Mirror for A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: the type `&'a <(dyn B + 'static) as Mirror>::Assoc` is not well-formed + --> $DIR/projection-dyn-associated-type.rs:23:6 + | +LL | ) -> &'a ::Assoc { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0277]: the trait bound `(dyn B + 'static): Mirror` is not satisfied --> $DIR/projection-dyn-associated-type.rs:23:6 | @@ -54,7 +60,7 @@ LL | impl Mirror for A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 5 previous errors; 1 warning emitted Some errors have detailed explanations: E0207, E0277. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/associated-types/recursive-associated-type-overflow-21946.stderr b/tests/ui/associated-types/recursive-associated-type-overflow-21946.stderr index 37fb0ed7eb882..c4e4371f5e493 100644 --- a/tests/ui/associated-types/recursive-associated-type-overflow-21946.stderr +++ b/tests/ui/associated-types/recursive-associated-type-overflow-21946.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement `::A == _` LL | type A = ::A; | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `::A == _` + --> $DIR/recursive-associated-type-overflow-21946.rs:9:5 + | +LL | type A = ::A; + | ^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.stderr b/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.stderr index 8d5cad4493e85..53ef5fbef0c1b 100644 --- a/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.stderr +++ b/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.stderr @@ -9,6 +9,37 @@ LL | | F: FnMut(); LL | F: FnMut() + Send, | ^^^^ impl has extra requirement `F: Send` -error: aborting due to 1 previous error +error: future cannot be sent between threads safely + --> $DIR/remove-invalid-type-bound-suggest-issue-127555.rs:13:45 + | +LL | async fn bar(&mut self, _func: F) -> () + | ^^ future returned by `bar` is not `Send` + | +note: captured value is not `Send` + --> $DIR/remove-invalid-type-bound-suggest-issue-127555.rs:13:32 + | +LL | async fn bar(&mut self, _func: F) -> () + | ^^^^^ has type `F` which is not `Send` +note: required by a bound in `Foo::bar::{anon_assoc#0}` + --> $DIR/remove-invalid-type-bound-suggest-issue-127555.rs:5:78 + | +LL | pub trait Foo { +LL | fn bar(&mut self, func: F) -> impl std::future::Future + Send + | ^^^^ required by this bound in `Foo::bar::{anon_assoc#0}` + +error[E0276]: impl has stricter requirements than trait + --> $DIR/remove-invalid-type-bound-suggest-issue-127555.rs:15:22 + | +LL | / fn bar(&mut self, func: F) -> impl std::future::Future + Send +LL | | where +LL | | F: FnMut(); + | |___________________- definition of `bar` from trait +... +LL | F: FnMut() + Send, + | ^^^^ impl has extra requirement `F: Send` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0276`. diff --git a/tests/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr b/tests/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr index 8154441411323..0d40def9319d7 100644 --- a/tests/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr +++ b/tests/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr @@ -11,6 +11,97 @@ help: consider further restricting `Self` LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} | +++++++ -error: aborting due to 1 previous error +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/trait-with-supertraits-needing-sized-self.rs:3:26 + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div {} + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Add` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: consider further restricting `Self` + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} + | +++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/trait-with-supertraits-needing-sized-self.rs:3:41 + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div {} + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Sub` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: consider further restricting `Self` + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} + | +++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/trait-with-supertraits-needing-sized-self.rs:3:45 + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div {} + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Sub` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: consider further restricting `Self` + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} + | +++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/trait-with-supertraits-needing-sized-self.rs:3:60 + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div {} + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Mul` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: consider further restricting `Self` + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} + | +++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/trait-with-supertraits-needing-sized-self.rs:3:64 + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div {} + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Mul` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: consider further restricting `Self` + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} + | +++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/trait-with-supertraits-needing-sized-self.rs:3:79 + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div {} + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Div` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: consider further restricting `Self` + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} + | +++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/trait-with-supertraits-needing-sized-self.rs:3:83 + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div {} + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Div` + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL +help: consider further restricting `Self` + | +LL | trait ArithmeticOps: Add + Sub + Mul + Div + Sized {} + | +++++++ + +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr index 5a379cc83447c..31472ac781087 100644 --- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -16,6 +16,12 @@ error[E0271]: expected `{async block@async-block-control-flow-static-semantics.r LL | let _: &dyn Future = █ | ^^^^^^ expected `()`, found `u8` | +note: required because it's used within this `async` block + --> $DIR/async-block-control-flow-static-semantics.rs:23:17 + | +LL | let block = async { + | ^^^^^ + = note: required for `&{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 23:22}` to implement `CoerceUnsized<&dyn Future>` = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 23:22}` to `&dyn Future` error[E0308]: mismatched types @@ -32,6 +38,12 @@ error[E0271]: expected `{async block@async-block-control-flow-static-semantics.r LL | let _: &dyn Future = █ | ^^^^^^ expected `()`, found `u8` | +note: required because it's used within this `async` block + --> $DIR/async-block-control-flow-static-semantics.rs:14:17 + | +LL | let block = async { + | ^^^^^ + = note: required for `&{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 14:22}` to implement `CoerceUnsized<&dyn Future>` = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 14:22}` to `&dyn Future` error[E0267]: `break` inside `async` block diff --git a/tests/ui/async-await/async-borrowck-escaping-block-error.fixed b/tests/ui/async-await/async-borrowck-escaping-block-error.fixed index 0b926bcb28681..bf065ca380648 100644 --- a/tests/ui/async-await/async-borrowck-escaping-block-error.fixed +++ b/tests/ui/async-await/async-borrowck-escaping-block-error.fixed @@ -3,7 +3,7 @@ fn test_boxed() -> Box> { let x = 0u32; - Box::new(async move { x } ) + Box::new(async { x } ) //~^ ERROR E0373 } diff --git a/tests/ui/async-await/async-borrowck-escaping-block-error.stderr b/tests/ui/async-await/async-borrowck-escaping-block-error.stderr index 6ea03c99aa0e8..d2e208b9169c7 100644 --- a/tests/ui/async-await/async-borrowck-escaping-block-error.stderr +++ b/tests/ui/async-await/async-borrowck-escaping-block-error.stderr @@ -1,16 +1,17 @@ -error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-borrowck-escaping-block-error.rs:6:14 +error[E0597]: `x` does not live long enough + --> $DIR/async-borrowck-escaping-block-error.rs:6:22 | +LL | let x = 0u32; + | - binding `x` declared here LL | Box::new(async { x } ) - | ^^^^^ - `x` is borrowed here + | ----- ^ borrowed value does not live long enough | | - | may outlive borrowed value `x` - | - = note: async blocks are not executed immediately and must either take a reference or ownership of outside variables they use -help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | Box::new(async move { x } ) - | ++++ + | value captured here by coroutine +LL | +LL | } + | -- borrow later used here + | | + | `x` dropped here while still borrowed error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function --> $DIR/async-borrowck-escaping-block-error.rs:11:5 @@ -32,4 +33,5 @@ LL | async move { *x } error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0373`. +Some errors have detailed explanations: E0373, E0597. +For more information about an error, try `rustc --explain E0373`. diff --git a/tests/ui/async-await/async-closures/async-future-out-must-be-sized.stderr b/tests/ui/async-await/async-closures/async-future-out-must-be-sized.stderr index 1168a854f5d32..fb3552259be9b 100644 --- a/tests/ui/async-await/async-closures/async-future-out-must-be-sized.stderr +++ b/tests/ui/async-await/async-closures/async-future-out-must-be-sized.stderr @@ -6,7 +6,7 @@ LL | is_async_fn(foo()); | | | required by a bound introduced by this call | - = help: the trait `Sized` is not implemented for `dyn Future` + = help: within `fn() -> dyn Future`, the trait `Sized` is not implemented for `dyn Future` note: required by a bound in `is_async_fn` --> $DIR/async-future-out-must-be-sized.rs:12:30 | diff --git a/tests/ui/async-await/async-closures/kind-due-to-rpit.stderr b/tests/ui/async-await/async-closures/kind-due-to-rpit.stderr index 982cc50e14f97..997fe5aa8ecce 100644 --- a/tests/ui/async-await/async-closures/kind-due-to-rpit.stderr +++ b/tests/ui/async-await/async-closures/kind-due-to-rpit.stderr @@ -8,9 +8,6 @@ LL | let inner_fn = async move || { LL | LL | let _ = foo.into(); | --- closure is `AsyncFnOnce` because it moves the variable `foo` out of its environment -LL | }; -LL | inner_fn - | -------- return type was inferred to be `{async closure@$DIR/kind-due-to-rpit.rs:7:20: 7:33}` here error: aborting due to 1 previous error diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr index 4aae9807dd2e4..2e32d23b09882 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr @@ -28,12 +28,6 @@ LL | outlives::<'a>(c()); LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed - | -note: requirement that the value outlives `'a` introduced here - --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 - | -LL | fn outlives<'a>(_: impl Sized + 'a) {} - | ^^ error[E0597]: `x` does not live long enough --> $DIR/without-precise-captures-we-are-powerless.rs:26:13 @@ -79,12 +73,6 @@ LL | outlives::<'a>(c()); LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed - | -note: requirement that the value outlives `'a` introduced here - --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 - | -LL | fn outlives<'a>(_: impl Sized + 'a) {} - | ^^ error[E0505]: cannot move out of `c` because it is borrowed --> $DIR/without-precise-captures-we-are-powerless.rs:32:30 @@ -101,12 +89,6 @@ LL | outlives::<'a>(c()); | argument requires that `c` is borrowed for `'a` LL | outlives::<'a>(call_once(c)); | ^ move out of `c` occurs here - | -note: requirement that the value outlives `'a` introduced here - --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 - | -LL | fn outlives<'a>(_: impl Sized + 'a) {} - | ^^ error[E0597]: `x` does not live long enough --> $DIR/without-precise-captures-we-are-powerless.rs:36:13 @@ -147,12 +129,6 @@ LL | outlives::<'a>(c()); LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed - | -note: requirement that the value outlives `'a` introduced here - --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 - | -LL | fn outlives<'a>(_: impl Sized + 'a) {} - | ^^ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/without-precise-captures-we-are-powerless.rs:44:5 @@ -195,12 +171,6 @@ LL | T.outlives::<'a>(c()); LL | T.outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed - | -note: requirement that the value outlives `'a` introduced here - --> $DIR/without-precise-captures-we-are-powerless.rs:49:47 - | -LL | fn outlives<'a>(&'a self, _: impl Sized + 'a) {} - | ^^ error: aborting due to 12 previous errors diff --git a/tests/ui/async-await/async-drop/open-drop-error2.stderr b/tests/ui/async-await/async-drop/open-drop-error2.stderr index 2f2a92d33e2c0..8fe7242aebb56 100644 --- a/tests/ui/async-await/async-drop/open-drop-error2.stderr +++ b/tests/ui/async-await/async-drop/open-drop-error2.stderr @@ -3,16 +3,8 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t | LL | fn wrong() -> impl Sized { | ^^^^^^^^^^ doesn't have a size known at compile-time -LL | -LL | *"abc" // Doesn't implement Sized - | ------ return type was inferred to be `str` here | = help: the trait `Sized` is not implemented for `str` -help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression - | -LL - *"abc" // Doesn't implement Sized -LL + "abc" // Doesn't implement Sized - | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/async-error-span.stderr b/tests/ui/async-await/async-error-span.stderr index c5a2ecb57b80f..e74afa265e32f 100644 --- a/tests/ui/async-await/async-error-span.stderr +++ b/tests/ui/async-await/async-error-span.stderr @@ -3,9 +3,6 @@ error[E0277]: `!` is not a future | LL | fn get_future() -> impl Future { | ^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not a future -LL | -LL | panic!() - | -------- return type was inferred to be `_` here | = help: the trait `Future` is not implemented for `!` diff --git a/tests/ui/async-await/async-fn/closure-arg-type-mismatch.stderr b/tests/ui/async-await/async-fn/closure-arg-type-mismatch.stderr index a3b47bb448d17..9e4251c94073d 100644 --- a/tests/ui/async-await/async-fn/closure-arg-type-mismatch.stderr +++ b/tests/ui/async-await/async-fn/closure-arg-type-mismatch.stderr @@ -1,24 +1,22 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:7:5 +error[E0277]: the trait bound `for<'a> {closure@$DIR/closure-arg-type-mismatch.rs:7:9: 7:17}: AsyncFn(&'a mut i32)` is not satisfied + --> $DIR/closure-arg-type-mismatch.rs:7:9 | LL | foo(|_: i32| async {}); - | ^^^^--------^^^^^^^^^^ - | | | - | | found signature defined here - | expected due to this + | --- ^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'a> fn(&'a mut _) -> _` - found closure signature `fn(_) -> _` +help: the trait `for<'a> AsyncFn(&'a mut i32)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch.rs:7:9: 7:17}` + --> $DIR/closure-arg-type-mismatch.rs:7:9 + | +LL | foo(|_: i32| async {}); + | ^^^^^^^^ note: required by a bound in `foo` --> $DIR/closure-arg-type-mismatch.rs:4:16 | LL | fn foo(_: impl AsyncFn(&mut i32)) {} | ^^^^^^^^^^^^^^^^^ required by this bound in `foo` -help: consider adjusting the signature so it borrows its argument - | -LL | foo(|_: &mut i32| async {}); - | ++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-gen-move-suggestion.fixed b/tests/ui/async-await/async-gen-move-suggestion.fixed index d802076552895..825fb0fd1898c 100644 --- a/tests/ui/async-await/async-gen-move-suggestion.fixed +++ b/tests/ui/async-await/async-gen-move-suggestion.fixed @@ -14,7 +14,7 @@ use std::async_iter::AsyncIterator; fn moved() -> impl AsyncIterator { let mut x = "foo".to_string(); - async gen move { //~ ERROR + async gen { //~ ERROR x.clear(); for x in 3..6 { yield x } } @@ -25,7 +25,7 @@ fn check_with_whitespace_chars() -> impl AsyncIterator { let mut x = "foo".to_string(); async // Just to check that whitespace characters are correctly handled - gen move { //~^ ERROR + gen { //~^ ERROR x.clear(); for x in 3..6 { yield x } } diff --git a/tests/ui/async-await/async-gen-move-suggestion.stderr b/tests/ui/async-await/async-gen-move-suggestion.stderr index b8cdb8be7a4ae..6c9f44fcdcd10 100644 --- a/tests/ui/async-await/async-gen-move-suggestion.stderr +++ b/tests/ui/async-await/async-gen-move-suggestion.stderr @@ -1,47 +1,36 @@ -error[E0373]: async gen block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-gen-move-suggestion.rs:17:5 +error[E0597]: `x` does not live long enough + --> $DIR/async-gen-move-suggestion.rs:18:9 | +LL | let mut x = "foo".to_string(); + | ----- binding `x` declared here +LL | LL | async gen { - | ^^^^^^^^^ may outlive borrowed value `x` + | --------- value captured here by coroutine LL | x.clear(); - | - `x` is borrowed here - | -note: async gen block is returned here - --> $DIR/async-gen-move-suggestion.rs:17:5 - | -LL | / async gen { -LL | | x.clear(); -LL | | for x in 3..6 { yield x } -LL | | } - | |_____^ -help: to force the async gen block to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | async gen move { - | ++++ + | ^ borrowed value does not live long enough +... +LL | } + | -- borrow later used here + | | + | `x` dropped here while still borrowed -error[E0373]: async gen block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-gen-move-suggestion.rs:27:5 +error[E0597]: `x` does not live long enough + --> $DIR/async-gen-move-suggestion.rs:29:9 | +LL | let mut x = "foo".to_string(); + | ----- binding `x` declared here +LL | LL | / async // Just to check that whitespace characters are correctly handled LL | | gen { - | |_______^ may outlive borrowed value `x` + | |_______- value captured here by coroutine LL | x.clear(); - | - `x` is borrowed here - | -note: async gen block is returned here - --> $DIR/async-gen-move-suggestion.rs:27:5 - | -LL | / async // Just to check that whitespace characters are correctly handled -LL | | gen { -LL | | x.clear(); -LL | | for x in 3..6 { yield x } -LL | | } - | |_____^ -help: to force the async gen block to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | gen move { - | ++++ + | ^ borrowed value does not live long enough +... +LL | } + | -- borrow later used here + | | + | `x` dropped here while still borrowed error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr b/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr index 3bdb318678d92..c8451c5a09c36 100644 --- a/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr +++ b/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr @@ -1,21 +1,10 @@ -error: implementation of `Send` is not general enough +error: higher-ranked lifetime error --> $DIR/coroutine-auto-trait-span-issue-155880.rs:28:5 | -LL | async fn inner<'a, T: Trait + 'a>(_: T, x: T::Assoc<'a>) -> T::Assoc<'a> { - | __________________________________________________________________________- -LL | | std::future::ready(x).await -LL | | } - | |_- this async fn captures a value whose type is not `Send` -... -LL | is_send(outer()) - | ^^^^^^^^^^^^^^^^ +LL | is_send(outer()) + | ^^^^^^^^^^^^^^^^ | -note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... - --> $DIR/coroutine-auto-trait-span-issue-155880.rs:25:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` + = note: could not prove `impl Future: Send` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/coroutine-desc.stderr b/tests/ui/async-await/coroutine-desc.stderr index 84a1a3166ad64..9f9c8df686e97 100644 --- a/tests/ui/async-await/coroutine-desc.stderr +++ b/tests/ui/async-await/coroutine-desc.stderr @@ -25,11 +25,13 @@ error[E0308]: mismatched types --> $DIR/coroutine-desc.rs:11:16 | LL | fun(one(), two()); - | --- ----- ^^^^^ expected future, found a different future + | --- ----- ^^^^^ expected `one::{opaque#0}`, found `two::{opaque#0}` | | | | | expected all arguments to be this future type because they need to match the type of this parameter | arguments to this function are incorrect | + = note: expected opaque type `impl Future` + found opaque type `impl Future` = note: distinct uses of `impl Trait` result in different opaque types note: function defined here --> $DIR/coroutine-desc.rs:7:4 diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr index a5f148ae0ca76..6cd35af5aa267 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr @@ -1,4 +1,4 @@ -error: implementation of `FnOnce` is not general enough +error: lifetime bound not satisfied --> $DIR/drop-tracking-unresolved-typeck-results.rs:102:5 | LL | / send(async { @@ -6,14 +6,9 @@ LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrde LL | | }); | |______^ | -note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/drop-tracking-unresolved-typeck-results.rs:13:12 - | -LL | fn send(_: T) {} - | ^^^^ required by this bound in `send` - = note: ...but it actually implements `FnOnce<(&(),)>` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) -error: implementation of `FnOnce` is not general enough +error: lifetime bound not satisfied --> $DIR/drop-tracking-unresolved-typeck-results.rs:102:5 | LL | / send(async { @@ -21,12 +16,7 @@ LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrde LL | | }); | |______^ | -note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/drop-tracking-unresolved-typeck-results.rs:13:12 - | -LL | fn send(_: T) {} - | ^^^^ required by this bound in `send` - = note: ...but it actually implements `FnOnce<(&(),)>` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/field-assign-nonsend.stderr b/tests/ui/async-await/field-assign-nonsend.stderr index 418a0829c657e..9fec60618b8e2 100644 --- a/tests/ui/async-await/field-assign-nonsend.stderr +++ b/tests/ui/async-await/field-assign-nonsend.stderr @@ -5,14 +5,11 @@ LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` -note: future is not `Send` as this value is used across an await - --> $DIR/field-assign-nonsend.rs:20:39 +note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send` + --> $DIR/field-assign-nonsend.rs:16:21 | -LL | let mut info = self.info_result.clone(); - | -------- has type `InfoResult` which is not `Send` -... -LL | let _ = send_element(element).await; - | ^^^^^ await occurs here, with `mut info` maybe used later +LL | async fn handle(&mut self) { + | ^^^^^^^^^ has type `&mut Agent` which is not `Send`, because `Agent` is not `Send` note: required by a bound in `assert_send` --> $DIR/field-assign-nonsend.rs:37:19 | diff --git a/tests/ui/async-await/impl-future-escaping-bound-vars-ice.stderr b/tests/ui/async-await/impl-future-escaping-bound-vars-ice.stderr index 5beca58e13c77..87633e9040e80 100644 --- a/tests/ui/async-await/impl-future-escaping-bound-vars-ice.stderr +++ b/tests/ui/async-await/impl-future-escaping-bound-vars-ice.stderr @@ -9,9 +9,6 @@ error[E0277]: `u32` is not a future | LL | fn test_ref(x: &u32) -> impl std::future::Future + '_ { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `u32` is not a future -LL | -LL | *x - | -- return type was inferred to be `u32` here | = help: the trait `Future` is not implemented for `u32` diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr index 52fd887b296f4..22fbaad3f4d83 100644 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr @@ -2,7 +2,7 @@ error[E0311]: the parameter type `T` may not live long enough --> $DIR/async-generics-and-bounds.rs:8:28 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the type `(T, U)` will meet its required lifetime bounds | | | the parameter type `T` must be valid for the anonymous lifetime as defined here... | @@ -15,7 +15,7 @@ error[E0311]: the parameter type `U` may not live long enough --> $DIR/async-generics-and-bounds.rs:8:28 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the type `(T, U)` will meet its required lifetime bounds | | | the parameter type `U` must be valid for the anonymous lifetime as defined here... | diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr index 3f44e4cdb6778..39f9f555252e1 100644 --- a/tests/ui/async-await/in-trait/async-generics.stderr +++ b/tests/ui/async-await/in-trait/async-generics.stderr @@ -2,7 +2,7 @@ error[E0311]: the parameter type `T` may not live long enough --> $DIR/async-generics.rs:5:28 | LL | async fn foo(&self) -> &(T, U); - | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the type `(T, U)` will meet its required lifetime bounds | | | the parameter type `T` must be valid for the anonymous lifetime as defined here... | @@ -15,7 +15,7 @@ error[E0311]: the parameter type `U` may not live long enough --> $DIR/async-generics.rs:5:28 | LL | async fn foo(&self) -> &(T, U); - | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the type `(T, U)` will meet its required lifetime bounds | | | the parameter type `U` must be valid for the anonymous lifetime as defined here... | diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index d0c11565f4e90..bb6c9676466fa 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -1,14 +1,14 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/dont-project-to-specializable-projection.rs:14:35 + --> $DIR/dont-project-to-specializable-projection.rs:14:5 | LL | default async fn foo(_: T) -> &'static str { - | ^^^^^^^^^^^^ expected associated type, found future + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `MyTrait::foo::{anon_assoc#0}`, found `>::foo::{opaque#0}` | note: type in trait - --> $DIR/dont-project-to-specializable-projection.rs:10:27 + --> $DIR/dont-project-to-specializable-projection.rs:10:5 | LL | async fn foo(_: T) -> &'static str; - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: expected signature `fn(_) -> impl Future` found signature `fn(_) -> impl Future` diff --git a/tests/ui/async-await/issue-108572.fixed b/tests/ui/async-await/issue-108572.fixed index 0e8a7b7848140..63475bf72e5dc 100644 --- a/tests/ui/async-await/issue-108572.fixed +++ b/tests/ui/async-await/issue-108572.fixed @@ -9,8 +9,7 @@ fn foo() -> impl Future { fn bar(cx: &mut std::task::Context<'_>) { let fut = foo(); - let mut pinned = std::pin::pin!(fut); - pinned.as_mut().poll(cx); + Pin::new(&mut fut).poll(cx); //~^ ERROR no method named `poll` found for opaque type `impl Future` in the current scope [E0599] } fn main() {} diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr index f8da064da9c4c..fd6f16fde8a2e 100644 --- a/tests/ui/async-await/issue-108572.stderr +++ b/tests/ui/async-await/issue-108572.stderr @@ -4,13 +4,16 @@ error[E0599]: no method named `poll` found for opaque type `impl Future` | + --> $SRC_DIR/core/src/future/future.rs:LL:COL + | + = note: the method is available for `Pin<&mut impl Future>` here + | = help: method `poll` found on `Pin<&mut impl Future>`, see documentation for `std::pin::Pin` = help: self type must be pinned to call `Future::poll`, see https://rust-lang.github.io/async-book/part-reference/pinning.html -help: consider pinning the expression - | -LL ~ let mut pinned = std::pin::pin!(fut); -LL ~ pinned.as_mut().poll(cx); +help: consider wrapping the receiver expression with the appropriate type | +LL | Pin::new(&mut fut).poll(cx); + | +++++++++++++ + error: aborting due to 1 previous error diff --git a/tests/ui/async-await/issue-61076.stderr b/tests/ui/async-await/issue-61076.stderr index dd49d00246cdf..b1b6aed3f7a06 100644 --- a/tests/ui/async-await/issue-61076.stderr +++ b/tests/ui/async-await/issue-61076.stderr @@ -10,6 +10,18 @@ help: consider `await`ing on the `Future` LL | foo().await?; | ++++++ +error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/issue-61076.rs:42:5 + | +LL | async fn bar() -> Result<(), ()> { + | __________________________________- +LL | | foo()?; + | | ^^^^^^ cannot use the `?` operator in an async function that returns `impl Future>` +... | +LL | | Ok(()) +LL | | } + | |_- this function should return `Result` or `Option` to accept `?` + error[E0277]: the `?` operator can only be applied to values that implement `Try` --> $DIR/issue-61076.rs:62:5 | @@ -26,6 +38,19 @@ help: consider `await`ing on the `Future` LL | t.await?; | ++++++ +error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/issue-61076.rs:62:5 + | +LL | async fn baz() -> Result<(), ()> { + | __________________________________- +LL | | let t = T; +LL | | t?; + | | ^^ cannot use the `?` operator in an async function that returns `T` +... | +LL | | Ok(()) +LL | | } + | |_- this function should return `Result` or `Option` to accept `?` + error[E0609]: no field `0` on type `impl Future` --> $DIR/issue-61076.rs:69:26 | @@ -75,7 +100,7 @@ help: consider `await`ing on the `Future` LL | match tuple().await { | ++++++ -error: aborting due to 6 previous errors +error: aborting due to 8 previous errors Some errors have detailed explanations: E0277, E0308, E0599, E0609. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr index 52c4acf02745f..479f8dd6ce962 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.stderr @@ -1,17 +1,14 @@ -error[E0277]: `*mut ()` cannot be shared between threads safely +error[E0277]: `NotSync` cannot be shared between threads safely --> $DIR/issue-70935-complex-spans.rs:15:23 | LL | fn foo(x: NotSync) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely + | ^^^^^^^^^^^^^^^^^^ `NotSync` cannot be shared between threads safely | - = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` -note: required because it appears within the type `PhantomData<*mut ()>` - --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `NotSync` - --> $DIR/issue-70935-complex-spans.rs:9:16 +help: the trait `Sync` is not implemented for `NotSync` + --> $DIR/issue-70935-complex-spans.rs:9:1 | LL | struct NotSync(PhantomData<*mut ()>); - | ^^^^^^^^^^^^^^^^^^^^ required by this field + | ^^^^^^^^^^^^^^ = note: required for `&NotSync` to implement `Send` note: required because it's used within this closure --> $DIR/issue-70935-complex-spans.rs:18:13 @@ -31,6 +28,36 @@ note: required because it's used within this `async` block LL | async move { | ^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0277]: `NotSync` cannot be shared between threads safely + --> $DIR/issue-70935-complex-spans.rs:19:13 + | +LL | foo(x.clone()); + | ^^^^^^^^^^^^^^ `NotSync` cannot be shared between threads safely + | +help: the trait `Sync` is not implemented for `NotSync` + --> $DIR/issue-70935-complex-spans.rs:9:1 + | +LL | struct NotSync(PhantomData<*mut ()>); + | ^^^^^^^^^^^^^^ + = note: required for `&NotSync` to implement `Send` +note: required because it's used within this closure + --> $DIR/issue-70935-complex-spans.rs:18:13 + | +LL | baz(|| async { + | ^^ +note: required because it's used within this `async` fn body + --> $DIR/issue-70935-complex-spans.rs:12:67 + | +LL | async fn baz(_c: impl FnMut() -> T) where T: Future { + | ___________________________________________________________________^ +LL | | } + | |_^ +note: required because it's used within this `async` block + --> $DIR/issue-70935-complex-spans.rs:17:5 + | +LL | async move { + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr index b7f9a9ed24ecf..cde58489f93c1 100644 --- a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr +++ b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr @@ -13,20 +13,20 @@ LL | y error[E0716]: temporary value dropped while borrowed --> $DIR/issue-74072-lifetime-name-annotations.rs:13:5 | -LL | pub fn async_closure(x: &mut i32) -> impl Future { - | - let's call the lifetime of this reference `'1` -LL | // (async move || { -LL | || -LL | || -LL | || let y = &*x; -LL | || *x += 1; -LL | || y -LL | || })() - | ||______^_- argument requires that borrow lasts for `'1` - | |_______| - | creates a temporary value which is freed while still in use -LL | } - | - temporary value is freed at the end of this statement +LL | / (async move || { +LL | | +LL | | +LL | | let y = &*x; +LL | | *x += 1; +LL | | y +LL | | })() + | |______^ creates a temporary value which is freed while still in use +LL | } + | -- borrow later used here + | | + | temporary value is freed at the end of this statement + | + = note: consider using a `let` binding to create a longer lived value error: lifetime may not live long enough --> $DIR/issue-74072-lifetime-name-annotations.rs:13:20 @@ -62,20 +62,20 @@ LL | y error[E0716]: temporary value dropped while borrowed --> $DIR/issue-74072-lifetime-name-annotations.rs:23:5 | -LL | pub fn async_closure_explicit_return_type(x: &mut i32) -> impl Future { - | - let's call the lifetime of this reference `'1` -LL | // (async move || -> &i32 { -LL | || -LL | || -LL | || let y = &*x; -LL | || *x += 1; -LL | || y -LL | || })() - | ||______^_- argument requires that borrow lasts for `'1` - | |_______| - | creates a temporary value which is freed while still in use -LL | } - | - temporary value is freed at the end of this statement +LL | / (async move || -> &i32 { +LL | | +LL | | +LL | | let y = &*x; +LL | | *x += 1; +LL | | y +LL | | })() + | |______^ creates a temporary value which is freed while still in use +LL | } + | -- borrow later used here + | | + | temporary value is freed at the end of this statement + | + = note: consider using a `let` binding to create a longer lived value error: lifetime may not live long enough --> $DIR/issue-74072-lifetime-name-annotations.rs:23:28 diff --git a/tests/ui/async-await/issue-84841.stderr b/tests/ui/async-await/issue-84841.stderr index 6c714ce7828ce..a57917856398a 100644 --- a/tests/ui/async-await/issue-84841.stderr +++ b/tests/ui/async-await/issue-84841.stderr @@ -6,6 +6,18 @@ LL | test()?; | = help: the nightly-only, unstable trait `Try` is not implemented for `impl Future` +error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/issue-84841.rs:9:5 + | +LL | async fn foo() { + | ________________- +LL | | // Adding an .await here avoids the ICE +LL | | test()?; + | | ^^^^^^^ cannot use the `?` operator in an async function that returns `impl Future` +... | +LL | | } + | |_- this function should return `Result` or `Option` to accept `?` + error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/issue-84841.rs:9:11 | @@ -18,6 +30,6 @@ LL | | test()?; LL | | } | |_- this function should return `Result` or `Option` to accept `?` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-98634.stderr b/tests/ui/async-await/issue-98634.stderr index e0739ae3a9b87..4ce3f11e00d51 100644 --- a/tests/ui/async-await/issue-98634.stderr +++ b/tests/ui/async-await/issue-98634.stderr @@ -28,11 +28,15 @@ error[E0271]: expected `callback` to return `Pin>>`, LL | StructAsync { callback }.await; | ^^^^^ expected `Pin>>`, found future | -note: required by a bound in `StructAsync` - --> $DIR/issue-98634.rs:9:35 - | -LL | pub struct StructAsync Pin>>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` +note: required for `StructAsync impl Future {callback}>` to implement `Future` + --> $DIR/issue-98634.rs:13:9 + | +LL | impl Future for StructAsync + | ^^^^^^ ^^^^^^^^^^^^^^ +LL | where +LL | F: Fn() -> Pin>>, + | --------------------------------- unsatisfied trait bound introduced here + = note: required for `StructAsync impl Future {callback}>` to implement `IntoFuture` error: aborting due to 3 previous errors diff --git a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr index 167b5ee4425f8..334abd44cd78c 100644 --- a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr +++ b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr @@ -14,17 +14,13 @@ LL | | } = help: consider adding the following bound: `'a: 'b` error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not appear in bounds - --> $DIR/ret-impl-trait-one.rs:16:80 + --> $DIR/ret-impl-trait-one.rs:16:1 | -LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { - | ____________________________________--___________________________--------------_^ - | | | | - | | | opaque type defined here - | | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here -LL | | -LL | | (a, b) -LL | | } - | |_^ +LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------- + | | | + | | opaque type defined here + | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here | help: add a `use<...>` bound to explicitly capture `'b` | diff --git a/tests/ui/async-await/pin-needed-to-poll-3.stderr b/tests/ui/async-await/pin-needed-to-poll-3.stderr index e4fbef69bacbf..3749ae473d9d7 100644 --- a/tests/ui/async-await/pin-needed-to-poll-3.stderr +++ b/tests/ui/async-await/pin-needed-to-poll-3.stderr @@ -7,11 +7,13 @@ LL | impl Future for FutureWrapper LL | let res = self.fut.poll(cx); | ^^^^ method not found in `F` | -help: consider pinning the expression + --> $SRC_DIR/core/src/future/future.rs:LL:COL | -LL ~ let mut pinned = std::pin::pin!(self.fut); -LL ~ let res = pinned.as_mut().poll(cx); + = note: the method is available for `Pin<&mut F>` here +help: consider wrapping the receiver expression with the appropriate type | +LL | let res = Pin::new(&mut self.fut).poll(cx); + | +++++++++++++ + error: aborting due to 1 previous error diff --git a/tests/ui/async-await/pin-needed-to-poll.stderr b/tests/ui/async-await/pin-needed-to-poll.stderr index e576cd6c7a429..5f6ea4d853a0e 100644 --- a/tests/ui/async-await/pin-needed-to-poll.stderr +++ b/tests/ui/async-await/pin-needed-to-poll.stderr @@ -7,11 +7,13 @@ LL | struct Sleep; LL | self.sleep.poll(cx) | ^^^^ method not found in `Sleep` | -help: consider pinning the expression + --> $SRC_DIR/core/src/future/future.rs:LL:COL | -LL ~ let mut pinned = std::pin::pin!(self.sleep); -LL ~ pinned.as_mut().poll(cx) + = note: the method is available for `Pin<&mut Sleep>` here +help: consider wrapping the receiver expression with the appropriate type | +LL | Pin::new(&mut self.sleep).poll(cx) + | +++++++++++++ + error: aborting due to 1 previous error diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr index 63f44d676882d..8b6fa51804a11 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr @@ -1,10 +1,7 @@ -error: implementation of `Send` is not general enough +error: lifetime bound not satisfied --> $DIR/issue-110963-early.rs:17:5 | -LL | spawn(async move { - | ^ ---------- this async block captures a value whose type is not `Send` - | _____| - | | +LL | / spawn(async move { LL | | let mut hc = hc; LL | | if !hc.check().await { LL | | log_health_check_failure().await; @@ -12,22 +9,12 @@ LL | | } LL | | }); | |______^ | -note: `Send` would have to be implemented for the type `impl Future { ::check<'0>(..) }`, for any two lifetimes `'0` and `'1`... - --> $DIR/issue-110963-early.rs:37:17 - | -LL | fn spawn(future: F) -> JoinHandle -LL | where -LL | F: Future + Send + 'static, - | ^^^^ required by this bound in `spawn` - = note: ...but `Send` is actually implemented for the type `impl Future { ::check<'2>(..) }`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) -error: implementation of `Send` is not general enough +error: lifetime bound not satisfied --> $DIR/issue-110963-early.rs:17:5 | -LL | spawn(async move { - | ^ ---------- this async block captures a value whose type is not `Send` - | _____| - | | +LL | / spawn(async move { LL | | let mut hc = hc; LL | | if !hc.check().await { LL | | log_health_check_failure().await; @@ -35,14 +22,7 @@ LL | | } LL | | }); | |______^ | -note: `Send` would have to be implemented for the type `impl Future { ::check<'0>(..) }`, for any two lifetimes `'0` and `'1`... - --> $DIR/issue-110963-early.rs:37:17 - | -LL | fn spawn(future: F) -> JoinHandle -LL | where -LL | F: Future + Send + 'static, - | ^^^^ required by this bound in `spawn` - = note: ...but `Send` is actually implemented for the type `impl Future { ::check<'2>(..) }`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/try-in-sync.stderr b/tests/ui/async-await/try-in-sync.stderr index 0957339a4dc58..9e77d5c3fde47 100644 --- a/tests/ui/async-await/try-in-sync.stderr +++ b/tests/ui/async-await/try-in-sync.stderr @@ -13,6 +13,14 @@ LL | fn main() -> Result<(), ()> { LL | foo()?; | ^ -error: aborting due to 1 previous error +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/try-in-sync.rs:6:5 + | +LL | fn main() -> Result<(), ()> { + | --------------------------- this function should return `Result` or `Option` to accept `?` +LL | foo()?; + | ^^^^^^ cannot use the `?` operator in a function that returns `impl Future>` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-1.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-1.no_assumptions.stderr index b2c56bf95156c..64712b3418e9c 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-1.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-1.no_assumptions.stderr @@ -1,38 +1,32 @@ -error[E0308]: mismatched types - --> $DIR/higher-ranked-auto-trait-1.rs:43:5 +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-1.rs:42:1 | -LL | / async { -LL | | let _y = &(); -LL | | let _x = filter(FilterMap { -LL | | f: || async move { *_y }, -... | -LL | | drop(_x); -LL | | } - | |_____^ one type is more general than the other +LL | pub fn get_foo() -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-1.rs:42:1 + | +LL | pub fn get_foo() -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected `async` block `{async block@$DIR/higher-ranked-auto-trait-1.rs:46:19: 46:29}` - found `async` block `{async block@$DIR/higher-ranked-auto-trait-1.rs:46:19: 46:29}` - = note: no two async blocks, even if identical, have the same type - = help: consider pinning your async block and casting it to a trait object + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-1.rs:42:1 + | +LL | pub fn get_foo() -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0308]: mismatched types - --> $DIR/higher-ranked-auto-trait-1.rs:43:5 +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-1.rs:42:1 | -LL | / async { -LL | | let _y = &(); -LL | | let _x = filter(FilterMap { -LL | | f: || async move { *_y }, -... | -LL | | drop(_x); -LL | | } - | |_____^ one type is more general than the other +LL | pub fn get_foo() -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected `async` block `{async block@$DIR/higher-ranked-auto-trait-1.rs:46:19: 46:29}` - found `async` block `{async block@$DIR/higher-ranked-auto-trait-1.rs:46:19: 46:29}` - = note: no two async blocks, even if identical, have the same type - = help: consider pinning your async block and casting it to a trait object = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-10.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-10.no_assumptions.stderr index 6fcf1b1eac176..96a589c8aae12 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-10.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-10.no_assumptions.stderr @@ -1,20 +1,18 @@ -error: implementation of `Foo` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-10.rs:32:5 | LL | Box::new(async move { get_foo(x).await }) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `Foo<'1>` would have to be implemented for the type `&'0 str`, for any two lifetimes `'0` and `'1`... - = note: ...but `Foo<'2>` is actually implemented for the type `&'2 str`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) -error: implementation of `Foo` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-10.rs:32:5 | LL | Box::new(async move { get_foo(x).await }) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `Foo<'1>` would have to be implemented for the type `&'0 str`, for any two lifetimes `'0` and `'1`... - = note: ...but `Foo<'2>` is actually implemented for the type `&'2 str`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-11.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-11.no_assumptions.stderr index 331a8c0540307..582f7720d3c5e 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-11.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-11.no_assumptions.stderr @@ -7,17 +7,13 @@ LL | impl<'a, T> Foo<'a> for MyType LL | Box::pin(async move { >::foo().await }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ coercion requires that `'a` must outlive `'static` -error: implementation of `Send` is not general enough +error: higher-ranked lifetime error --> $DIR/higher-ranked-auto-trait-11.rs:27:9 | LL | Box::pin(async move { >::foo().await }) - | ^^^^^^^^^----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | this async block captures a value whose type is not `Send` - | implementation of `Send` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `Send` would have to be implemented for the type `>::Future`, for any lifetime `'0`... - = note: ...but `Send` is actually implemented for the type `>::Future`, for some specific lifetime `'1` + = note: could not prove `Pin>: CoerceUnsized + Send>>>` error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-12.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-12.no_assumptions.stderr index a55e42b4b6dfb..8b882141701d8 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-12.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-12.no_assumptions.stderr @@ -1,4 +1,4 @@ -error: implementation of `Robot` is not general enough +error: higher-ranked lifetime error --> $DIR/higher-ranked-auto-trait-12.rs:31:20 | LL | let _my_task = this_is_send(async move { @@ -11,12 +11,7 @@ LL | | yield_now().await; LL | | }); | |______^ | -note: `Box<(dyn Robot + Send + '0)>` must implement `Robot`, for any lifetime `'0`... - --> $DIR/higher-ranked-auto-trait-12.rs:24:20 - | -LL | fn this_is_send(value: T) -> T { - | ^^^^ required by this bound in `this_is_send` - = note: ...but `Robot` is actually implemented for the type `Box<(dyn Robot + Send + 'static)>` + = note: could not prove `{async block@$DIR/higher-ranked-auto-trait-12.rs:31:33: 31:43}: Send` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-13.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-13.no_assumptions.stderr index 9d89d73270f71..72e6cf1cb16ac 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-13.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-13.no_assumptions.stderr @@ -1,82 +1,55 @@ -error: implementation of `Getter` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-13.rs:52:24 - | -LL | fn assert_send(_: impl Send + Sync) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) -error: implementation of `Getter` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-13.rs:52:24 - | -LL | fn assert_send(_: impl Send + Sync) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: implementation of `Callable` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Callable<'_>` would have to be implemented for the type `ConstructableImpl<'0>`, for any lifetime `'0`... - --> $DIR/higher-ranked-auto-trait-13.rs:52:24 - | -LL | fn assert_send(_: impl Send + Sync) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but `Callable<'1>` is actually implemented for the type `ConstructableImpl<'1>`, for some specific lifetime `'1` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: implementation of `Getter` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-13.rs:52:31 - | -LL | fn assert_send(_: impl Send + Sync) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: implementation of `Getter` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-13.rs:52:31 - | -LL | fn assert_send(_: impl Send + Sync) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: implementation of `Callable` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Callable<'_>` would have to be implemented for the type `ConstructableImpl<'0>`, for any lifetime `'0`... - --> $DIR/higher-ranked-auto-trait-13.rs:52:31 - | -LL | fn assert_send(_: impl Send + Sync) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but `Callable<'1>` is actually implemented for the type `ConstructableImpl<'1>`, for some specific lifetime `'1` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 6 previous errors diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-15.no_assumptions.stderr index 94a187f69c91f..deeda41957770 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -1,37 +1,19 @@ -error: implementation of `FnOnce` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-15.rs:20:5 | LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ | -note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-15.rs:16:20 - | -LL | fn require_send(_x: T) {} - | ^^^^ required by this bound in `require_send` - = note: ...but it actually implements `FnOnce<(&Vec,)>` -help: consider adding an explicit type annotation to the closure's argument - | -LL | for _ in things.iter().map(|n: &Vec| n.iter()).flatten() { - | +++++++++++ + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) -error: implementation of `FnOnce` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-15.rs:20:5 | LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ | -note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-15.rs:16:20 - | -LL | fn require_send(_x: T) {} - | ^^^^ required by this bound in `require_send` - = note: ...but it actually implements `FnOnce<(&Vec,)>` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit type annotation to the closure's argument - | -LL | for _ in things.iter().map(|n: &Vec| n.iter()).flatten() { - | +++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-16.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-16.no_assumptions.stderr index ff7a3230aa6c9..7d2d37012d89b 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-16.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-16.no_assumptions.stderr @@ -1,4 +1,4 @@ -error: implementation of `AsyncFnOnce` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-16.rs:18:5 | LL | / assert_send(async { @@ -6,14 +6,9 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ | -note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-16.rs:8:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) -error: implementation of `AsyncFnOnce` is not general enough +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-16.rs:18:5 | LL | / assert_send(async { @@ -21,12 +16,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ | -note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/higher-ranked-auto-trait-16.rs:8:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-17.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-17.no_assumptions.stderr index 152900ca1ae9e..f5fd475a2c25b 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-17.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-17.no_assumptions.stderr @@ -1,29 +1,32 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/higher-ranked-auto-trait-17.rs:12:5 +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-17.rs:11:1 | -LL | / async move { -LL | | let iter = Adaptor::new(a.iter().map(|_: &()| {})); -LL | | std::future::pending::<()>().await; -LL | | drop(iter); -LL | | } - | |_____^ implementation of `FnOnce` is not general enough +LL | fn foo(a: [(); 0]) -> impl std::future::Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-17.rs:11:1 + | +LL | fn foo(a: [(); 0]) -> impl std::future::Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: closure with signature `fn(&'0 ())` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-17.rs:11:1 + | +LL | fn foo(a: [(); 0]) -> impl std::future::Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: implementation of `FnOnce` is not general enough - --> $DIR/higher-ranked-auto-trait-17.rs:12:5 +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-17.rs:11:1 | -LL | / async move { -LL | | let iter = Adaptor::new(a.iter().map(|_: &()| {})); -LL | | std::future::pending::<()>().await; -LL | | drop(iter); -LL | | } - | |_____^ implementation of `FnOnce` is not general enough +LL | fn foo(a: [(); 0]) -> impl std::future::Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: closure with signature `fn(&'0 ())` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-4.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-4.no_assumptions.stderr index 5aa5b83655a53..0551c428e1424 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-4.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-4.no_assumptions.stderr @@ -1,10 +1,16 @@ -error: higher-ranked lifetime error - --> $DIR/higher-ranked-auto-trait-4.rs:29:5 +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-4.rs:28:1 | -LL | / async { -LL | | let _ = evil_function::().await; -LL | | } - | |_____^ +LL | fn fails_to_compile() -> impl std::future::Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: higher-ranked subtype error + --> $DIR/higher-ranked-auto-trait-4.rs:28:1 + | +LL | fn fails_to_compile() -> impl std::future::Future + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-5.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-5.no_assumptions.stderr index a95fd2179322f..c04ab0f345bcd 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-5.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-5.no_assumptions.stderr @@ -1,4 +1,4 @@ -error: implementation of `Send` is not general enough +error: higher-ranked lifetime error --> $DIR/higher-ranked-auto-trait-5.rs:13:5 | LL | / assert_send(async { @@ -6,14 +6,7 @@ LL | | call_me.call().await; LL | | }); | |______^ | -note: `Send` would have to be implemented for the type `&'0 str`, for any lifetime `'0`... - --> $DIR/higher-ranked-auto-trait-5.rs:20:17 - | -LL | pub fn assert_send(_future: F) -LL | where -LL | F: Future + Send, - | ^^^^ required by this bound in `assert_send` - = note: ...but `Send` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` + = note: could not prove `{async block@$DIR/higher-ranked-auto-trait-5.rs:13:17: 13:22}: Send` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-6.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-6.no_assumptions.stderr index d1c88101618ae..ff65ce140e431 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-6.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-6.no_assumptions.stderr @@ -1,26 +1,19 @@ -error[E0308]: mismatched types +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-6.rs:16:5 | LL | Box::new(async { new(|| async { f().await }).await }) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - found `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - = note: no two async blocks, even if identical, have the same type - = help: consider pinning your async block and casting it to a trait object + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) -error[E0308]: mismatched types +error: lifetime bound not satisfied --> $DIR/higher-ranked-auto-trait-6.rs:16:5 | LL | Box::new(async { new(|| async { f().await }).await }) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - found `async` block `{async block@$DIR/higher-ranked-auto-trait-6.rs:16:29: 16:34}` - = note: no two async blocks, even if identical, have the same type - = help: consider pinning your async block and casting it to a trait object + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-9.no_assumptions.stderr b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-9.no_assumptions.stderr index 809cbcf0cad13..ab8c7ff5eec66 100644 --- a/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-9.no_assumptions.stderr +++ b/tests/ui/async-await/witness-auto-trait/higher-ranked-auto-trait-9.no_assumptions.stderr @@ -1,11 +1,10 @@ -error: implementation of `Debug` is not general enough +error: higher-ranked lifetime error --> $DIR/higher-ranked-auto-trait-9.rs:43:50 | LL | let fut: &(dyn Future + Send) = &fut as _; - | ^^^^^^^^^ implementation of `Debug` is not general enough + | ^^^^^^^^^ | - = note: `(dyn Any + '0)` must implement `Debug`, for any lifetime `'0`... - = note: ...but `Debug` is actually implemented for the type `(dyn Any + 'static)` + = note: could not prove `&{async block@$DIR/higher-ranked-auto-trait-9.rs:29:15: 29:20}: CoerceUnsized<&dyn Future + Send>` error: aborting due to 1 previous error diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr index 9bfdecf6f5449..a1b5bd9541d10 100644 --- a/tests/ui/auto-traits/issue-83857-ub.stderr +++ b/tests/ui/auto-traits/issue-83857-ub.stderr @@ -67,6 +67,29 @@ help: consider introducing a `where` clause, but there might be an alternative b LL | fn generic(v: Foo, f: fn( as WithAssoc>::Output) -> i32) where Foo: Send { | +++++++++++++++++++++ -error: aborting due to 3 previous errors +error[E0277]: `Foo` cannot be sent between threads safely + --> $DIR/issue-83857-ub.rs:24:7 + | +LL | f(foo(v)); + | ^^^^^^ `Foo` cannot be sent between threads safely + | +help: the trait `Send` is not implemented for `Foo` + --> $DIR/issue-83857-ub.rs:6:1 + | +LL | struct Foo(Always); + | ^^^^^^^^^^^^^^^^ +note: required for `Foo` to implement `WithAssoc` + --> $DIR/issue-83857-ub.rs:14:15 + | +LL | impl WithAssoc for T { + | ---- ^^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn generic(v: Foo, f: fn( as WithAssoc>::Output) -> i32) where Foo: Send { + | +++++++++++++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/binding/tuple-binder-on-err-ty.stderr b/tests/ui/binding/tuple-binder-on-err-ty.stderr index f8f9cd73035d6..c4e4a5760903d 100644 --- a/tests/ui/binding/tuple-binder-on-err-ty.stderr +++ b/tests/ui/binding/tuple-binder-on-err-ty.stderr @@ -21,16 +21,6 @@ help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` but trait `FromIterator<(u32, _, _)>` is implemented for it --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = help: for that trait implementation, expected `(u32, _, _)`, found `()` -note: the method call chain might not have had the expected associated types - --> $DIR/tuple-binder-on-err-ty.rs:8:43 - | -LL | let sr: Vec<(u32, _, _) = vec![]; - | ------ this expression has type `Vec<(_, _, _)>` -... -LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); - | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here - | | - | `Iterator::Item` is `&(_, _, _)` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL diff --git a/tests/ui/binop/binary-op-not-allowed-issue-125631.stderr b/tests/ui/binop/binary-op-not-allowed-issue-125631.stderr index ad8802bf1370f..2a1638b0794b7 100644 --- a/tests/ui/binop/binary-op-not-allowed-issue-125631.stderr +++ b/tests/ui/binop/binary-op-not-allowed-issue-125631.stderr @@ -5,21 +5,6 @@ LL | (Error::new(ErrorKind::Other, "1"), T1, 1) == (Error::new(ErrorKind::Ot | ------------------------------------------ ^^ ------------------------------------------ (std::io::Error, T1, {integer}) | | | (std::io::Error, T1, {integer}) - | -note: an implementation of `PartialEq` might be missing for `T1` - --> $DIR/binary-op-not-allowed-issue-125631.rs:4:1 - | -LL | struct T1; - | ^^^^^^^^^ must implement `PartialEq` -note: `std::io::Error` does not implement `PartialEq` - --> $SRC_DIR/core/src/io/error.rs:LL:COL - | - = note: `std::io::Error` is defined in another crate -help: consider annotating `T1` with `#[derive(PartialEq)]` - | -LL + #[derive(PartialEq)] -LL | struct T1; - | error[E0369]: binary operation `==` cannot be applied to type `(std::io::Error, Thread)` --> $DIR/binary-op-not-allowed-issue-125631.rs:11:9 @@ -28,15 +13,6 @@ LL | (Error::new(ErrorKind::Other, "2"), thread::current()) | ------------------------------------------------------ (std::io::Error, Thread) LL | == (Error::new(ErrorKind::Other, "2"), thread::current()); | ^^ ------------------------------------------------------ (std::io::Error, Thread) - | -note: `Thread` does not implement `PartialEq` - --> $SRC_DIR/std/src/thread/thread.rs:LL:COL - | - = note: `Thread` is defined in another crate -note: `std::io::Error` does not implement `PartialEq` - --> $SRC_DIR/core/src/io/error.rs:LL:COL - | - = note: `std::io::Error` is defined in another crate error[E0369]: binary operation `==` cannot be applied to type `(std::io::Error, Thread, T1, T2)` --> $DIR/binary-op-not-allowed-issue-125631.rs:14:9 @@ -45,32 +21,6 @@ LL | (Error::new(ErrorKind::Other, "4"), thread::current(), T1, T2) | -------------------------------------------------------------- (std::io::Error, Thread, T1, T2) LL | == (Error::new(ErrorKind::Other, "4"), thread::current(), T1, T2); | ^^ -------------------------------------------------------------- (std::io::Error, Thread, T1, T2) - | -note: the following types would have to `impl` their required traits for this operation to be valid - --> $DIR/binary-op-not-allowed-issue-125631.rs:4:1 - | -LL | struct T1; - | ^^^^^^^^^ must implement `PartialEq` -LL | struct T2; - | ^^^^^^^^^ must implement `PartialEq` -note: `Thread` does not implement `PartialEq` - --> $SRC_DIR/std/src/thread/thread.rs:LL:COL - | - = note: `Thread` is defined in another crate -note: `std::io::Error` does not implement `PartialEq` - --> $SRC_DIR/core/src/io/error.rs:LL:COL - | - = note: `std::io::Error` is defined in another crate -help: consider annotating `T1` with `#[derive(PartialEq)]` - | -LL + #[derive(PartialEq)] -LL | struct T1; - | -help: consider annotating `T2` with `#[derive(PartialEq)]` - | -LL + #[derive(PartialEq)] -LL | struct T2; - | error: aborting due to 3 previous errors diff --git a/tests/ui/binop/eq-arr.stderr b/tests/ui/binop/eq-arr.stderr index afcfb7b288b8d..94832f07f9528 100644 --- a/tests/ui/binop/eq-arr.stderr +++ b/tests/ui/binop/eq-arr.stderr @@ -5,17 +5,6 @@ LL | let eq = xs == [X, X, X]; | -- ^^ --------- [X; 3] | | | [X; 3] - | -note: an implementation of `PartialEq` might be missing for `X` - --> $DIR/eq-arr.rs:2:5 - | -LL | struct X; - | ^^^^^^^^ must implement `PartialEq` -help: consider annotating `X` with `#[derive(PartialEq)]` - | -LL + #[derive(PartialEq)] -LL | struct X; - | error: aborting due to 1 previous error diff --git a/tests/ui/binop/eq-vec.stderr b/tests/ui/binop/eq-vec.stderr index 158bfe6259344..a6818e40596cd 100644 --- a/tests/ui/binop/eq-vec.stderr +++ b/tests/ui/binop/eq-vec.stderr @@ -7,16 +7,10 @@ LL | assert_eq!(vec1, vec2); | Vec | Vec | -note: an implementation of `PartialEq` might be missing for `Foo` - --> $DIR/eq-vec.rs:3:5 - | -LL | enum Foo { - | ^^^^^^^^ must implement `PartialEq` -help: consider annotating `Foo` with `#[derive(PartialEq)]` - | -LL + #[derive(PartialEq)] -LL | enum Foo { +note: `Vec` does not implement `PartialEq` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | + = note: `Vec` is defined in another crate error: aborting due to 1 previous error diff --git a/tests/ui/binop/issue-93927.stderr b/tests/ui/binop/issue-93927.stderr index ff5ecf66be631..fbbb2ed95a435 100644 --- a/tests/ui/binop/issue-93927.stderr +++ b/tests/ui/binop/issue-93927.stderr @@ -6,10 +6,17 @@ LL | val == val | | | MyType | -help: consider further restricting type parameter `T` with trait `Eq` +note: an implementation of `PartialEq` might be missing for `MyType` + --> $DIR/issue-93927.rs:2:1 | -LL | fn cond(val: MyType) -> bool { - | ++++++++++++++ +LL | struct MyType(T); + | ^^^^^^^^^^^^^^^^ must implement `PartialEq` +note: the trait `PartialEq` must be implemented + --> $SRC_DIR/core/src/cmp.rs:LL:COL +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn cond(val: MyType) -> bool where MyType: PartialEq { + | ++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr index c82821b04a35c..78331515131cc 100644 --- a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr +++ b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr @@ -1,14 +1,12 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/higher-ranked-outlives-for-capture.rs:13:11 +error[E0515]: cannot return value referencing temporary value + --> $DIR/higher-ranked-outlives-for-capture.rs:13:5 | LL | test(&vec![]) - | ------^^^^^^- + | ^^^^^^------^ | | | - | | creates a temporary value which is freed while still in use - | argument requires that borrow lasts for `'static` -LL | } - | - temporary value is freed at the end of this statement + | | temporary value created here + | returns a value referencing data owned by the current function error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0716`. +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr index 1a32d1200571c..b3159c351d2ed 100644 --- a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr +++ b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr @@ -1,12 +1,11 @@ error[E0700]: hidden type for `impl Trait + 'static` captures lifetime that does not appear in bounds - --> $DIR/opaque-type-param.rs:7:5 + --> $DIR/opaque-type-param.rs:6:1 | LL | fn foo<'a>(s: &'a str) -> impl Trait + 'static { - | -- -------------------- opaque type defined here - | | + | ^^^^^^^--^^^^^^^^^^^^^^^^^-------------------- + | | | + | | opaque type defined here | hidden type `impl Trait + 'static` captures the lifetime `'a` as defined here -LL | bar(s) - | ^^^^^^ | help: add a `use<...>` bound to explicitly capture `'a` | diff --git a/tests/ui/borrowck/alias-liveness/rpit-hidden-erased-unsoundness.edition2015.stderr b/tests/ui/borrowck/alias-liveness/rpit-hidden-erased-unsoundness.edition2015.stderr index 68b4e2ed39fb6..4f16836618578 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hidden-erased-unsoundness.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hidden-erased-unsoundness.edition2015.stderr @@ -1,12 +1,11 @@ error[E0700]: hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds - --> $DIR/rpit-hidden-erased-unsoundness.rs:19:5 + --> $DIR/rpit-hidden-erased-unsoundness.rs:18:1 | LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a { - | -- --------------- opaque type defined here - | | + | ^^^^^^^^^^^^^--^^^^^^^^^^^--------------- + | | | + | | opaque type defined here | hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here -LL | step1::<'a, 'b>() - | ^^^^^^^^^^^^^^^^^ | help: add a `use<...>` bound to explicitly capture `'b` | diff --git a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr index ef28e406130e1..b9a6571c2ace3 100644 --- a/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr +++ b/tests/ui/borrowck/alias-liveness/rpit-hide-lifetime-for-swap.edition2015.stderr @@ -1,12 +1,11 @@ error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds - --> $DIR/rpit-hide-lifetime-for-swap.rs:38:5 + --> $DIR/rpit-hide-lifetime-for-swap.rs:37:1 | LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { - | -- -------------- opaque type defined here - | | + | ^^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------- + | | | + | | opaque type defined here | hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here -LL | x - | ^ | help: add a `use<...>` bound to explicitly capture `'b` | @@ -14,14 +13,13 @@ LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + use<' | ++++++++++++++++ error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds - --> $DIR/rpit-hide-lifetime-for-swap.rs:55:5 + --> $DIR/rpit-hide-lifetime-for-swap.rs:54:1 | LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc>) -> impl Swap + 'a { - | -- -------------- opaque type defined here - | | + | ^^^^^^^^^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------- + | | | + | | opaque type defined here | hidden type `Rc>` captures the lifetime `'b` as defined here -LL | x - | ^ | help: add a `use<...>` bound to explicitly capture `'b` | diff --git a/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness-2.stderr b/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness-2.stderr index ce797ccf40c90..4a4540f2a7fee 100644 --- a/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness-2.stderr +++ b/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness-2.stderr @@ -1,14 +1,16 @@ error[E0700]: hidden type for `Step2<'a>` captures lifetime that does not appear in bounds - --> $DIR/tait-hidden-erased-unsoundness-2.rs:27:5 + --> $DIR/tait-hidden-erased-unsoundness-2.rs:23:1 | -LL | pub type Step2<'a> = impl Send + 'a; - | -------------- opaque type defined here +LL | pub type Step2<'a> = impl Send + 'a; + | -------------- opaque type defined here ... -LL | pub fn step2<'a, 'b: 'a>() -> Step2<'a> - | -- hidden type `Step1<'a, 'b>` captures the lifetime `'b` as defined here -... -LL | step1::<'a, 'b>() - | ^^^^^^^^^^^^^^^^^ +LL | pub fn step2<'a, 'b: 'a>() -> Step2<'a> + | ^ -- hidden type `Step1<'a, 'b>` captures the lifetime `'b` as defined here + | _| + | | +LL | | where +LL | | Step1<'a, 'b>: Send, + | |________________________^ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness.stderr b/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness.stderr index ed1afd6450728..3b68f3232b4ac 100644 --- a/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness.stderr +++ b/tests/ui/borrowck/alias-liveness/tait-hidden-erased-unsoundness.stderr @@ -1,13 +1,13 @@ error[E0700]: hidden type for `Tait<'a>` captures lifetime that does not appear in bounds - --> $DIR/tait-hidden-erased-unsoundness.rs:18:5 + --> $DIR/tait-hidden-erased-unsoundness.rs:17:1 | LL | type Tait<'a> = impl Sized + 'a; | --------------- opaque type defined here LL | #[define_opaque(Tait)] LL | fn step2<'a, 'b: 'a>() -> Tait<'a> { - | -- hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here -LL | step1::<'a, 'b>() - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^ + | | + | hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr index e097be2e5cd84..9ccd0d038fcb4 100644 --- a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr +++ b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr @@ -1,19 +1,15 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captures lifetime that does not appear in bounds - --> $DIR/closure-upvar-named-lifetime.rs:17:5 + --> $DIR/closure-upvar-named-lifetime.rs:13:1 | LL | fn apply<'a>( - | -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:17:5: 17:15}` captures the lifetime `'a` as defined here -LL | f: Arc) + 'a>, -LL | ) -> impl Fn(RefCell>) - | ----------------------------------------- opaque type defined here -LL | { -LL | / move |map| { -LL | | -LL | | let value = map.borrow_mut().entry("foo".to_string()); -... | -LL | | f(wrapped_value); -LL | | } - | |_____^ + | ^ -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:17:5: 17:15}` captures the lifetime `'a` as defined here + | _| + | | +LL | | f: Arc) + 'a>, +LL | | ) -> impl Fn(RefCell>) + | |______----------------------------------------^ + | | + | opaque type defined here | help: add a `use<...>` bound to explicitly capture `'a` | @@ -58,21 +54,17 @@ note: requirement that the value outlives `'a` introduced here --> $SRC_DIR/core/src/ops/function.rs:LL:COL error[E0700]: hidden type for `impl Fn(RefCell>)` captures lifetime that does not appear in bounds - --> $DIR/closure-upvar-named-lifetime.rs:32:5 + --> $DIR/closure-upvar-named-lifetime.rs:28:1 | LL | fn apply_box<'a>( - | -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:32:5: 32:15}` captures the lifetime `'a` as defined here -LL | f: Box) + 'a>, -LL | ) -> impl Fn(RefCell>) - | ----------------------------------------- opaque type defined here -LL | { -LL | / move |map| { -LL | | -LL | | let value = map.borrow_mut().entry("foo".to_string()); -... | -LL | | f(value); -LL | | } - | |_____^ + | ^ -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:32:5: 32:15}` captures the lifetime `'a` as defined here + | _| + | | +LL | | f: Box) + 'a>, +LL | | ) -> impl Fn(RefCell>) + | |______----------------------------------------^ + | | + | opaque type defined here | help: add a `use<...>` bound to explicitly capture `'a` | diff --git a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr index f1a561ef88049..e36e4b919b27b 100644 --- a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr +++ b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr @@ -1,15 +1,10 @@ -error: implementation of `LoadQuery` is not general enough +error: higher-ranked lifetime error --> $DIR/implementation-not-general-enough-ice-133252.rs:9:9 | LL | force_send(async_load(¬_static)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `LoadQuery<'0>` would have to be implemented for the type `&u8`, for any lifetime `'0`... - --> $DIR/implementation-not-general-enough-ice-133252.rs:16:18 - | -LL | fn force_send(_: T) {} - | ^^^^ required by this bound in `force_send` - = note: ...but `LoadQuery<'1>` is actually implemented for the type `&'1 u8`, for some specific lifetime `'1` + = note: could not prove `impl Future: Send` error[E0597]: `not_static` does not live long enough --> $DIR/implementation-not-general-enough-ice-133252.rs:9:31 diff --git a/tests/ui/borrowck/index-mut-help2.stderr b/tests/ui/borrowck/index-mut-help2.stderr index 0992b520e8687..b9448c08e5275 100644 --- a/tests/ui/borrowck/index-mut-help2.stderr +++ b/tests/ui/borrowck/index-mut-help2.stderr @@ -32,6 +32,14 @@ LL | map[index] = 23; | = note: required for `HashMap<&B, u32>` to implement `Index<&&&&&B>` +error[E0277]: the trait bound `&B: Borrow<&&&&B>` is not satisfied + --> $DIR/index-mut-help2.rs:95:9 + | +LL | map[index] = 23; + | ^^^^^ the trait `Borrow<&&&&B>` is not implemented for `&B` + | + = note: required for `HashMap<&B, u32>` to implement `Index<&&&&&B>` + error[E0277]: the trait bound `&B: Borrow<&&&&B>` is not satisfied --> $DIR/index-mut-help2.rs:98:36 | @@ -58,6 +66,21 @@ LL | impl Borrow for D { = help: for that trait implementation, expected `C`, found `&&&&D` = note: required for `HashMap` to implement `Index<&&&&&D>` +error[E0277]: the trait bound `D: Borrow<&&&&D>` is not satisfied + --> $DIR/index-mut-help2.rs:131:9 + | +LL | map[index] = 23; + | ^^^^^ unsatisfied trait bound + | +help: the trait `Borrow<&&&&D>` is not implemented for `D` + but trait `Borrow` is implemented for it + --> $DIR/index-mut-help2.rs:18:1 + | +LL | impl Borrow for D { + | ^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `C`, found `&&&&D` + = note: required for `HashMap` to implement `Index<&&&&&D>` + error[E0277]: the trait bound `D: Borrow<&&&&D>` is not satisfied --> $DIR/index-mut-help2.rs:134:36 | @@ -238,7 +261,7 @@ LL ~ let binding = &index; LL ~ let val = map.entry(&binding).insert_entry(12); | -error: aborting due to 14 previous errors +error: aborting due to 16 previous errors Some errors have detailed explanations: E0277, E0308, E0507, E0594, E0716. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/borrowck/moved-into-question-mark.stderr b/tests/ui/borrowck/moved-into-question-mark.stderr index 5febf1b73b473..5d8f614dc21e3 100644 --- a/tests/ui/borrowck/moved-into-question-mark.stderr +++ b/tests/ui/borrowck/moved-into-question-mark.stderr @@ -12,7 +12,7 @@ LL | dbg!(entry?.file_name()); | note: the question mark operator is desugared into a call to `std::ops::Try::branch`, which takes ownership of the receiver `self`, which moves `entry` --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL -help: you could `clone` the value and consume it, if the following trait bounds could be satisfied: `DirEntry: Clone` and `std::io::Error: Clone` +help: you could `clone` the value and consume it, if the `DirEntry: Clone` trait bound could be satisfied | LL | let file_type = entry.clone()?.file_type()?; | ++++++++ diff --git a/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr b/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr index e62701bf408a7..bc3ec0d908272 100644 --- a/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr +++ b/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr @@ -1,21 +1,15 @@ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/overwrite-anon-late-param-regions.rs:11:5 +error: item does not constrain `test2::{opaque#0}` + --> $DIR/overwrite-anon-late-param-regions.rs:10:4 | -LL | type Opaque2<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | |x| x - | ^^^^^ - -error: lifetime may not live long enough - --> $DIR/overwrite-anon-late-param-regions.rs:11:9 +LL | fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'a>) { + | ^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/overwrite-anon-late-param-regions.rs:10:15 | -LL | |x| x - | - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | | - | has type `(&str, &'1 str)` - | has type `(&'2 str, &str)` +LL | fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'a>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr index 207ca57af38b5..0de6cd70ae7d7 100644 --- a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr +++ b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr @@ -44,43 +44,40 @@ LL | impl<'a, 't> Foo<'a, 't> for &'a isize { LL | fn has_bound<'b>(self, b: Inv<'b>) { | ^^ `'b` is late-bound -error[E0308]: method not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/regions-bound-missing-bound-in-impl.rs:27:5 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(&'a _, Inv<'c>, Inv<'c>, Inv<'_>)` - found signature `fn(&'a _, Inv<'_>, Inv<'c>, Inv<'_>)` -note: the lifetime `'c` as defined here... +note: lifetime parameter instantiated with the lifetime `'c` as defined here --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ -note: ...does not necessarily outlive the lifetime `'c` as defined here - --> $DIR/regions-bound-missing-bound-in-impl.rs:12:24 +note: but lifetime parameter must outlive the lifetime `'c` as defined here + --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | -LL | fn wrong_bound1<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); +LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ -error[E0308]: method not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/regions-bound-missing-bound-in-impl.rs:27:5 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(&'a _, Inv<'c>, Inv<'c>, Inv<'_>)` - found signature `fn(&'a _, Inv<'_>, Inv<'c>, Inv<'_>)` -note: the lifetime `'c` as defined here... - --> $DIR/regions-bound-missing-bound-in-impl.rs:12:24 +note: lifetime parameter instantiated with the lifetime `'c` as defined here + --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | -LL | fn wrong_bound1<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); +LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ -note: ...does not necessarily outlive the lifetime `'c` as defined here +note: but lifetime parameter must outlive the lifetime `'c` as defined here --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0195]: lifetime parameters do not match the trait definition --> $DIR/regions-bound-missing-bound-in-impl.rs:42:30 @@ -122,16 +119,24 @@ LL | impl<'a, 't> Foo<'a, 't> for &'a isize { LL | fn wrong_bound2(self, b: Inv, c: Inv, d: Inv) { | ^^^ `'_` is late-bound -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/regions-bound-missing-bound-in-impl.rs:49:26 | -LL | fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>); - | ------------------------------------------------------- definition of `another_bound` from trait -... LL | fn another_bound<'x: 't>(self, x: Inv<'x>, y: Inv<'t>) { - | ^^ impl has extra requirement `'x: 't` + | ^^ + | +note: lifetime parameter instantiated with the lifetime `'x` as defined here + --> $DIR/regions-bound-missing-bound-in-impl.rs:49:22 + | +LL | fn another_bound<'x: 't>(self, x: Inv<'x>, y: Inv<'t>) { + | ^^ +note: but lifetime parameter must outlive the lifetime `'t` as defined here + --> $DIR/regions-bound-missing-bound-in-impl.rs:18:10 + | +LL | impl<'a, 't> Foo<'a, 't> for &'a isize { + | ^^ error: aborting due to 6 previous errors -Some errors have detailed explanations: E0195, E0276, E0308. +Some errors have detailed explanations: E0195, E0478. For more information about an error, try `rustc --explain E0195`. diff --git a/tests/ui/box/unit/unique-object-noncopyable.stderr b/tests/ui/box/unit/unique-object-noncopyable.stderr index 8ea6edb48a7fc..5750b964ca429 100644 --- a/tests/ui/box/unit/unique-object-noncopyable.stderr +++ b/tests/ui/box/unit/unique-object-noncopyable.stderr @@ -2,7 +2,7 @@ error[E0599]: the method `clone` exists for struct `Box`, but its trait --> $DIR/unique-object-noncopyable.rs:24:16 | LL | trait Foo { - | --------- doesn't satisfy `dyn Foo: Clone` or `dyn Foo: Sized` + | --------- doesn't satisfy `dyn Foo: Sized` ... LL | let _z = y.clone(); | ^^^^^ method cannot be called on `Box` due to unsatisfied trait bounds @@ -10,8 +10,6 @@ LL | let _z = y.clone(); = note: the following trait bounds were not satisfied: `dyn Foo: Sized` which is required by `Box: Clone` - `dyn Foo: Clone` - which is required by `Box: Clone` = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `clone`, perhaps you need to implement it: candidate #1: `Clone` diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr index 22e72b6245cec..0673c09256fd3 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr @@ -5,13 +5,22 @@ LL | impl Foo for T { } | ^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds... + | ...so that the type `T` will meet its required lifetime bounds | -note: ...that is required by this bound - --> $DIR/builtin-superkinds-self-type.rs:6:24 +help: consider adding an explicit lifetime bound + | +LL | impl Foo for T { } + | +++++++++ + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/builtin-superkinds-self-type.rs:10:24 + | +LL | impl Foo for T { } + | ^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds | -LL | trait Foo : Sized+Sync+'static { - | ^^^^^^^ help: consider adding an explicit lifetime bound | LL | impl Foo for T { } @@ -30,7 +39,7 @@ help: try wrapping the expression in `Ok` LL | assert_eq!(rx.recv(), Ok(1193182)); | +++ + -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0308, E0310. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/c-variadic/issue-86053-2.stderr b/tests/ui/c-variadic/issue-86053-2.stderr index de7d743a2a242..113648ec2962e 100644 --- a/tests/ui/c-variadic/issue-86053-2.stderr +++ b/tests/ui/c-variadic/issue-86053-2.stderr @@ -1,16 +1,11 @@ -error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references +error[E0477]: the type `&'a ()` does not fulfill the required lifetime --> $DIR/issue-86053-2.rs:6:39 | LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), _: ...) {} | ^^^^^^^^^^^^^^^^^^ | - = note: the pointer is valid for the static lifetime -note: but the referenced data is only valid for the lifetime `'a` as defined here - --> $DIR/issue-86053-2.rs:6:32 - | -LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), _: ...) {} - | ^^ + = note: type must satisfy the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/c-variadic/not-async.stderr b/tests/ui/c-variadic/not-async.stderr index 9a81e0ce270d6..f1eae831360fa 100644 --- a/tests/ui/c-variadic/not-async.stderr +++ b/tests/ui/c-variadic/not-async.stderr @@ -11,21 +11,19 @@ LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {} | ^^^^^ `async` because of this ^^^^^^ C-variadic because of this error[E0700]: hidden type for `impl Future` captures lifetime that does not appear in bounds - --> $DIR/not-async.rs:4:65 + --> $DIR/not-async.rs:4:1 | LL | async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {} - | ----------------------------------------------------------------^^ - | | | - | | opaque type defined here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- opaque type defined here + | | | hidden type `{async fn body of fn_cannot_be_async()}` captures the anonymous lifetime as defined here error[E0700]: hidden type for `impl Future` captures lifetime that does not appear in bounds - --> $DIR/not-async.rs:11:73 + --> $DIR/not-async.rs:11:5 | LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {} - | --------------------------------------------------------------------^^ - | | | - | | opaque type defined here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- opaque type defined here + | | | hidden type `{async fn body of S::method_cannot_be_async()}` captures the anonymous lifetime as defined here error: aborting due to 4 previous errors diff --git a/tests/ui/cast/cast-rfc0401-fail.stderr b/tests/ui/cast/cast-rfc0401-fail.stderr index c41e6e3612dd3..290bb17360cf4 100644 --- a/tests/ui/cast/cast-rfc0401-fail.stderr +++ b/tests/ui/cast/cast-rfc0401-fail.stderr @@ -235,6 +235,15 @@ LL | let _ = fat_v as *const dyn Foo; | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` +note: required for `[u8]` to implement `Foo` + --> $DIR/cast-rfc0401-fail.rs:12:9 + | +LL | impl Foo for T {} + | - ^^^ ^ + | | + | unsatisfied trait bound implicitly introduced here + = note: required because it appears within the type `[u8]` + = note: required for `*const [u8]` to implement `CoerceUnsized<*const dyn Foo>` = note: required for the cast from `*const [u8]` to `*const dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -244,6 +253,15 @@ LL | let _ = a as *const dyn Foo; | ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` +note: required for `str` to implement `Foo` + --> $DIR/cast-rfc0401-fail.rs:12:9 + | +LL | impl Foo for T {} + | - ^^^ ^ + | | + | unsatisfied trait bound implicitly introduced here + = note: `str` is considered to contain a `[u8]` slice for auto trait purposes + = note: required for `*const str` to implement `CoerceUnsized<*const dyn Foo>` = note: required for the cast from `*const str` to `*const dyn Foo` error[E0606]: casting `&{float}` as `f32` is invalid diff --git a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr index 92a08d0a58d74..942005d507f70 100644 --- a/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr +++ b/tests/ui/cast/ptr-to-trait-obj-different-regions-misc.stderr @@ -1,3 +1,13 @@ +error[E0277]: the trait bound `(dyn Trait<'a> + 'static): Unsize<(dyn for<'b> Trait<'b> + 'static)>` is not satisfied + --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:20:5 + | +LL | x as _ + | ^ the nightly-only, unstable trait `Unsize<(dyn for<'b> Trait<'b> + 'static)>` is not implemented for `(dyn Trait<'a> + 'static)` + | + = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information + = note: required for `*mut (dyn Trait<'a> + 'static)` to implement `CoerceUnsized<*mut (dyn for<'b> Trait<'b> + 'static)>` + = note: required for the cast from `*mut (dyn Trait<'a> + 'static)` to `*mut (dyn for<'b> Trait<'b> + 'static)` + error: lifetime may not live long enough --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:7:5 | @@ -94,28 +104,6 @@ LL | x as _ = note: this was previously accepted by the compiler but was changed recently = help: see for more information -error: lifetime may not live long enough - --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:20:5 - | -LL | fn change_lt_hr<'a>(x: *mut dyn Trait<'a>) -> *mut dyn for<'b> Trait<'b> { - | -- lifetime `'a` defined here -LL | x as _ - | ^^^^^^ cast requires that `'a` must outlive `'static` - | -help: to declare that the trait object captures data from argument `x`, you can add an explicit `'a` lifetime bound - | -LL | fn change_lt_hr<'a>(x: *mut dyn Trait<'a>) -> *mut dyn for<'b> Trait<'b> + 'a { - | ++++ - -error[E0308]: mismatched types - --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:20:5 - | -LL | x as _ - | ^^^^^^ one type is more general than the other - | - = note: expected trait object `dyn for<'b> Trait<'b>` - found trait object `dyn Trait<'_>` - error: lifetime may not live long enough --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:32:5 | @@ -247,7 +235,7 @@ LL | require_static(ptr as _) = note: this was previously accepted by the compiler but was changed recently = help: see for more information -error: aborting due to 14 previous errors +error: aborting due to 13 previous errors -Some errors have detailed explanations: E0308, E0521. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0277, E0521. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr b/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr index a830ddc4468ff..f5ba79bcd4a59 100644 --- a/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr +++ b/tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr @@ -4,8 +4,10 @@ error[E0277]: expected an `Fn()` closure, found `()` LL | &mut *(ptr as *mut dyn Fn()) | ^^^ expected an `Fn()` closure, found `()` | - = help: the trait `Fn()` is not implemented for `()` + = help: within `()`, the trait `Fn()` is not implemented for `()` = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` + = note: required because it appears within the type `()` + = note: required for `*mut ()` to implement `CoerceUnsized<*mut dyn Fn()>` = note: required for the cast from `*mut ()` to `*mut dyn Fn()` error: aborting due to 1 previous error diff --git a/tests/ui/cast/trait-object-size-error-14366.stderr b/tests/ui/cast/trait-object-size-error-14366.stderr index 2451584e95151..828c7e6bccc4b 100644 --- a/tests/ui/cast/trait-object-size-error-14366.stderr +++ b/tests/ui/cast/trait-object-size-error-14366.stderr @@ -1,10 +1,11 @@ -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `&str: CoerceUnsized<&dyn Any>` is not satisfied in `str` --> $DIR/trait-object-size-error-14366.rs:4:14 | LL | let _x = "test" as &dyn (::std::any::Any); - | ^^^^^^ doesn't have a size known at compile-time + | ^^^^^^ within `str`, the trait `Sized` is not implemented for `str` | - = help: the trait `Sized` is not implemented for `str` + = note: `str` is considered to contain a `[u8]` slice for auto trait purposes + = note: required for `&str` to implement `CoerceUnsized<&dyn Any>` = note: required for the cast from `&'static str` to `&(dyn Any + 'static)` help: consider borrowing the value, since `&&'static str` can be coerced into `&(dyn Any + 'static)` | diff --git a/tests/ui/checked-type-alias/def-site-body-wf.stderr b/tests/ui/checked-type-alias/def-site-body-wf.stderr index 99ebc95616816..6c8259aed777c 100644 --- a/tests/ui/checked-type-alias/def-site-body-wf.stderr +++ b/tests/ui/checked-type-alias/def-site-body-wf.stderr @@ -19,18 +19,13 @@ LL | type _B = Vec; note: required by an implicit `Sized` bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references +error[E0477]: the type `&'a ()` does not fulfill the required lifetime --> $DIR/def-site-body-wf.rs:11:1 | LL | type _C<'a> = &'static &'a (); | ^^^^^^^^^^^ | - = note: the pointer is valid for the static lifetime -note: but the referenced data is only valid for the lifetime `'a` as defined here - --> $DIR/def-site-body-wf.rs:11:9 - | -LL | type _C<'a> = &'static &'a (); - | ^^ + = note: type must satisfy the static lifetime error[E0080]: evaluation panicked: explicit panic --> $DIR/def-site-body-wf.rs:14:16 @@ -50,5 +45,5 @@ LL | type _E = dyn Sized; error: aborting due to 5 previous errors -Some errors have detailed explanations: E0038, E0080, E0277, E0491. +Some errors have detailed explanations: E0038, E0080, E0277, E0477. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.stderr b/tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.stderr index e93fcd03a9662..b510fa0abfcfe 100644 --- a/tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.stderr +++ b/tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.stderr @@ -1,10 +1,8 @@ -error[E0275]: overflow normalizing the type alias `Recur` +error[E0275]: overflow evaluating the requirement `Recur == _` --> $DIR/opaq-ty-collection-infinite-recur.rs:16:20 | LL | struct Hold([(); { type Recur = Recur; 0 }]); | ^^^^^^^^^^ - | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error: aborting due to 1 previous error diff --git a/tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr b/tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr index d8270a0abddcd..0384f54d6ab34 100644 --- a/tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr +++ b/tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr @@ -4,13 +4,11 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self LL | impl Loop {} | ^ unconstrained type parameter -error[E0275]: overflow normalizing the type alias `Loop` +error[E0275]: overflow evaluating the requirement `Loop == _` --> $DIR/unconstrained-params-in-impl-due-to-overflow.rs:6:1 | LL | type Loop = Loop; | ^^^^^^^^^^^^ - | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error: aborting due to 2 previous errors diff --git a/tests/ui/checked-type-alias/unused-generic-parameters.fail.stderr b/tests/ui/checked-type-alias/unused-generic-parameters.fail.stderr index 05e3881cb090c..f01665a77b16e 100644 --- a/tests/ui/checked-type-alias/unused-generic-parameters.fail.stderr +++ b/tests/ui/checked-type-alias/unused-generic-parameters.fail.stderr @@ -18,11 +18,15 @@ LL | #[cfg(fail)] fn b(_: B) {} | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` -note: required by a bound on the type alias `B` +note: required by an implicit `Sized` bound in `B` --> $DIR/unused-generic-parameters.rs:26:8 | LL | type B = (); - | ^ required by this bound + | ^ required by the implicit `Sized` requirement on this type parameter in `B` +help: consider relaxing the implicit `Sized` restriction + | +LL | type B = (); + | ++++++++ error[E0080]: evaluation panicked: explicit panic --> $DIR/unused-generic-parameters.rs:34:26 @@ -37,12 +41,6 @@ LL | #[cfg(fail)] fn b(_: B) {} | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` -note: required by a bound on the type alias `B` - --> $DIR/unused-generic-parameters.rs:26:8 - | -LL | type B = (); - | ^ required by this bound - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 4 previous errors diff --git a/tests/ui/checked-type-alias/use-site-wf.stderr b/tests/ui/checked-type-alias/use-site-wf.stderr index b473a2db055e4..e195171ce6d47 100644 --- a/tests/ui/checked-type-alias/use-site-wf.stderr +++ b/tests/ui/checked-type-alias/use-site-wf.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `X: Copy` is not satisfied LL | fn b(_: B) {} | ^^^^ the trait `Copy` is not implemented for `X` | -note: required by a bound on the type alias `B` +note: required by a bound in `B` --> $DIR/use-site-wf.rs:6:11 | LL | type B = T; - | ^^^^ required by this bound + | ^^^^ required by this bound in `B` help: consider restricting type parameter `X` with trait `Copy` | LL | fn b(_: B) {} @@ -33,12 +33,6 @@ error[E0277]: the trait bound `X: Copy` is not satisfied LL | fn b(_: B) {} | ^^^^ the trait `Copy` is not implemented for `X` | -note: required by a bound on the type alias `B` - --> $DIR/use-site-wf.rs:6:11 - | -LL | type B = T; - | ^^^^ required by this bound - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider restricting type parameter `X` with trait `Copy` | LL | fn b(_: B) {} diff --git a/tests/ui/checked-type-alias/variance-overflow.stderr b/tests/ui/checked-type-alias/variance-overflow.stderr index 3ea61d9ade9f3..d3ce69cc2c7d2 100644 --- a/tests/ui/checked-type-alias/variance-overflow.stderr +++ b/tests/ui/checked-type-alias/variance-overflow.stderr @@ -7,29 +7,25 @@ LL | struct First(Second); = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead -error[E0275]: overflow normalizing the type alias `Second` +error[E0275]: overflow evaluating the requirement `Second == _` --> $DIR/variance-overflow.rs:15:17 | LL | struct First(Second); | ^^^^^^ - | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow normalizing the type alias `Second` +error[E0275]: overflow evaluating the requirement `Second == _` --> $DIR/variance-overflow.rs:19:1 | LL | type Second = Second; // diverging free alias type | ^^^^^^^^^^^ - | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow normalizing the type alias `Diverging<(((((((_,),),),),),),)>` +error[E0275]: overflow evaluating the requirement `Diverging<(T,)> == _` --> $DIR/variance-overflow.rs:26:1 | LL | type Diverging = Diverging<(T,)>; | ^^^^^^^^^^^^^^^^^ | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`variance_overflow`) error[E0392]: type parameter `T` is never used --> $DIR/variance-overflow.rs:29:13 @@ -42,13 +38,13 @@ LL | struct Wrap(Diverging); = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead -error[E0275]: overflow normalizing the type alias `Diverging<(((((((_,),),),),),),)>` +error[E0275]: overflow evaluating the requirement `Diverging == _` --> $DIR/variance-overflow.rs:29:16 | LL | struct Wrap(Diverging); | ^^^^^^^^^^^^ | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`variance_overflow`) error: aborting due to 6 previous errors diff --git a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index 3a4dbd2b9e0e2..337e8edf5c221 100644 --- a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -1,16 +1,19 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/expect-infer-var-appearing-twice.rs:14:5 +error[E0277]: expected an `FnOnce(_, _)` closure, found `{closure@$DIR/expect-infer-var-appearing-twice.rs:14:18: 14:34}` + --> $DIR/expect-infer-var-appearing-twice.rs:14:18 | LL | with_closure(|x: u32, y: i32| { - | ^ ---------------- found signature defined here - | _____| - | | + | _____------------_^ + | | | + | | required by a bound introduced by this call LL | | LL | | }); - | |______^ expected due to this + | |_____^ expected an `FnOnce(_, _)` closure, found `{closure@$DIR/expect-infer-var-appearing-twice.rs:14:18: 14:34}` | - = note: expected closure signature `fn(_, u32) -> _` - found closure signature `fn(_, i32) -> _` +help: the trait `FnOnce(_, _)` is not implemented for closure `{closure@$DIR/expect-infer-var-appearing-twice.rs:14:18: 14:34}` + --> $DIR/expect-infer-var-appearing-twice.rs:14:18 + | +LL | with_closure(|x: u32, y: i32| { + | ^^^^^^^^^^^^^^^^ note: required by a bound in `with_closure` --> $DIR/expect-infer-var-appearing-twice.rs:2:14 | @@ -20,4 +23,4 @@ LL | where F: FnOnce(A, A) error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closure_context/issue-26046-fn-mut.stderr b/tests/ui/closure_context/issue-26046-fn-mut.stderr index 0b58180bcca77..1e7290381a7d9 100644 --- a/tests/ui/closure_context/issue-26046-fn-mut.stderr +++ b/tests/ui/closure_context/issue-26046-fn-mut.stderr @@ -9,6 +9,12 @@ LL | num += 1; LL | Box::new(closure) | ----------------- the requirement to implement `Fn` derives from here | +note: required because it's used within this closure + --> $DIR/issue-26046-fn-mut.rs:4:19 + | +LL | let closure = || { + | ^^ + = note: required for `Box<{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}>` to implement `CoerceUnsized>` = note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}>` to `Box<(dyn Fn() + 'static)>` error: aborting due to 1 previous error diff --git a/tests/ui/closure_context/issue-26046-fn-once.stderr b/tests/ui/closure_context/issue-26046-fn-once.stderr index 66fb1856cbbbf..6b7625205240d 100644 --- a/tests/ui/closure_context/issue-26046-fn-once.stderr +++ b/tests/ui/closure_context/issue-26046-fn-once.stderr @@ -9,6 +9,12 @@ LL | vec LL | Box::new(closure) | ----------------- the requirement to implement `Fn` derives from here | +note: required because it's used within this closure + --> $DIR/issue-26046-fn-once.rs:4:19 + | +LL | let closure = move || { + | ^^^^^^^ + = note: required for `Box<{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}>` to implement `CoerceUnsized Vec>>` = note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}>` to `Box<(dyn Fn() -> Vec + 'static)>` error: aborting due to 1 previous error diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr index 96910375e09da..c13c0201a21bf 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr @@ -1,22 +1,18 @@ error[E0597]: `p` does not live long enough --> $DIR/borrowck-4.rs:12:25 | -LL | let mut p = Point {x: 1, y: 2 }; - | ----- binding `p` declared here -LL | let mut c = || { - | -- - | | - | _________________value captured here +LL | let mut p = Point {x: 1, y: 2 }; + | ----- binding `p` declared here +LL | let mut c = || { + | -- value captured here +LL | p.x += 5; +LL | println!("{:?}", p); + | ^ borrowed value does not live long enough +... +LL | } + | -- borrow later used here | | -LL | | p.x += 5; -LL | | println!("{:?}", p); - | | ^ borrowed value does not live long enough -LL | | -LL | | }; - | |_____- assignment requires that `p` is borrowed for `'static` -LL | c -LL | } - | - `p` dropped here while still borrowed + | `p` dropped here while still borrowed error: aborting due to 1 previous error diff --git a/tests/ui/closures/2229_closure_analysis/match/partial-move.stderr b/tests/ui/closures/2229_closure_analysis/match/partial-move.stderr index 09f9adf95d5bb..1dfcf5369e137 100644 --- a/tests/ui/closures/2229_closure_analysis/match/partial-move.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/partial-move.stderr @@ -1,75 +1,51 @@ -error[E0373]: closure may outlive the current function, but it borrows `x.0`, which is owned by the current function - --> $DIR/partial-move.rs:35:5 +error[E0597]: `x.0` does not live long enough + --> $DIR/partial-move.rs:37:15 | +LL | pub fn test_enum1(x: Enum) -> impl FnOnce() { + | - binding `x` declared here LL | || { - | ^^ may outlive borrowed value `x.0` + | -- value captured here LL | LL | match x { - | - `x.0` is borrowed here - | -note: closure is returned here - --> $DIR/partial-move.rs:35:5 - | -LL | / || { -LL | | -LL | | match x { -LL | | Enum::A(a, b) => { -... | -LL | | } - | |_____^ -help: to force the closure to take ownership of `x.0` (and any other referenced variables), use the `move` keyword - | -LL | move || { - | ++++ + | ^ borrowed value does not live long enough +... +LL | } + | -- borrow later used here + | | + | `x.0` dropped here while still borrowed -error[E0373]: closure may outlive the current function, but it borrows `x.0`, which is owned by the current function - --> $DIR/partial-move.rs:47:5 +error[E0597]: `x.0` does not live long enough + --> $DIR/partial-move.rs:49:15 | +LL | pub fn test_enum2(x: Enum) -> impl FnOnce() { + | - binding `x` declared here LL | || { - | ^^ may outlive borrowed value `x.0` + | -- value captured here LL | LL | match x { - | - `x.0` is borrowed here - | -note: closure is returned here - --> $DIR/partial-move.rs:47:5 - | -LL | / || { -LL | | -LL | | match x { -LL | | Enum::A(a, b) => { -... | -LL | | } - | |_____^ -help: to force the closure to take ownership of `x.0` (and any other referenced variables), use the `move` keyword - | -LL | move || { - | ++++ + | ^ borrowed value does not live long enough +... +LL | } + | -- borrow later used here + | | + | `x.0` dropped here while still borrowed -error[E0373]: closure may outlive the current function, but it borrows `x.0`, which is owned by the current function - --> $DIR/partial-move.rs:59:5 +error[E0597]: `x.0` does not live long enough + --> $DIR/partial-move.rs:61:15 | +LL | pub fn test_struct(x: Struct) -> impl FnOnce() { + | - binding `x` declared here LL | || { - | ^^ may outlive borrowed value `x.0` + | -- value captured here LL | LL | match x { - | - `x.0` is borrowed here - | -note: closure is returned here - --> $DIR/partial-move.rs:59:5 - | -LL | / || { -LL | | -LL | | match x { -LL | | Struct(a, b) => { -... | -LL | | } - | |_____^ -help: to force the closure to take ownership of `x.0` (and any other referenced variables), use the `move` keyword - | -LL | move || { - | ++++ + | ^ borrowed value does not live long enough +... +LL | } + | -- borrow later used here + | | + | `x.0` dropped here while still borrowed error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/closures/closure-arg-borrow-ice-issue-152331.stderr b/tests/ui/closures/closure-arg-borrow-ice-issue-152331.stderr index fdc9798a3acb3..170449cc1fa72 100644 --- a/tests/ui/closures/closure-arg-borrow-ice-issue-152331.stderr +++ b/tests/ui/closures/closure-arg-borrow-ice-issue-152331.stderr @@ -1,14 +1,18 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-borrow-ice-issue-152331.rs:2:5 +error[E0277]: expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` closure, found `{closure@$DIR/closure-arg-borrow-ice-issue-152331.rs:2:8: 2:36}` + --> $DIR/closure-arg-borrow-ice-issue-152331.rs:2:8 | LL | h2(|_: (), _: (), _: (), x: &_| {}); - | ^^^----------------------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` closure, found `{closure@$DIR/closure-arg-borrow-ice-issue-152331.rs:2:8: 2:36}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _` - found closure signature `fn((), (), (), &_) -> _` +help: the trait `for<'a, 't0> Fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` is not implemented for closure `{closure@$DIR/closure-arg-borrow-ice-issue-152331.rs:2:8: 2:36}` + --> $DIR/closure-arg-borrow-ice-issue-152331.rs:2:8 + | +LL | h2(|_: (), _: (), _: (), x: &_| {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` + found a closure with signature `fn((), (), (), &_)` note: required by a bound in `h2` --> $DIR/closure-arg-borrow-ice-issue-152331.rs:8:8 | @@ -16,16 +20,7 @@ LL | fn h2(_: F) LL | where LL | F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2` -help: consider adjusting the signature so it borrows its arguments - | -LL | h2(|_: &(), _: (), _: &(), x: &_| {}); - | + + -help: consider adjusting the signature so it does not borrow its argument - | -LL - h2(|_: (), _: (), _: (), x: &_| {}); -LL + h2(|_: (), _: (), _: (), x: _| {}); - | error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closures/closure-return-type-must-be-sized.stderr b/tests/ui/closures/closure-return-type-must-be-sized.stderr index 04ae7343bbe9b..ea1bebace91cd 100644 --- a/tests/ui/closures/closure-return-type-must-be-sized.stderr +++ b/tests/ui/closures/closure-return-type-must-be-sized.stderr @@ -1,11 +1,16 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation time - --> $DIR/closure-return-type-must-be-sized.rs:54:5 + --> $DIR/closure-return-type-must-be-sized.rs:54:14 | LL | a::foo:: dyn A>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` +note: required by a bound in `a::foo` + --> $DIR/closure-return-type-must-be-sized.rs:10:19 + | +LL | pub fn foo>() where F::Output: A { + | ^^^^^^^^^^ required by this bound in `foo` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:55:14 @@ -22,22 +27,32 @@ LL | pub fn bar R, R: ?Sized>() {} | ^^^^^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time - --> $DIR/closure-return-type-must-be-sized.rs:56:5 + --> $DIR/closure-return-type-must-be-sized.rs:56:14 | LL | a::baz:: dyn A>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` +note: required by a bound in `a::baz` + --> $DIR/closure-return-type-must-be-sized.rs:16:19 + | +LL | pub fn baz>() where F::Output: A, F::Output: Sized { + | ^^^^^^^^^^ required by this bound in `baz` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time - --> $DIR/closure-return-type-must-be-sized.rs:61:5 + --> $DIR/closure-return-type-must-be-sized.rs:61:14 | LL | b::foo:: dyn A>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` +note: required by a bound in `b::foo` + --> $DIR/closure-return-type-must-be-sized.rs:24:19 + | +LL | pub fn foo>() where F::Output: A { + | ^^^^^^ required by this bound in `foo` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:62:14 @@ -54,22 +69,32 @@ LL | pub fn bar R, R: ?Sized>() {} | ^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time - --> $DIR/closure-return-type-must-be-sized.rs:63:5 + --> $DIR/closure-return-type-must-be-sized.rs:63:14 | LL | b::baz:: dyn A>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` +note: required by a bound in `b::baz` + --> $DIR/closure-return-type-must-be-sized.rs:30:19 + | +LL | pub fn baz>() where F::Output: A, F::Output: Sized { + | ^^^^^^ required by this bound in `baz` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time - --> $DIR/closure-return-type-must-be-sized.rs:68:5 + --> $DIR/closure-return-type-must-be-sized.rs:68:14 | LL | c::foo:: dyn A>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` +note: required by a bound in `c::foo` + --> $DIR/closure-return-type-must-be-sized.rs:38:19 + | +LL | pub fn foo>() where F::Output: A { + | ^^^^^^^^^ required by this bound in `foo` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:69:14 @@ -86,13 +111,18 @@ LL | pub fn bar R, R: ?Sized>() {} | ^^^^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time - --> $DIR/closure-return-type-must-be-sized.rs:70:5 + --> $DIR/closure-return-type-must-be-sized.rs:70:14 | LL | c::baz:: dyn A>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` +note: required by a bound in `c::baz` + --> $DIR/closure-return-type-must-be-sized.rs:44:19 + | +LL | pub fn baz>() where F::Output: A, F::Output: Sized { + | ^^^^^^^^^ required by this bound in `baz` error: aborting due to 9 previous errors diff --git a/tests/ui/closures/closure-to-fn-pointer-lifetime-error.stderr b/tests/ui/closures/closure-to-fn-pointer-lifetime-error.stderr index 7466751e43b51..d79b4b458aaaa 100644 --- a/tests/ui/closures/closure-to-fn-pointer-lifetime-error.stderr +++ b/tests/ui/closures/closure-to-fn-pointer-lifetime-error.stderr @@ -1,22 +1,13 @@ -error[E0308]: mismatched types +error[E0277]: the trait bound `dyn Fn(&i32): Unsize Fn(&'a i32)>` is not satisfied --> $DIR/closure-to-fn-pointer-lifetime-error.rs:8:9 | LL | foo(bar); - | ^^^ one type is more general than the other + | ^^^ the nightly-only, unstable trait `Unsize Fn(&'a i32)>` is not implemented for `dyn Fn(&i32)` | - = note: expected trait object `dyn for<'a> Fn(&'a i32)` - found trait object `dyn Fn(&i32)` + = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information + = note: required for `Box` to implement `CoerceUnsized Fn(&'a i32)>>` + = note: required for the cast from `Box` to `Box<(dyn for<'a> Fn(&'a i32) + 'static)>` -error[E0308]: mismatched types - --> $DIR/closure-to-fn-pointer-lifetime-error.rs:8:9 - | -LL | foo(bar); - | ^^^ one type is more general than the other - | - = note: expected trait object `dyn for<'a> Fn(&'a i32)` - found trait object `dyn Fn(&i32)` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closures/generic-typed-nested-closures-59494.stderr b/tests/ui/closures/generic-typed-nested-closures-59494.stderr index 3a0ed68f20260..cd4179859d509 100644 --- a/tests/ui/closures/generic-typed-nested-closures-59494.stderr +++ b/tests/ui/closures/generic-typed-nested-closures-59494.stderr @@ -2,7 +2,10 @@ error[E0308]: mismatched types --> $DIR/generic-typed-nested-closures-59494.rs:21:40 | LL | let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); - | ^^^ recursive type with infinite-size name + | ^^^ expected inferred type, found `((_, _), _)` + | + = note: expected type `_` + found tuple `((_, _), _)` error: aborting due to 1 previous error diff --git a/tests/ui/closures/hrtb-closure-suggest-type-annotation.fixed b/tests/ui/closures/hrtb-closure-suggest-type-annotation.fixed index e4a948eb9f7bd..080874d8e236a 100644 --- a/tests/ui/closures/hrtb-closure-suggest-type-annotation.fixed +++ b/tests/ui/closures/hrtb-closure-suggest-type-annotation.fixed @@ -17,7 +17,7 @@ fn outer(buf: &mut [u8], func: F) -> usize where F: FnOnce(&mut [u8]) -> Result, { - let outer_closure = |buf: &mut [u8]| { + let outer_closure = |buf| { match func(buf) { Ok(n) => { println!("OK: {n}"); diff --git a/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr b/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr index a8382f3dc4d76..6b47c02f62202 100644 --- a/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr +++ b/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr @@ -1,40 +1,26 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/hrtb-closure-suggest-type-annotation.rs:33:5 +error[E0277]: expected an `FnOnce(&mut [u8])` closure, found `{closure@$DIR/hrtb-closure-suggest-type-annotation.rs:20:25: 20:30}` + --> $DIR/hrtb-closure-suggest-type-annotation.rs:33:16 | LL | inner(buf, outer_closure) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 mut [u8]) -> Result` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`... + | ----- ^^^^^^^^^^^^^ expected an `FnOnce(&mut [u8])` closure, found `{closure@$DIR/hrtb-closure-suggest-type-annotation.rs:20:25: 20:30}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> FnOnce(&'a mut [u8])` is not implemented for closure `{closure@$DIR/hrtb-closure-suggest-type-annotation.rs:20:25: 20:30}` + --> $DIR/hrtb-closure-suggest-type-annotation.rs:20:25 + | +LL | let outer_closure = |buf| { + | ^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a mut _)` + found a closure with signature `fn(&mut _)` +note: required by a bound in `inner` --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:8 | LL | fn inner(buf: &mut [u8], func: F) -> usize LL | where LL | F: FnOnce(&mut [u8]) -> Result, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `inner` - = note: ...but it actually implements `FnOnce<(&'2 mut [u8],)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let outer_closure = |buf: &mut [u8]| { - | +++++++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/hrtb-closure-suggest-type-annotation.rs:33:5 - | -LL | inner(buf, outer_closure) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 mut [u8]) -> Result` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`... - --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:29 - | -LL | fn inner(buf: &mut [u8], func: F) -> usize -LL | where -LL | F: FnOnce(&mut [u8]) -> Result, - | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `inner` - = note: ...but it actually implements `FnOnce<(&'2 mut [u8],)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let outer_closure = |buf: &mut [u8]| { - | +++++++++++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closures/issue-25439.stderr b/tests/ui/closures/issue-25439.stderr index c48423cbf5769..6ecea61632088 100644 --- a/tests/ui/closures/issue-25439.stderr +++ b/tests/ui/closures/issue-25439.stderr @@ -1,13 +1,16 @@ -error[E0644]: closure/coroutine type that references itself +error[E0277]: expected an `Fn(Helper<'_, {closure@$DIR/issue-25439.rs:8:9: 8:15}>, i32)` closure, found `{closure@$DIR/issue-25439.rs:8:9: 8:15}` --> $DIR/issue-25439.rs:8:9 | LL | fix(|_, x| x); - | ^^^^^^ recursive type with infinite-size name + | --- ^^^^^^^^ expected an `Fn(Helper<'_, {closure@$DIR/issue-25439.rs:8:9: 8:15}>, i32)` closure, found `{closure@$DIR/issue-25439.rs:8:9: 8:15}` + | | + | required by a bound introduced by this call | - = note: closures cannot capture themselves or take themselves as argument; - this error may be the result of a recent compiler bug-fix, - see issue #46062 - for more information +help: the trait `for<'a> Fn(Helper<'a, {closure@$DIR/issue-25439.rs:8:9: 8:15}>, i32)` is not implemented for closure `{closure@$DIR/issue-25439.rs:8:9: 8:15}` + --> $DIR/issue-25439.rs:8:9 + | +LL | fix(|_, x| x); + | ^^^^^^ note: required by a bound in `fix` --> $DIR/issue-25439.rs:3:33 | @@ -16,4 +19,4 @@ LL | fn fix(f: F) -> i32 where F: Fn(Helper, i32) -> i32 { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0644`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index d190a13430e44..46995c56deead 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -26,6 +26,8 @@ error[E0282]: type annotations needed | LL | fn server() -> impl { | ^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque error[E0308]: mismatched types --> $DIR/issue-78720.rs:8:39 diff --git a/tests/ui/closures/multiple-fn-bounds.stderr b/tests/ui/closures/multiple-fn-bounds.stderr index c99cbac01faf8..d48646d2f7e13 100644 --- a/tests/ui/closures/multiple-fn-bounds.stderr +++ b/tests/ui/closures/multiple-fn-bounds.stderr @@ -1,19 +1,18 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/multiple-fn-bounds.rs:10:5 +error[E0277]: expected an `Fn(char)` closure, found `{closure@$DIR/multiple-fn-bounds.rs:10:9: 10:17}` + --> $DIR/multiple-fn-bounds.rs:10:9 | LL | foo(move |x| v); - | ^^^^--------^^^ - | | | - | | found signature defined here - | expected due to this + | --- ^^^^^^^^^^ expected an `Fn(char)` closure, found `{closure@$DIR/multiple-fn-bounds.rs:10:9: 10:17}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `fn(_) -> _` - found closure signature `fn(&_) -> _` -note: closure inferred to have a different signature due to this bound - --> $DIR/multiple-fn-bounds.rs:1:11 +help: the trait `Fn(char)` is not implemented for closure `{closure@$DIR/multiple-fn-bounds.rs:10:9: 10:17}` + --> $DIR/multiple-fn-bounds.rs:10:9 | -LL | fn foo bool + Fn(char) -> bool>(f: F) { - | ^^^^^^^^^^^^^^^^^ +LL | foo(move |x| v); + | ^^^^^^^^ + = note: expected a closure with signature `fn(_)` + found a closure with signature `fn(&_)` note: required by a bound in `foo` --> $DIR/multiple-fn-bounds.rs:1:31 | @@ -22,4 +21,4 @@ LL | fn foo bool + Fn(char) -> bool>(f: F) { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closures/return-value-lifetime-error.fixed b/tests/ui/closures/return-value-lifetime-error.fixed index bf1f7e4a6cfd3..411c91f413ecc 100644 --- a/tests/ui/closures/return-value-lifetime-error.fixed +++ b/tests/ui/closures/return-value-lifetime-error.fixed @@ -10,7 +10,7 @@ fn main() { *count += 1; } - let _ = counts.iter().max_by_key(|(_, v)| **v); + let _ = counts.iter().max_by_key(|(_, v)| v); //~^ ERROR lifetime may not live long enough //~| HELP dereference the return value } diff --git a/tests/ui/closures/return-value-lifetime-error.stderr b/tests/ui/closures/return-value-lifetime-error.stderr index a0ad127db2891..9a1570e85c622 100644 --- a/tests/ui/closures/return-value-lifetime-error.stderr +++ b/tests/ui/closures/return-value-lifetime-error.stderr @@ -6,11 +6,6 @@ LL | let _ = counts.iter().max_by_key(|(_, v)| v); | | | | | return type of closure is &'2 &i32 | has type `&'1 (&i32, &i32)` - | -help: dereference the return value - | -LL | let _ = counts.iter().max_by_key(|(_, v)| **v); - | ++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/unsized-return-suggest-ref-issue-152064.stderr b/tests/ui/closures/unsized-return-suggest-ref-issue-152064.stderr index de08baa48461a..fd6677f608fd9 100644 --- a/tests/ui/closures/unsized-return-suggest-ref-issue-152064.stderr +++ b/tests/ui/closures/unsized-return-suggest-ref-issue-152064.stderr @@ -8,6 +8,15 @@ LL | for s in o.map(|s| s[3..8]) {} note: required by an implicit `Sized` bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/unsized-return-suggest-ref-issue-152064.rs:6:24 + | +LL | for s in o.map(|s| s[3..8]) {} + | ^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: the return type of a function must have a statically known size + error[E0277]: `Option` is not an iterator --> $DIR/unsized-return-suggest-ref-issue-152064.rs:6:14 | @@ -36,6 +45,15 @@ LL | for s in arr.map(|s| s[3..8]) {} note: required by an implicit `Sized` bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/unsized-return-suggest-ref-issue-152064.rs:12:26 + | +LL | for s in arr.map(|s| s[3..8]) {} + | ^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: the return type of a function must have a statically known size + error[E0277]: `Option<[u8]>` is not an iterator --> $DIR/unsized-return-suggest-ref-issue-152064.rs:12:14 | @@ -54,6 +72,6 @@ help: the following other types implement trait `IntoIterator` | = note: `&mut Option` -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr index f4d9f8a2ed29d..a1fb644e725a5 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr @@ -31,16 +31,12 @@ LL | async unsafe extern "cmse-nonsecure-entry" fn async_is_not_allowed() { | ^ error[E0700]: hidden type for `impl Future` captures lifetime that does not appear in bounds - --> $DIR/c-variadic.rs:18:76 + --> $DIR/c-variadic.rs:18:1 | -LL | async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) { - | _---------------------------------------------------------------------------^ - | | | | - | | | opaque type defined here - | | hidden type `{async fn body of async_and_c_variadic()}` captures the anonymous lifetime as defined here -... | -LL | | } - | |_^ +LL | async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- opaque type defined here + | | + | hidden type `{async fn body of async_and_c_variadic()}` captures the anonymous lifetime as defined here error: aborting due to 5 previous errors diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-105937.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-105937.stderr index 64f33d251d5f0..308f05c61181a 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-105937.stderr +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-105937.stderr @@ -1,4 +1,15 @@ -error: reached the recursion limit while instantiating `encode_num::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut Error>` +warning: overflow evaluating the requirement `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as ExampleWriter>::Error == ()` + | + = note: which requires `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as ExampleWriter>::Error == ()` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_105937`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the recursion limit while instantiating `encode_num::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut Error>` --> $DIR/recursion-issue-105937.rs:6:9 | LL | encode_num(n / 16, &mut writer)?; @@ -10,5 +21,5 @@ note: `encode_num` defined here LL | pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-117696-1.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-117696-1.stderr index b261530c010d5..ead8ea1b90dd3 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-117696-1.stderr +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-117696-1.stderr @@ -1,11 +1,41 @@ -error: reached the recursion limit while instantiating `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut Empty as Iterator>::count` - --> $DIR/recursion-issue-117696-1.rs:25:9 +warning: overflow evaluating the requirement `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` | -LL | T::count(it); - | ^^^^^^^^^^^^ + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: which requires `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _: Iterator` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_117696_1`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut Empty>` + --> $DIR/recursion-issue-117696-1.rs:28:9 + | +LL | rec(identity(&mut it)) + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `rec` defined here + --> $DIR/recursion-issue-117696-1.rs:20:1 | -note: `count` defined here - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL +LL | / fn rec(mut it: T) +LL | | where +LL | | T: Iterator, + | |________________^ -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-117696-2.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-117696-2.stderr index 88cfb8904d2c7..f152937b0b357 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-117696-2.stderr +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-117696-2.stderr @@ -1,4 +1,15 @@ -error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut std::option::IntoIter<()>>` +warning: overflow evaluating the requirement `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as Iterator>::Item == ()` + | + = note: which requires `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as Iterator>::Item == ()` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_117696_2`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut std::option::IntoIter<()>>` --> $DIR/recursion-issue-117696-2.rs:11:9 | LL | rec(&mut it); @@ -10,5 +21,5 @@ note: `rec` defined here LL | fn rec(mut it: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-118590.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-118590.stderr index bf07c19f70479..1ce64c4795585 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-118590.stderr +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-118590.stderr @@ -1,11 +1,32 @@ -error: reached the recursion limit while instantiating `>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> as Iterator>::peekable` - --> $DIR/recursion-issue-118590.rs:10:13 +warning: overflow evaluating the requirement `Skip>>>>>>>>>>: Iterator` | -LL | recurse(nums.skip(42).peekable()) - | ^^^^^^^^^^^^^^^^^^^^^^^^ + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: which requires `Skip>>>>>>>>>>: Iterator` + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: which requires `Skip>>>>>>>>>>: Iterator` + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: which requires `Skip>>>>>>>>>>: Iterator` + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: which requires `Skip>>>>>>>>>>: Iterator` + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: which requires `Skip>>>>>>>>>>: Iterator` + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: which requires `Skip>>>>>>>>>>: Iterator` + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: which requires `Skip>>>>>>>>>>: Iterator` + = note: which requires `Peekable>>>>>>>>>>: Iterator` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_118590`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error[E0275]: overflow evaluating the requirement `>>>>>> as Iterator>::Item == _` | -note: `peekable` defined here - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_118590`) -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-137823.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-137823.stderr index 3d80c45685f50..773322e8922e5 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-137823.stderr +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-137823.stderr @@ -1,14 +1,25 @@ -error: reached the recursion limit while instantiating `convert2::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/recursion-issue-137823.rs:8:5 +warning: overflow evaluating the requirement `>>>>>>>>>> as Converter>::Out == ()` | -LL | convert2::>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: which requires `>>>>>>>>>> as Converter>::Out == ()` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_137823`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the recursion limit while instantiating `convert::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/recursion-issue-137823.rs:13:5 + | +LL | convert::() + | ^^^^^^^^^^^^^^ | -note: `convert2` defined here - --> $DIR/recursion-issue-137823.rs:12:1 +note: `convert` defined here + --> $DIR/recursion-issue-137823.rs:7:1 | -LL | fn convert2() -> S::Out { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn convert() -> S::Out { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-92470.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-92470.stderr index 1775a99928853..e96c39d5326d4 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-92470.stderr +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-92470.stderr @@ -10,7 +10,18 @@ LL | encode(&mut encoder); = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error: reached the recursion limit while instantiating `encode::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut EncoderImpl>` +warning: overflow evaluating the requirement `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as Encoder>::W == ()` + | + = note: which requires `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as Encoder>::W == ()` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_92470`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the recursion limit while instantiating `encode::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut EncoderImpl>` --> $DIR/recursion-issue-92470.rs:15:5 | LL | encode(&mut encoder); @@ -22,5 +33,5 @@ note: `encode` defined here LL | fn encode(mut encoder: E) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error; 2 warnings emitted diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-95134.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-95134.stderr index 0c49e0010f54c..06dfaa524e884 100644 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-95134.stderr +++ b/tests/ui/codegen/normalization-overflow/recursion-issue-95134.stderr @@ -1,4 +1,15 @@ -error: reached the recursion limit while instantiating `encode_num::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut EmptyWriter>` +warning: overflow evaluating the requirement `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as ExampleWriter>::Error == ()` + | + = note: which requires `<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut _ as ExampleWriter>::Error == ()` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursion_issue_95134`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the recursion limit while instantiating `encode_num::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut EmptyWriter>` --> $DIR/recursion-issue-95134.rs:6:9 | LL | encode_num(n / 16, &mut writer)?; @@ -10,5 +21,5 @@ note: `encode_num` defined here LL | pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/codegen/overflow-during-mono.stderr b/tests/ui/codegen/overflow-during-mono.stderr index a5f5aafb7c7c2..3cbc373fd1182 100644 --- a/tests/ui/codegen/overflow-during-mono.stderr +++ b/tests/ui/codegen/overflow-during-mono.stderr @@ -1,13 +1,41 @@ -error[E0275]: overflow evaluating the requirement `for<'a> {closure@$DIR/overflow-during-mono.rs:14:41: 14:44}: FnMut(&'a _)` +warning: overflow evaluating the requirement `Filter, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>: IntoIterator` | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "64"]` attribute to your crate (`overflow_during_mono`) - = note: required for `Filter, {closure@overflow-during-mono.rs:14:41}>` to implement `Iterator` - = note: 31 redundant requirements hidden - = note: required for `Filter, {closure@...}>, {closure@...}>` to implement `Iterator` - = note: required for `Filter, {closure@...}>, {closure@...}>` to implement `IntoIterator` + = note: which requires `Filter, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>: Iterator` + = note: which requires `, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}> as Iterator>::Item == i32` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "64"]` attribute to your crate (`overflow_during_mono`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: overflow while checking whether `{closure@PolymorphicIter<[_]>::try_fold<(), {closure@...}, _>::{closure#0}}` requires drop + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/overflow-during-mono.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +note: the above error was encountered while instantiating `fn ::try_fold::<(), {closure@...}, _>` + --> $SRC_DIR/core/src/array/iter/iter_inner.rs:LL:COL + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/overflow-during-mono.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: reached the recursion limit while instantiating `quicksort::, {closure@...}>, _, i32>` + --> $DIR/overflow-during-mono.rs:17:25 + | +LL | let mut v = quicksort(less); + | ^^^^^^^^^^^^^^^ + | +note: `quicksort` defined here + --> $DIR/overflow-during-mono.rs:7:1 + | +LL | / fn quicksort, I: IntoIterator, T: Ord>( +LL | | i: I, +LL | | ) -> Vec { + | |___________^ = note: the full name for the type has been written to '$TEST_BUILD_DIR/overflow-during-mono.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: aborting due to 1 previous error +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/coercion/hr_alias_normalization_leaking_vars.stderr b/tests/ui/coercion/hr_alias_normalization_leaking_vars.stderr index c549748f2d0d1..95f332a39c880 100644 --- a/tests/ui/coercion/hr_alias_normalization_leaking_vars.stderr +++ b/tests/ui/coercion/hr_alias_normalization_leaking_vars.stderr @@ -12,6 +12,12 @@ help: this trait has no implementations, consider adding one LL | trait LendingIterator { | ^^^^^^^^^^^^^^^^^^^^^ +error: the type `Box fn(<() as LendingIterator>::Item<'a>)>` is not well-formed + --> $DIR/hr_alias_normalization_leaking_vars.rs:34:36 + | +LL | LendingIterator::for_each(&(), f); + | ^ + error[E0308]: mismatched types --> $DIR/hr_alias_normalization_leaking_vars.rs:34:36 | @@ -40,7 +46,7 @@ help: this trait has no implementations, consider adding one LL | trait LendingIterator { | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/coercion/issue-53475.stderr b/tests/ui/coercion/issue-53475.stderr index af114519add6c..c89edbf41d479 100644 --- a/tests/ui/coercion/issue-53475.stderr +++ b/tests/ui/coercion/issue-53475.stderr @@ -12,6 +12,21 @@ help: consider adding an explicit lifetime bound LL | impl CoerceUnsized> for Foo {} | +++++++++ -error: aborting due to 1 previous error +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/issue-53475.rs:10:1 + | +LL | impl CoerceUnsized> for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | impl CoerceUnsized> for Foo {} + | +++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/coercion/structural_identity_dependent_reborrows.stderr b/tests/ui/coercion/structural_identity_dependent_reborrows.stderr index d598a4fa76331..df568379fe9e9 100644 --- a/tests/ui/coercion/structural_identity_dependent_reborrows.stderr +++ b/tests/ui/coercion/structural_identity_dependent_reborrows.stderr @@ -1,25 +1,20 @@ -error[E0373]: closure may outlive the current function, but it borrows `b`, which is owned by the current function - --> $DIR/structural_identity_dependent_reborrows.rs:16:5 +error[E0597]: `b` does not live long enough + --> $DIR/structural_identity_dependent_reborrows.rs:18:28 | +LL | fn bar<'a>(b: &'a ()) -> impl Fn() { + | - binding `b` declared here LL | || { - | ^^ may outlive borrowed value `b` + | -- value captured here LL | LL | expected::<&'a ()>(b); - | - `b` is borrowed here - | -note: closure is returned here - --> $DIR/structural_identity_dependent_reborrows.rs:16:5 - | -LL | / || { -LL | | -LL | | expected::<&'a ()>(b); -LL | | } - | |_____^ -help: to force the closure to take ownership of `b` (and any other referenced variables), use the `move` keyword - | -LL | move || { - | ++++ + | ^ borrowed value does not live long enough +LL | } +LL | } + | - + | | + | `b` dropped here while still borrowed + | borrow later used here error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr index dedc895104162..63b0130255ee7 100644 --- a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr +++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr @@ -28,43 +28,6 @@ help: consider introducing a `where` clause, but there might be an alternative b LL | impl Trait for W>> where W>: Trait {} | ++++++++++++++++++++ -error[E0277]: the trait bound `W: Trait` is not satisfied - --> $DIR/best-obligation-ICE.rs:10:19 - | -LL | impl Trait for W>> {} - | ^^^^^^^^^^ unsatisfied trait bound - | -help: the trait `Trait` is not implemented for `W` - --> $DIR/best-obligation-ICE.rs:9:1 - | -LL | struct W(*mut T); - | ^^^^^^^^^^^^^^^^^^ -note: required by a bound in `W` - --> $DIR/best-obligation-ICE.rs:9:13 - | -LL | struct W(*mut T); - | ^^^^^ required by this bound in `W` -help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement - | -LL | impl Trait for W>> where W: Trait {} - | +++++++++++++++++ - -error[E0277]: the trait bound `T: Trait` is not satisfied - --> $DIR/best-obligation-ICE.rs:10:19 - | -LL | impl Trait for W>> {} - | ^^^^^^^^^^ the trait `Trait` is not implemented for `T` - | -note: required by a bound in `W` - --> $DIR/best-obligation-ICE.rs:9:13 - | -LL | struct W(*mut T); - | ^^^^^ required by this bound in `W` -help: consider restricting type parameter `T` with trait `Trait` - | -LL | impl Trait for W>> {} - | +++++++ - error[E0119]: conflicting implementations of trait `NoOverlap` for type `W>>>` --> $DIR/best-obligation-ICE.rs:18:1 | @@ -73,7 +36,7 @@ LL | impl NoOverlap for T {} LL | impl> NoOverlap for W {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W>>>` -error: aborting due to 5 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0046, E0119, E0277. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/coherence/generalize-associated-type-alias.stderr b/tests/ui/coherence/generalize-associated-type-alias.stderr index e65205dbccbd1..c14dedbc6fe88 100644 --- a/tests/ui/coherence/generalize-associated-type-alias.stderr +++ b/tests/ui/coherence/generalize-associated-type-alias.stderr @@ -9,20 +9,38 @@ help: consider introducing a `where` clause, but there might be an alternative b LL | impl<'a, T> Overlap<(&'a (), Assoc<'a, T>)> for T where *const T: ToUnit<'a> {} | ++++++++++++++++++++++++++ -error[E0277]: the trait bound `T: Overlap<(&'a (), _)>` is not satisfied +error[E0277]: the trait bound `T: Overlap<(&'a (), <*const T as ToUnit<'a>>::Unit)>` is not satisfied --> $DIR/generalize-associated-type-alias.rs:18:49 | LL | impl<'a, T> Overlap<(&'a (), Assoc<'a, T>)> for T {} - | ^ the trait `Overlap<(&'a (), _)>` is not implemented for `T` + | ^ the trait `Overlap<(&'a (), <*const T as ToUnit<'a>>::Unit)>` is not implemented for `T` | -help: the trait `Overlap<(&'a (), _)>` is not implemented for `T` - but trait `Overlap<(&(), ())>` is implemented for `u32` - --> $DIR/generalize-associated-type-alias.rs:18:1 +help: consider restricting type parameter `T` with trait `Overlap` + | +LL | impl<'a, T: Overlap<(&'a (), <*const T as ToUnit<'a>>::Unit)>> Overlap<(&'a (), Assoc<'a, T>)> for T {} + | +++++++++++++++++++++++++++++++++++++++++++++++++++ + +error[E0277]: the size for values of type `(&'a (), <*const T as ToUnit<'a>>::Unit)` cannot be known at compilation time + --> $DIR/generalize-associated-type-alias.rs:18:13 | LL | impl<'a, T> Overlap<(&'a (), Assoc<'a, T>)> for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: for that trait implementation, expected `u32`, found `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(&'a (), <*const T as ToUnit<'a>>::Unit)` +note: required by an implicit `Sized` bound in `Overlap` + --> $DIR/generalize-associated-type-alias.rs:12:15 + | +LL | trait Overlap {} + | ^ required by the implicit `Sized` requirement on this type parameter in `Overlap` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl<'a, T> Overlap<(&'a (), Assoc<'a, T>)> for T where (&'a (), <*const T as ToUnit<'a>>::Unit): Sized {} + | +++++++++++++++++++++++++++++++++++++++++++++++++++++ +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Overlap {} + | ++++++++ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/collections/hashmap/hashset_generics.stderr b/tests/ui/collections/hashmap/hashset_generics.stderr index a677b6671eb8e..92fe69e77a835 100644 --- a/tests/ui/collections/hashmap/hashset_generics.stderr +++ b/tests/ui/collections/hashmap/hashset_generics.stderr @@ -7,11 +7,11 @@ LL | #[derive(PartialEq)] LL | pub parameters: HashSet, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `String` does not implement `BuildHasher` - --> $SRC_DIR/alloc/src/string.rs:LL:COL +note: `HashSet` does not implement `PartialEq` + --> $SRC_DIR/std/src/collections/hash/set.rs:LL:COL + ::: $SRC_DIR/std/src/collections/hash/set.rs:LL:COL | - = note: `String` is defined in another crate - = help: you might have intended to use a HashMap instead + = note: `HashSet` is defined in another crate error[E0599]: the method `insert` exists for struct `HashSet`, but its trait bounds were not satisfied --> $DIR/hashset_generics.rs:16:8 diff --git a/tests/ui/compare-method/proj-outlives-region.stderr b/tests/ui/compare-method/proj-outlives-region.stderr index b349e24f589b4..c48c09f342e11 100644 --- a/tests/ui/compare-method/proj-outlives-region.stderr +++ b/tests/ui/compare-method/proj-outlives-region.stderr @@ -1,12 +1,16 @@ -error[E0276]: impl has stricter requirements than trait +error[E0309]: the parameter type `U` may not live long enough --> $DIR/proj-outlives-region.rs:9:23 | -LL | fn foo() where T: 'a; - | --------------------- definition of `foo` from trait -... +LL | impl<'a, U: Iterator> Master<'a, U::Item, U> for () { + | -- the parameter type `U` must be valid for the lifetime `'a` as defined here... LL | fn foo() where U: 'a { } - | ^^ impl has extra requirement `U: 'a` + | ^^ ...so that the type `U` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | impl<'a, U: Iterator + 'a> Master<'a, U::Item, U> for () { + | ++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/compare-method/region-extra-2.stderr b/tests/ui/compare-method/region-extra-2.stderr index d19d4f28f12a9..df5860f0641cb 100644 --- a/tests/ui/compare-method/region-extra-2.stderr +++ b/tests/ui/compare-method/region-extra-2.stderr @@ -1,18 +1,20 @@ -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/region-extra-2.rs:9:53 | -LL | fn renew<'b: 'a>(self) -> &'b mut [T]; - | -------------------------------------- definition of `renew` from trait -... LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { - | ^^ impl has extra requirement `'a: 'b` + | ^^ | -help: copy the `where` clause predicates from the trait +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/region-extra-2.rs:8:6 | -LL - fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { -LL + fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a { +LL | impl<'a, T> Tr<'a, T> for &'a mut [T] { + | ^^ +note: but lifetime parameter must outlive the lifetime `'b` as defined here + --> $DIR/region-extra-2.rs:9:14 | +LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { + | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/compare-method/region-extra.stderr b/tests/ui/compare-method/region-extra.stderr index 065b3c152edca..1768d29774226 100644 --- a/tests/ui/compare-method/region-extra.stderr +++ b/tests/ui/compare-method/region-extra.stderr @@ -1,18 +1,20 @@ -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/region-extra.rs:9:24 | -LL | fn foo(); - | --------- definition of `foo` from trait -... LL | fn foo() where 'a: 'b { } - | ^^ impl has extra requirement `'a: 'b` + | ^^ | -help: remove the `where` clause +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/region-extra.rs:8:6 | -LL - fn foo() where 'a: 'b { } -LL + fn foo() { } +LL | impl<'a, 'b> Master<'a, 'b> for () { + | ^^ +note: but lifetime parameter must outlive the lifetime `'b` as defined here + --> $DIR/region-extra.rs:8:10 | +LL | impl<'a, 'b> Master<'a, 'b> for () { + | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/compare-method/region-unrelated.stderr b/tests/ui/compare-method/region-unrelated.stderr index 75a4d51ce8fb1..056e674750fb2 100644 --- a/tests/ui/compare-method/region-unrelated.stderr +++ b/tests/ui/compare-method/region-unrelated.stderr @@ -1,12 +1,16 @@ -error[E0276]: impl has stricter requirements than trait +error[E0309]: the parameter type `V` may not live long enough --> $DIR/region-unrelated.rs:9:23 | -LL | fn foo() where T: 'a; - | --------------------- definition of `foo` from trait -... +LL | impl<'a, U, V> Master<'a, U, V> for () { + | -- the parameter type `V` must be valid for the lifetime `'a` as defined here... LL | fn foo() where V: 'a { } - | ^^ impl has extra requirement `V: 'a` + | ^^ ...so that the type `V` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | impl<'a, U, V: 'a> Master<'a, U, V> for () { + | ++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/const-generics/adt_const_params/cyclic-const-generic-issue-144719.stderr b/tests/ui/const-generics/adt_const_params/cyclic-const-generic-issue-144719.stderr index 2b278d6aba183..c66f7ff8aba29 100644 --- a/tests/ui/const-generics/adt_const_params/cyclic-const-generic-issue-144719.stderr +++ b/tests/ui/const-generics/adt_const_params/cyclic-const-generic-issue-144719.stderr @@ -6,14 +6,5 @@ LL | foo::(); | = note: constants whose type references itself cannot be used as patterns -error: constant main::{constant#0} cannot be used as pattern - --> $DIR/cyclic-const-generic-issue-144719.rs:17:11 - | -LL | foo::(); - | ^ - | - = note: constants whose type references itself cannot be used as patterns - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/adt_const_params/reference_pointee_is_const_param-2.stderr b/tests/ui/const-generics/adt_const_params/reference_pointee_is_const_param-2.stderr index 0fe92f253a05e..d92eaaa1bd613 100644 --- a/tests/ui/const-generics/adt_const_params/reference_pointee_is_const_param-2.stderr +++ b/tests/ui/const-generics/adt_const_params/reference_pointee_is_const_param-2.stderr @@ -4,6 +4,25 @@ error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type LL | impl ConstParamTy_ for &'static ConstStrU {} | ^^^^^^^^^^^^^^^^^^ this field does not implement `ConstParamTy_` -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `A` can be evaluated` + --> $DIR/reference_pointee_is_const_param-2.rs:26:15 + | +LL | chars_s::(); + | ^ cannot satisfy `the constant `A` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/reference_pointee_is_const_param-2.rs:26:5 + | +LL | chars_s::(); + | ^^^^^^^^^^^^ cannot infer the value of the const parameter `S` declared on the function `chars_s` + | +note: required by a const generic parameter in `chars_s` + --> $DIR/reference_pointee_is_const_param-2.rs:20:18 + | +LL | const fn chars_s() -> [char; 3] { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `chars_s` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0204`. +Some errors have detailed explanations: E0204, E0284. +For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-1.stderr b/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-1.stderr index 4125461f92b2d..4f5f5bdc902f1 100644 --- a/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-1.stderr +++ b/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-1.stderr @@ -15,6 +15,8 @@ LL | pub struct Walk { | = help: add `#![feature(unsized_const_params)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: required for `&'static u32` to implement `ConstParamTy_` + = note: 1 redundant requirement hidden = note: required for `[&'static u32]` to implement `ConstParamTy_` error[E0277]: the size for values of type `[&'static u32]` cannot be known at compilation time diff --git a/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr b/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr index ffbd0acd0f1e9..16ee9fb130f7c 100644 --- a/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr +++ b/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr @@ -29,47 +29,26 @@ LL | LL | nested: &'static Bar, | ----------------------------------------- this field does not implement `ConstParamTy_` | -note: the `ConstParamTy_` impl for `&'static Bar<(dyn Debug + 'static)>` requires that `(dyn Debug + 'static): ConstParamTy_` - --> $DIR/unsizing-wfcheck-issue-126272.rs:11:13 - | -LL | nested: &'static Bar, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: the `ConstParamTy_` impl for `&'static Bar<(dyn Debug + 'static)>` requires that `(dyn Debug + 'static): Eq` - --> $DIR/unsizing-wfcheck-issue-126272.rs:11:13 - | -LL | nested: &'static Bar, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the `ConstParamTy_` impl for `&'static Bar<(dyn Debug + 'static)>` requires that `(dyn Debug + 'static): Sized` --> $DIR/unsizing-wfcheck-issue-126272.rs:11:13 | LL | nested: &'static Bar, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time +error[E0277]: `&&'static Bar<(dyn Debug + 'static)>` doesn't implement `Debug` --> $DIR/unsizing-wfcheck-issue-126272.rs:11:5 | LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] | ----- in this derive macro expansion ... LL | nested: &'static Bar, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `&&'static Bar<(dyn Debug + 'static)>`, the trait `Debug` is not implemented for `&&'static Bar<(dyn Debug + 'static)>` | - = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)` help: the trait `Debug` is implemented for `Bar` --> $DIR/unsizing-wfcheck-issue-126272.rs:19:10 | LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] | ^^^^^ -note: required for `Bar<(dyn Debug + 'static)>` to implement `Debug` - --> $DIR/unsizing-wfcheck-issue-126272.rs:20:8 - | -LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] - | ----- in this derive macro expansion -LL | struct Bar(T); - | ^^^ - unsatisfied trait bound - = note: 2 redundant requirements hidden - = note: required for `&&'static Bar<(dyn Debug + 'static)>` to implement `Debug` - = note: required for the cast from `&&&'static Bar<(dyn Debug + 'static)>` to `&dyn Debug` error[E0369]: binary operation `==` cannot be applied to type `&Bar` --> $DIR/unsizing-wfcheck-issue-126272.rs:11:5 @@ -80,55 +59,23 @@ LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] LL | nested: &'static Bar, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `dyn Debug: Eq` is not satisfied +error[E0277]: the trait bound `&'static Bar: Eq` is not satisfied --> $DIR/unsizing-wfcheck-issue-126272.rs:11:5 | LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] | -- in this derive macro expansion ... LL | nested: &'static Bar, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `dyn Debug` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `&'static Bar` | help: the trait `Eq` is implemented for `Bar` --> $DIR/unsizing-wfcheck-issue-126272.rs:19:28 | LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] | ^^ -note: required for `Bar` to implement `Eq` - --> $DIR/unsizing-wfcheck-issue-126272.rs:20:8 - | -LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] - | -- in this derive macro expansion -LL | struct Bar(T); - | ^^^ - type parameter would need to implement `Eq` - = note: 1 redundant requirement hidden - = note: required for `&'static Bar` to implement `Eq` note: required by a bound in `std::cmp::AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL -error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/unsizing-wfcheck-issue-126272.rs:11:5 - | -LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] - | -- in this derive macro expansion -... -LL | nested: &'static Bar, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `dyn Debug` -note: required by an implicit `Sized` bound in `Bar` - --> $DIR/unsizing-wfcheck-issue-126272.rs:20:12 - | -LL | struct Bar(T); - | ^ required by the implicit `Sized` requirement on this type parameter in `Bar` -help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` - --> $DIR/unsizing-wfcheck-issue-126272.rs:20:12 - | -LL | struct Bar(T); - | ^ - ...if indirection were used here: `Box` - | | - | this could be changed to `T: ?Sized`... - error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time --> $DIR/unsizing-wfcheck-issue-126272.rs:25:33 | @@ -149,7 +96,7 @@ LL | struct Bar(T); | | | this could be changed to `T: ?Sized`... -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors Some errors have detailed explanations: E0204, E0277, E0369. For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/const-generics/associated-const-bindings/bound-var-in-ty-not-wf.stderr b/tests/ui/const-generics/associated-const-bindings/bound-var-in-ty-not-wf.stderr index a4f97525b5156..8e73b29d9f83c 100644 --- a/tests/ui/const-generics/associated-const-bindings/bound-var-in-ty-not-wf.stderr +++ b/tests/ui/const-generics/associated-const-bindings/bound-var-in-ty-not-wf.stderr @@ -1,16 +1,16 @@ -error: higher-ranked subtype error +error[E0277]: the trait bound `for<'a> fn(&'a str) -> &'a str: Project` is not satisfied --> $DIR/bound-var-in-ty-not-wf.rs:21:13 | LL | K = const { () } - | ^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/bound-var-in-ty-not-wf.rs:21:13 + | ^^^^^^^^^^^^ the trait `Project` is not implemented for `for<'a> fn(&'a str) -> &'a str` | -LL | K = const { () } - | ^^^^^^^^^^^^ +help: the trait `Project` is not implemented for `for<'a> fn(&'a _) -> &'a _` + but it is implemented for `fn(&_) -> &_` + --> $DIR/bound-var-in-ty-not-wf.rs:30:1 | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +LL | impl Project for fn(T) -> T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-mismatch.stderr b/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-mismatch.stderr index 82b4f7ca9ba6e..6534d87009604 100644 --- a/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-mismatch.stderr +++ b/tests/ui/const-generics/associated-const-bindings/dyn-compat-const-mismatch.stderr @@ -6,6 +6,8 @@ LL | let _: &dyn Trait = &(); | = note: expected constant `0` found constant `1` + = note: required because it appears within the type `()` + = note: required for `&()` to implement `CoerceUnsized<&dyn Trait>` = note: required for the cast from `&()` to `&dyn Trait` error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/associated-const-bindings/dyn-compat-self-bound-on-assoc-const-allowed-and-enforced.stderr b/tests/ui/const-generics/associated-const-bindings/dyn-compat-self-bound-on-assoc-const-allowed-and-enforced.stderr index 38a5ec4e1a9f8..74e19a86b797c 100644 --- a/tests/ui/const-generics/associated-const-bindings/dyn-compat-self-bound-on-assoc-const-allowed-and-enforced.stderr +++ b/tests/ui/const-generics/associated-const-bindings/dyn-compat-self-bound-on-assoc-const-allowed-and-enforced.stderr @@ -1,22 +1,13 @@ -error[E0277]: the trait bound `(): Bound` is not satisfied +error[E0271]: type mismatch resolving `<() as Trait>::N == 0` --> $DIR/dyn-compat-self-bound-on-assoc-const-allowed-and-enforced.rs:24:32 | LL | let _: &dyn Trait = &(); - | ^^^ the trait `Bound` is not implemented for `()` + | ^^^ types differ | -help: this trait has no implementations, consider adding one - --> $DIR/dyn-compat-self-bound-on-assoc-const-allowed-and-enforced.rs:19:1 - | -LL | trait Bound {} - | ^^^^^^^^^^^ -note: required by a bound in `Trait::N` - --> $DIR/dyn-compat-self-bound-on-assoc-const-allowed-and-enforced.rs:12:30 - | -LL | trait Trait { -LL | #[rustc_always_gca] -LL | const N: i32 where Self: Bound; - | ^^^^^ required by this bound in `Trait::N` + = note: required because it appears within the type `()` + = note: required for `&()` to implement `CoerceUnsized<&dyn Trait>` + = note: required for the cast from `&()` to `&dyn Trait` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr b/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr index 1eaa635e13532..11f0ea64036d3 100644 --- a/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr +++ b/tests/ui/const-generics/associated-const-bindings/mismatched-types-with-generic-in-ace.stderr @@ -12,19 +12,18 @@ LL | #[rustc_always_gca] LL | const ASSOC: u32; | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::ASSOC` -error: the constant `10` is not of type `u32` - --> $DIR/mismatched-types-with-generic-in-ace.rs:19:5 +error[E0271]: type mismatch resolving `<() as Foo>::ASSOC<10> == 10` + --> $DIR/mismatched-types-with-generic-in-ace.rs:19:19 | LL | bar::<10_u64, ()>(); - | ^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64` + | ^^ types differ | -note: required by a const generic parameter in `Foo::ASSOC` - --> $DIR/mismatched-types-with-generic-in-ace.rs:8:17 +note: required by a bound in `bar` + --> $DIR/mismatched-types-with-generic-in-ace.rs:15:29 | -LL | trait Foo { -LL | #[rustc_always_gca] -LL | const ASSOC: u32; - | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::ASSOC` +LL | fn bar = { N }>>() {} + | ^^^^^^^^^^^^^^^^ required by this bound in `bar` error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/const-generics/associated-const-bindings/unconstrained_impl_param.stderr b/tests/ui/const-generics/associated-const-bindings/unconstrained_impl_param.stderr index 8ca341e4b23f1..2d5a7262508d2 100644 --- a/tests/ui/const-generics/associated-const-bindings/unconstrained_impl_param.stderr +++ b/tests/ui/const-generics/associated-const-bindings/unconstrained_impl_param.stderr @@ -14,13 +14,22 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self LL | impl Trait for () where (U,): AssocConst {} | ^ unconstrained type parameter -error[E0282]: type annotations needed - --> $DIR/unconstrained_impl_param.rs:21:5 +error[E0283]: type annotations needed: cannot satisfy `(): Trait` + --> $DIR/unconstrained_impl_param.rs:21:9 | LL | (): Trait, - | ^^^^^^^^^ cannot infer type for type parameter `U` + | ^^^^^ + | +note: multiple `impl`s or `where` clauses satisfying `(): Trait` found + --> $DIR/unconstrained_impl_param.rs:15:1 + | +LL | impl Trait for () where (U,): AssocConst {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | (): Trait, + | ^^^^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0207, E0282, E0658. +Some errors have detailed explanations: E0207, E0283, E0658. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/const-generics/associated-const-bindings/using-fnptr-as-type_const.stderr b/tests/ui/const-generics/associated-const-bindings/using-fnptr-as-type_const.stderr index 09d1063081fe1..61d364696bf45 100644 --- a/tests/ui/const-generics/associated-const-bindings/using-fnptr-as-type_const.stderr +++ b/tests/ui/const-generics/associated-const-bindings/using-fnptr-as-type_const.stderr @@ -1,9 +1,18 @@ +error[E0284]: type annotations needed + --> $DIR/using-fnptr-as-type_const.rs:12:1 + | +LL | fn take(_: impl Trait) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `take::{constant#0} == _` + error[E0741]: using function pointers as const generic parameters is forbidden --> $DIR/using-fnptr-as-type_const.rs:8:14 | LL | const F: fn(); | ^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/check_const_arg_type_in_free_alias.lazy.stderr b/tests/ui/const-generics/check_const_arg_type_in_free_alias.lazy.stderr index b9adb4e51e1af..6ed4041785655 100644 --- a/tests/ui/const-generics/check_const_arg_type_in_free_alias.lazy.stderr +++ b/tests/ui/const-generics/check_const_arg_type_in_free_alias.lazy.stderr @@ -63,12 +63,6 @@ error: the constant `B` is not of type `usize` | LL | type UseFree = Free; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` - | -note: required by a bound on the type alias `Free` - --> $DIR/check_const_arg_type_in_free_alias.rs:37:11 - | -LL | type Free = [(); N]; - | ^^^^^^^^^^^^^^ required by this bound error[E0308]: mismatched types --> $DIR/check_const_arg_type_in_free_alias.rs:40:25 @@ -87,12 +81,6 @@ error: the constant `N` is not of type `bool` | LL | type UseFreeIndirectlyCorrect = UseFree; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `usize` - | -note: required by a bound on the type alias `UseFree` - --> $DIR/check_const_arg_type_in_free_alias.rs:38:14 - | -LL | type UseFree = Free; - | ^^^^^^^^^^^^^ required by this bound error[E0308]: mismatched types --> $DIR/check_const_arg_type_in_free_alias.rs:53:45 diff --git a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr index d5b5ad9d8dc15..2ca655d660876 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr +++ b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr @@ -252,22 +252,6 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: constant expression depends on a generic parameter - --> $DIR/const-arg-in-const-arg.rs:24:17 - | -LL | let _ = [0; foo::()]; - | ^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/const-arg-in-const-arg.rs:24:13 - | -LL | let _ = [0; foo::()]; - | ^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/const-arg-in-const-arg.rs:27:23 | @@ -340,6 +324,6 @@ note: the late bound lifetime parameter is introduced here LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ -error: aborting due to 33 previous errors +error: aborting due to 31 previous errors For more information about this error, try `rustc --explain E0794`. diff --git a/tests/ui/const-generics/default-ty-closure.stderr b/tests/ui/const-generics/default-ty-closure.stderr index 3f6ca9aea4ee8..42def39625d35 100644 --- a/tests/ui/const-generics/default-ty-closure.stderr +++ b/tests/ui/const-generics/default-ty-closure.stderr @@ -1,3 +1,21 @@ +error[E0284]: type annotations needed: cannot satisfy `the constant `{ || {} }` can be evaluated` + --> $DIR/default-ty-closure.rs:3:10 + | +LL | struct X; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `{ || {} }` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/default-ty-closure.rs:3:10 + | +LL | struct X; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | +note: required by a const generic parameter in `X` + --> $DIR/default-ty-closure.rs:3:10 + | +LL | struct X; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `X` + error: using function pointers as const generic parameters is forbidden --> $DIR/default-ty-closure.rs:3:20 | @@ -6,5 +24,6 @@ LL | struct X; | = note: the only supported types are integers, `bool`, and `char` -error: aborting due to 1 previous error +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr index 9b932a942b9e4..70ee818d5165a 100644 --- a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -3,9 +3,6 @@ error[E0277]: the trait bound `Uwu<10, 12>: Trait` is not satisfied | LL | fn rawr() -> impl Trait { | ^^^^^^^^^^ unsatisfied trait bound -LL | -LL | Uwu::<10, 12> - | ------------- return type was inferred to be `Uwu<10, 12>` here | help: the trait `Trait` is not implemented for `Uwu<10, 12>` --> $DIR/rp_impl_trait_fail.rs:1:1 @@ -23,9 +20,6 @@ error[E0277]: the trait bound `u32: Traitor` is not satisfied | LL | fn uwu() -> impl Traitor { | ^^^^^^^^^^^^^^^ the trait `Traitor` is not implemented for `u32` -LL | -LL | 1_u32 - | ----- return type was inferred to be `u32` here | help: the trait `Traitor` is not implemented for `u32` but trait `Traitor` is implemented for it @@ -39,9 +33,6 @@ error[E0277]: the trait bound `u64: Traitor` is not satisfied | LL | fn owo() -> impl Traitor { | ^^^^^^^^^^^^ the trait `Traitor` is not implemented for `u64` -LL | -LL | 1_u64 - | ----- return type was inferred to be `u64` here | help: the trait `Traitor<1, 1>` is not implemented for `u64` but trait `Traitor<1, 2>` is implemented for it diff --git a/tests/ui/const-generics/defaults/trait_objects_fail.stderr b/tests/ui/const-generics/defaults/trait_objects_fail.stderr index f79d45dc8cf01..30861e44cd18e 100644 --- a/tests/ui/const-generics/defaults/trait_objects_fail.stderr +++ b/tests/ui/const-generics/defaults/trait_objects_fail.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `u32: Trait` is not satisfied +error[E0277]: the trait bound `&u32: CoerceUnsized<&dyn Trait>` is not satisfied in `u32` --> $DIR/trait_objects_fail.rs:26:9 | LL | foo(&10_u32); - | ^^^^^^^ the trait `Trait` is not implemented for `u32` + | ^^^^^^^ within `u32`, the trait `Trait` is not implemented for `u32` | help: the trait `Trait<12>` is not implemented for `u32` but trait `Trait<2>` is implemented for it @@ -10,13 +10,15 @@ help: the trait `Trait<12>` is not implemented for `u32` | LL | impl Trait<2> for u32 {} | ^^^^^^^^^^^^^^^^^^^^^ + = note: required because it appears within the type `u32` + = note: required for `&u32` to implement `CoerceUnsized<&dyn Trait>` = note: required for the cast from `&u32` to `&dyn Trait` -error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied +error[E0277]: the trait bound `&bool: CoerceUnsized<&dyn Traitor<_>>` is not satisfied in `bool` --> $DIR/trait_objects_fail.rs:28:9 | LL | bar(&true); - | ^^^^^ the trait `Traitor<_>` is not implemented for `bool` + | ^^^^^ within `bool`, the trait `Traitor<_>` is not implemented for `bool` | help: the trait `Traitor<_, _>` is not implemented for `bool` but trait `Traitor<2, 3>` is implemented for it @@ -24,6 +26,8 @@ help: the trait `Traitor<_, _>` is not implemented for `bool` | LL | impl Traitor<2, 3> for bool {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it appears within the type `bool` + = note: required for `&bool` to implement `CoerceUnsized<&dyn Traitor<_>>` = note: required for the cast from `&bool` to `&dyn Traitor<_>` error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.stderr b/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.stderr index cf5b55a0ce292..3cd99764e3723 100644 --- a/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.stderr +++ b/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.stderr @@ -1,27 +1,25 @@ -error: constant expression depends on a generic parameter - --> $DIR/failing_goal_with_repeat_expr_anon_const.rs:14:15 - | -LL | [0u8; std::mem::size_of::()] == Self::P; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter +error[E0277]: can't compare `[u8; _]` with `::A` --> $DIR/failing_goal_with_repeat_expr_anon_const.rs:14:47 | LL | [0u8; std::mem::size_of::()] == Self::P; - | ^^ + | ^^ no implementation for `[u8; _] == ::A` | - = note: this may fail depending on what value the parameter takes - -error[E0277]: can't compare `[u8; std::mem::size_of::()]` with `::A` - --> $DIR/failing_goal_with_repeat_expr_anon_const.rs:14:47 - | -LL | [0u8; std::mem::size_of::()] == Self::P; - | ^^ no implementation for `[u8; std::mem::size_of::()] == ::A` + = help: the trait `PartialEq<::A>` is not implemented for `[u8; _]` + = help: the following other types implement trait `PartialEq`: + `&[T]` implements `PartialEq>` + `&[T]` implements `PartialEq>` + `&[T]` implements `PartialEq<[U; N]>` + `&[u8; N]` implements `PartialEq` + `&[u8; N]` implements `PartialEq` + `&[u8]` implements `PartialEq` + `&[u8]` implements `PartialEq` + `&mut [T]` implements `PartialEq>` + and 13 others +help: convert the array to a `&[u8]` slice instead | - = help: the trait `PartialEq<::A>` is not implemented for `[u8; std::mem::size_of::()]` +LL | [0u8; std::mem::size_of::()] == &Self::P[..]; + | + ++++ -error: aborting due to 3 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/fn-const-param-call.adt_const_params.stderr b/tests/ui/const-generics/fn-const-param-call.adt_const_params.stderr index fd9346a533ec2..3551109575da8 100644 --- a/tests/ui/const-generics/fn-const-param-call.adt_const_params.stderr +++ b/tests/ui/const-generics/fn-const-param-call.adt_const_params.stderr @@ -10,6 +10,31 @@ error[E0741]: using function pointers as const generic parameters is forbidden LL | impl u32> Wrapper { | ^^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0284]: type annotations needed + --> $DIR/fn-const-param-call.rs:23:16 + | +LL | assert_eq!(Wrapper::::call(), 17); + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `main::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/fn-const-param-call.rs:23:16 + | +LL | assert_eq!(Wrapper::::call(), 17); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `F` declared on the struct `Wrapper` + | + = note: cannot satisfy `main::{constant#0} == _` +note: required by a const generic parameter in `Wrapper::::call` + --> $DIR/fn-const-param-call.rs:15:6 + | +LL | impl u32> Wrapper { + | ^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Wrapper::::call` +LL | +LL | fn call() -> u32 { + | + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/fn-const-param-call.full.stderr b/tests/ui/const-generics/fn-const-param-call.full.stderr index fd9346a533ec2..3551109575da8 100644 --- a/tests/ui/const-generics/fn-const-param-call.full.stderr +++ b/tests/ui/const-generics/fn-const-param-call.full.stderr @@ -10,6 +10,31 @@ error[E0741]: using function pointers as const generic parameters is forbidden LL | impl u32> Wrapper { | ^^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0284]: type annotations needed + --> $DIR/fn-const-param-call.rs:23:16 + | +LL | assert_eq!(Wrapper::::call(), 17); + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `main::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/fn-const-param-call.rs:23:16 + | +LL | assert_eq!(Wrapper::::call(), 17); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `F` declared on the struct `Wrapper` + | + = note: cannot satisfy `main::{constant#0} == _` +note: required by a const generic parameter in `Wrapper::::call` + --> $DIR/fn-const-param-call.rs:15:6 + | +LL | impl u32> Wrapper { + | ^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Wrapper::::call` +LL | +LL | fn call() -> u32 { + | + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/fn-const-param-call.min.stderr b/tests/ui/const-generics/fn-const-param-call.min.stderr index b5b809d278703..4d451709f858f 100644 --- a/tests/ui/const-generics/fn-const-param-call.min.stderr +++ b/tests/ui/const-generics/fn-const-param-call.min.stderr @@ -14,5 +14,30 @@ LL | impl u32> Wrapper { | = note: the only supported types are integers, `bool`, and `char` -error: aborting due to 2 previous errors +error[E0284]: type annotations needed + --> $DIR/fn-const-param-call.rs:23:16 + | +LL | assert_eq!(Wrapper::::call(), 17); + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `main::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/fn-const-param-call.rs:23:16 + | +LL | assert_eq!(Wrapper::::call(), 17); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `F` declared on the struct `Wrapper` + | + = note: cannot satisfy `main::{constant#0} == _` +note: required by a const generic parameter in `Wrapper::::call` + --> $DIR/fn-const-param-call.rs:15:6 + | +LL | impl u32> Wrapper { + | ^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Wrapper::::call` +LL | +LL | fn call() -> u32 { + | + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/generic-parameter-in-const-expression-39211.stderr b/tests/ui/const-generics/generic-parameter-in-const-expression-39211.stderr index 2a80aff834a36..2ed825a96e716 100644 --- a/tests/ui/const-generics/generic-parameter-in-const-expression-39211.stderr +++ b/tests/ui/const-generics/generic-parameter-in-const-expression-39211.stderr @@ -1,18 +1,14 @@ -error: constant expression depends on a generic parameter - --> $DIR/generic-parameter-in-const-expression-39211.rs:9:17 +error[E0282]: type annotations needed for `[{integer}; _]` + --> $DIR/generic-parameter-in-const-expression-39211.rs:9:9 | LL | let a = [3; M::Row::DIM]; - | ^^^^^^^^^^^ + | ^ - type must be known at this point | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/generic-parameter-in-const-expression-39211.rs:9:13 - | -LL | let a = [3; M::Row::DIM]; - | ^^^^^^^^^^^^^^^^ +help: consider giving `a` an explicit type, where the placeholders `_` are specified | - = note: this may fail depending on what value the parameter takes +LL | let a: [{integer}; _] = [3; M::Row::DIM]; + | ++++++++++++++++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr index 164bcc7111ca6..32aec459451e1 100644 --- a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -1,16 +1,3 @@ -error[E0284]: type annotations needed for `Mask<_, _>` - --> $DIR/issue-91614.rs:5:9 - | -LL | let y = Mask::<_, _>::splat(false); - | ^ ------------ type must be known at this point - | -note: required by a const generic parameter in `Mask` - --> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL -help: consider giving `y` an explicit type, where the value of const parameter `N` is specified - | -LL | let y: Mask<_, N> = Mask::<_, _>::splat(false); - | ++++++++++++ - error[E0284]: type annotations needed for `Mask<_, _>` --> $DIR/issue-91614.rs:5:9 | @@ -24,6 +11,6 @@ help: consider giving `y` an explicit type, where the value of const parameter ` LL | let y: Mask<_, N> = Mask::<_, _>::splat(false); | ++++++++++++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr index ef4655c8dc21f..a61279bf597ed 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr @@ -1,24 +1,8 @@ -error: constant expression depends on a generic parameter +error[E0284]: type annotations needed: cannot satisfy `the constant `Self::SIZE` can be evaluated` --> $DIR/issue-62504.rs:18:25 | LL | ArrayHolder([0; Self::SIZE]) - | ^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error[E0308]: mismatched types - --> $DIR/issue-62504.rs:18:21 - | -LL | ArrayHolder([0; Self::SIZE]) - | ----------- ^^^^^^^^^^^^^^^ expected an array with a size of X, found one with a size of Self::SIZE - | | - | arguments to this struct are incorrect - | -note: tuple struct defined here - --> $DIR/issue-62504.rs:14:8 - | -LL | struct ArrayHolder([u32; X]); - | ^^^^^^^^^^^ + | ^^^^^^^^^^ cannot satisfy `the constant `Self::SIZE` can be evaluated` error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 @@ -54,7 +38,6 @@ help: consider giving `array` an explicit type, where the value of const paramet LL | let mut array: ArrayHolder = ArrayHolder::new(); | ++++++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0284, E0308. -For more information about an error, try `rustc --explain E0284`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/ice-118285-fn-ptr-value.stderr b/tests/ui/const-generics/ice-118285-fn-ptr-value.stderr index 4ff386c81635a..84b29773436fe 100644 --- a/tests/ui/const-generics/ice-118285-fn-ptr-value.stderr +++ b/tests/ui/const-generics/ice-118285-fn-ptr-value.stderr @@ -6,5 +6,36 @@ LL | struct Checked bool>; | = note: the only supported types are integers, `bool`, and `char` -error: aborting due to 1 previous error +error[E0284]: type annotations needed + --> $DIR/ice-118285-fn-ptr-value.rs:4:10 + | +LL | const _: Checked = Checked::; + | ^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `_::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/ice-118285-fn-ptr-value.rs:4:29 + | +LL | const _: Checked = Checked::; + | ^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `F` declared on the struct `Checked` + | + = note: cannot satisfy `_::{constant#0} == _` + = note: cannot satisfy `_::{constant#1} == _` + +error[E0284]: type annotations needed + --> $DIR/ice-118285-fn-ptr-value.rs:4:29 + | +LL | const _: Checked = Checked::; + | ^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `F` declared on the struct `Checked` + | + = note: cannot satisfy `_::{constant#1} == _` +note: required by a const generic parameter in `Checked` + --> $DIR/ice-118285-fn-ptr-value.rs:1:16 + | +LL | struct Checked bool>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Checked` + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/ice-151186-fn-ptr-in-where-clause.stderr b/tests/ui/const-generics/ice-151186-fn-ptr-in-where-clause.stderr index 3de24c8141aa2..d3683ba962a8e 100644 --- a/tests/ui/const-generics/ice-151186-fn-ptr-in-where-clause.stderr +++ b/tests/ui/const-generics/ice-151186-fn-ptr-in-where-clause.stderr @@ -1,9 +1,3 @@ -error: function items cannot be used as const args - --> $DIR/ice-151186-fn-ptr-in-where-clause.rs:13:43 - | -LL | impl Maybe for T where T: MyTrait<{ foo }> {} - | ^^^ - error: using function pointers as const generic parameters is forbidden --> $DIR/ice-151186-fn-ptr-in-where-clause.rs:8:24 | @@ -12,5 +6,11 @@ LL | trait MyTrait ()> {} | = note: the only supported types are integers, `bool`, and `char` +error: function items cannot be used as const args + --> $DIR/ice-151186-fn-ptr-in-where-clause.rs:13:43 + | +LL | impl Maybe for T where T: MyTrait<{ foo }> {} + | ^^^ + error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr index e4287fae20f1f..032d0939c4400 100644 --- a/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr +++ b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr @@ -55,14 +55,6 @@ error[E0308]: mismatched types LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` -error[E0046]: not all trait items implemented, missing: `next` - --> $DIR/ice-unexpected-inference-var-122549.rs:15:1 - | -LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `next` in implementation - | - = help: implement the missing item: `fn next(&mut self) -> Option<::Item> { todo!() }` - error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates --> $DIR/ice-unexpected-inference-var-122549.rs:15:13 | @@ -80,6 +72,14 @@ LL | LL ~ impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}, N> { | +error[E0046]: not all trait items implemented, missing: `next` + --> $DIR/ice-unexpected-inference-var-122549.rs:15:1 + | +LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `next` in implementation + | + = help: implement the missing item: `fn next(&mut self) -> Option<::Item> { todo!() }` + error: aborting due to 8 previous errors Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392. diff --git a/tests/ui/const-generics/infer/issue-77092.stderr b/tests/ui/const-generics/infer/issue-77092.stderr index 96f6496eca537..3763cd738a861 100644 --- a/tests/ui/const-generics/infer/issue-77092.stderr +++ b/tests/ui/const-generics/infer/issue-77092.stderr @@ -14,6 +14,24 @@ help: consider specifying the generic arguments LL | println!("{:?}", take_array_from_mut::(&mut arr, i)); | ++++++++++ -error: aborting due to 1 previous error +error[E0284]: type annotations needed + --> $DIR/issue-77092.rs:11:26 + | +LL | println!("{:?}", take_array_from_mut(&mut arr, i)); + | ---- ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut` + | | + | required by this formatting parameter + | + = note: required for `[i32; _]` to implement `Debug` + = note: 1 redundant requirement hidden + = note: required for `&mut [i32; _]` to implement `Debug` +note: required by a bound in `core::fmt::rt::Argument::<'_>::new_debug` + --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL +help: consider specifying the generic arguments + | +LL | println!("{:?}", take_array_from_mut::(&mut arr, i)); + | ++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr index 1301ca92f015c..059db27baf245 100644 --- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr +++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr @@ -6,6 +6,25 @@ LL | fn test() { | = note: `(dyn A + 'static)` must implement `ConstParamTy_`, but it does not -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `{ &B }` can be evaluated` + --> $DIR/issue-63322-forbid-dyn.rs:16:12 + | +LL | test::<{ &B }>(); + | ^^^^^^ cannot satisfy `the constant `{ &B }` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/issue-63322-forbid-dyn.rs:16:5 + | +LL | test::<{ &B }>(); + | ^^^^^^^^^^^^^^ cannot infer the value of the const parameter `T` declared on the function `test` + | +note: required by a const generic parameter in `test` + --> $DIR/issue-63322-forbid-dyn.rs:9:9 + | +LL | fn test() { + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `test` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr index aee5bb9653317..3caaaa8165204 100644 --- a/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr +++ b/tests/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr @@ -14,5 +14,24 @@ help: add `#![feature(unsized_const_params)]` to the crate attributes to enable LL + #![feature(unsized_const_params)] | -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `{ &B }` can be evaluated` + --> $DIR/issue-63322-forbid-dyn.rs:16:12 + | +LL | test::<{ &B }>(); + | ^^^^^^ cannot satisfy `the constant `{ &B }` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/issue-63322-forbid-dyn.rs:16:5 + | +LL | test::<{ &B }>(); + | ^^^^^^^^^^^^^^ cannot infer the value of the const parameter `T` declared on the function `test` + | +note: required by a const generic parameter in `test` + --> $DIR/issue-63322-forbid-dyn.rs:9:9 + | +LL | fn test() { + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `test` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/issues/issue-67739.min.stderr b/tests/ui/const-generics/issues/issue-67739.min.stderr index 14037b9eea5ac..84b397e577f2a 100644 --- a/tests/ui/const-generics/issues/issue-67739.min.stderr +++ b/tests/ui/const-generics/issues/issue-67739.min.stderr @@ -1,10 +1,9 @@ -error: constant expression depends on a generic parameter - --> $DIR/issue-67739.rs:11:15 +error[E0282]: type annotations needed + --> $DIR/issue-67739.rs:11:10 | LL | [0u8; mem::size_of::()]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes + | ^^^ cannot infer the value of the constant `_` error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/const-generics/issues/issue-71382.full.stderr b/tests/ui/const-generics/issues/issue-71382.full.stderr index 95faa406f859e..4b6c104764af0 100644 --- a/tests/ui/const-generics/issues/issue-71382.full.stderr +++ b/tests/ui/const-generics/issues/issue-71382.full.stderr @@ -4,6 +4,29 @@ error[E0741]: using function pointers as const generic parameters is forbidden LL | fn test(&self) { | ^^^^ -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `pass` can be evaluated` + --> $DIR/issue-71382.rs:13:21 + | +LL | self.test::(); + | ^^^^ cannot satisfy `the constant `pass` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/issue-71382.rs:13:21 + | +LL | self.test::(); + | ---- ^^^^ cannot infer the value of the const parameter `FN` declared on the method `test` + | | + | type must be known at this point + | +note: required by a const generic parameter in `Test::test` + --> $DIR/issue-71382.rs:16:13 + | +LL | impl Test { +... +LL | fn test(&self) { + | ^^^^^^^^^^^^^^ required by this const generic parameter in `Test::test` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/issues/issue-71382.min.stderr b/tests/ui/const-generics/issues/issue-71382.min.stderr index f70e1733a9770..c08de32d02509 100644 --- a/tests/ui/const-generics/issues/issue-71382.min.stderr +++ b/tests/ui/const-generics/issues/issue-71382.min.stderr @@ -6,5 +6,28 @@ LL | fn test(&self) { | = note: the only supported types are integers, `bool`, and `char` -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `pass` can be evaluated` + --> $DIR/issue-71382.rs:13:21 + | +LL | self.test::(); + | ^^^^ cannot satisfy `the constant `pass` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/issue-71382.rs:13:21 + | +LL | self.test::(); + | ---- ^^^^ cannot infer the value of the const parameter `FN` declared on the method `test` + | | + | type must be known at this point + | +note: required by a const generic parameter in `Test::test` + --> $DIR/issue-71382.rs:16:13 + | +LL | impl Test { +... +LL | fn test(&self) { + | ^^^^^^^^^^^^^^ required by this const generic parameter in `Test::test` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/issues/issue-72352.full.stderr b/tests/ui/const-generics/issues/issue-72352.full.stderr index 16a14d7f48079..e43653ef8225f 100644 --- a/tests/ui/const-generics/issues/issue-72352.full.stderr +++ b/tests/ui/const-generics/issues/issue-72352.full.stderr @@ -4,6 +4,25 @@ error[E0741]: using function pointers as const generic parameters is forbidden LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const c_char) -> usize { | ^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `safely_do_the_thing` can be evaluated` + --> $DIR/issue-72352.rs:20:53 + | +LL | println!("{}", unsafe { unsafely_do_the_thing::(ptr) }); + | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `safely_do_the_thing` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/issue-72352.rs:20:29 + | +LL | println!("{}", unsafe { unsafely_do_the_thing::(ptr) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `F` declared on the function `unsafely_do_the_thing` + | +note: required by a const generic parameter in `unsafely_do_the_thing` + --> $DIR/issue-72352.rs:8:33 + | +LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const c_char) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `unsafely_do_the_thing` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/issues/issue-72352.min.stderr b/tests/ui/const-generics/issues/issue-72352.min.stderr index 17ccfa8a0dabb..e4d60b483ec00 100644 --- a/tests/ui/const-generics/issues/issue-72352.min.stderr +++ b/tests/ui/const-generics/issues/issue-72352.min.stderr @@ -6,5 +6,24 @@ LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const c_ | = note: the only supported types are integers, `bool`, and `char` -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `safely_do_the_thing` can be evaluated` + --> $DIR/issue-72352.rs:20:53 + | +LL | println!("{}", unsafe { unsafely_do_the_thing::(ptr) }); + | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `safely_do_the_thing` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/issue-72352.rs:20:29 + | +LL | println!("{}", unsafe { unsafely_do_the_thing::(ptr) }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `F` declared on the function `unsafely_do_the_thing` + | +note: required by a const generic parameter in `unsafely_do_the_thing` + --> $DIR/issue-72352.rs:8:33 + | +LL | unsafe fn unsafely_do_the_thing usize>(ptr: *const c_char) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `unsafely_do_the_thing` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/issues/issue-99641.stderr b/tests/ui/const-generics/issues/issue-99641.stderr index 3365012a03841..2470a8605a866 100644 --- a/tests/ui/const-generics/issues/issue-99641.stderr +++ b/tests/ui/const-generics/issues/issue-99641.stderr @@ -14,6 +14,31 @@ LL | impl Color { | = note: `fn()` must implement `ConstParamTy_`, but it does not -error: aborting due to 2 previous errors +error[E0284]: type annotations needed + --> $DIR/issue-99641.rs:17:5 + | +LL | Color::::new(); + | ^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `main::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/issue-99641.rs:17:5 + | +LL | Color::::new(); + | ^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `WHITE` declared on the struct `Color` + | + = note: cannot satisfy `main::{constant#0} == _` +note: required by a const generic parameter in `Color::::new` + --> $DIR/issue-99641.rs:8:10 + | +LL | impl Color { + | ^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Color::::new` +LL | +LL | pub fn new() -> Self { + | + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/kind_mismatch.stderr b/tests/ui/const-generics/kind_mismatch.stderr index 12a2ab141a636..002e4ca542b4d 100644 --- a/tests/ui/const-generics/kind_mismatch.stderr +++ b/tests/ui/const-generics/kind_mismatch.stderr @@ -22,6 +22,13 @@ LL - impl ContainsKey for KeyHolder {} LL + impl ContainsKey for KeyHolder {} | -error: aborting due to 2 previous errors +error[E0282]: type annotations needed + --> $DIR/kind_mismatch.rs:22:29 + | +LL | let map: KeyHolder<0> = remove_key::<_, _>(); + | ^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `K` declared on the function `remove_key` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0747`. +Some errors have detailed explanations: E0282, E0747. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr b/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr index 2e06d4f2ce058..926e6fda47b5a 100644 --- a/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr +++ b/tests/ui/const-generics/mgca/adt_expr_arg_tuple_expr_fail.stderr @@ -10,12 +10,6 @@ error: the constant `N` is not of type `u32` LL | takes_tuple::<{ (N, T::ASSOC) }>(); | ^^^^^^^^^^^^^ expected `u32`, found `usize` -error: the constant `::ASSOC` is not of type `u32` - --> $DIR/adt_expr_arg_tuple_expr_fail.rs:20:21 - | -LL | takes_tuple::<{ (N, T::ASSOC) }>(); - | ^^^^^^^^^^^^^ expected `u32`, found `usize` - error: the constant `N` is not of type `u32` --> $DIR/adt_expr_arg_tuple_expr_fail.rs:24:28 | @@ -28,11 +22,5 @@ error: the constant `N` is not of type `u32` LL | takes_nested_tuple::<{ (N, (N, T::ASSOC)) }>(); | ^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize` -error: the constant `::ASSOC` is not of type `u32` - --> $DIR/adt_expr_arg_tuple_expr_fail.rs:26:28 - | -LL | takes_nested_tuple::<{ (N, (N, T::ASSOC)) }>(); - | ^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize` - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr b/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr index dea156db19c14..34cd08b58425a 100644 --- a/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr +++ b/tests/ui/const-generics/mgca/adt_expr_fields_type_check.stderr @@ -4,24 +4,12 @@ error: the constant `N` is not of type `u8` LL | accepts_1::<{ S1:: { f1: N, f2: N } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `bool` -error: the constant `N` is not of type `isize` - --> $DIR/adt_expr_fields_type_check.rs:23:19 - | -LL | accepts_1::<{ S1:: { f1: N, f2: N } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `bool` - error: the constant `N` is not of type `u8` --> $DIR/adt_expr_fields_type_check.rs:26:19 | LL | accepts_2::<{ S2::(N, N) }>(); | ^^^^^^^^^^^^^^ expected `u8`, found `bool` -error: the constant `N` is not of type `isize` - --> $DIR/adt_expr_fields_type_check.rs:26:19 - | -LL | accepts_2::<{ S2::(N, N) }>(); - | ^^^^^^^^^^^^^^ expected `isize`, found `bool` - error: the constant `N` is not of type `u8` --> $DIR/adt_expr_fields_type_check.rs:29:19 | @@ -40,6 +28,6 @@ error[E0308]: mismatched types LL | accepts_3::<{ En::Var2:: { field: const { false } } }>(); | ^^^^^ expected `i64`, found `bool` -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/mgca/array_elem_type_mismatch.stderr b/tests/ui/const-generics/mgca/array_elem_type_mismatch.stderr index dc65022b674b5..0ee94590c1964 100644 --- a/tests/ui/const-generics/mgca/array_elem_type_mismatch.stderr +++ b/tests/ui/const-generics/mgca/array_elem_type_mismatch.stderr @@ -4,11 +4,5 @@ error: the constant `2` is not of type `u8` LL | foo::<_, { [0, 1u8, 2u32, 8u64] }>(); | ^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `u32` -error: the constant `8` is not of type `u8` - --> $DIR/array_elem_type_mismatch.rs:12:16 - | -LL | foo::<_, { [0, 1u8, 2u32, 8u64] }>(); - | ^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `u64` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr b/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr index 1f3cd0872a83c..648482ced0ceb 100644 --- a/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr +++ b/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr @@ -27,6 +27,24 @@ LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0275]: overflow evaluating the requirement `S: ConstParamTy_` + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | ------------ in this derive macro expansion +LL | +LL | struct S() + | ^ + +error[E0275]: overflow evaluating whether `S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | ------------ in this derive macro expansion +LL | +LL | struct S() + | ^ + error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:12:5 | @@ -42,11 +60,99 @@ LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0275]: overflow evaluating the requirement `S: StructuralPartialEq` + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | --------- in this derive macro expansion +LL | +LL | struct S() + | ^ + +error[E0275]: overflow evaluating whether `S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | --------- in this derive macro expansion +LL | +LL | struct S() + | ^ + +error[E0275]: overflow evaluating whether `&S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:8:24 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | ^^^^^^^^^ + | +note: the requirement `&S well-formed` appears on the `impl`'s method `eq` but not on the corresponding trait's method + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this trait + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: this trait's method doesn't have the requirement `&S well-formed` + +error[E0275]: overflow evaluating whether `&S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:8:24 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | ^^^^^^^^^ + | +note: the requirement `&S well-formed` appears on the `impl`'s method `eq` but not on the corresponding trait's method + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this trait + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: this trait's method doesn't have the requirement `&S well-formed` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0275]: overflow evaluating whether `S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:12:5 + | +LL | S<{ U }>:; + | ^^^^^^^^ + | +note: required by a bound in `S` + --> $DIR/const-ctor-overflow-eval.rs:12:5 + | +LL | struct S() +LL | where +LL | S<{ U }>:; + | ^^^^^^^^ required by this bound in `S` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0275]: overflow evaluating the requirement `S: PartialEq` + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | --------- in this derive macro expansion +LL | +LL | struct S() + | ^ + +error[E0275]: overflow evaluating whether `S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | --------- in this derive macro expansion +LL | +LL | struct S() + | ^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:8:24 | LL | #[derive(ConstParamTy, PartialEq, Eq)] | ^^^^^^^^^ + +error[E0275]: overflow evaluating whether `S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:12:5 + | +LL | S<{ U }>:; + | ^^^^^^^^ | note: required by a bound in `S` --> $DIR/const-ctor-overflow-eval.rs:12:5 @@ -55,6 +161,25 @@ LL | struct S() LL | where LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0275]: overflow evaluating the requirement `S: Eq` + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | -- in this derive macro expansion +LL | +LL | struct S() + | ^ + +error[E0275]: overflow evaluating whether `S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:10:8 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | -- in this derive macro expansion +LL | +LL | struct S() + | ^ error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:12:5 @@ -71,6 +196,20 @@ LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors +error[E0275]: overflow evaluating whether `&S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:8:24 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | ^^^^^^^^^ + +error[E0275]: overflow evaluating whether `&S` is well-formed + --> $DIR/const-ctor-overflow-eval.rs:8:24 + | +LL | #[derive(ConstParamTy, PartialEq, Eq)] + | ^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 19 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/const-generics/mgca/printing_valtrees_supports_non_values.stderr b/tests/ui/const-generics/mgca/printing_valtrees_supports_non_values.stderr index 9087f98cbb3f4..fd37323b3a26a 100644 --- a/tests/ui/const-generics/mgca/printing_valtrees_supports_non_values.stderr +++ b/tests/ui/const-generics/mgca/printing_valtrees_supports_non_values.stderr @@ -45,6 +45,12 @@ note: required by a const generic parameter in `foo` LL | fn foo() {} | ^^^^^^^^^^^^ required by this const generic parameter in `foo` +error: the type `Option::::Some(::ASSOC)` is not well-formed + --> $DIR/printing_valtrees_supports_non_values.rs:29:13 + | +LL | foo::<{ Option::Some:: { 0: ::ASSOC } }>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: the constant `Option::::Some(_)` is not of type `Foo` --> $DIR/printing_valtrees_supports_non_values.rs:35:13 | @@ -57,6 +63,6 @@ note: required by a const generic parameter in `foo` LL | fn foo() {} | ^^^^^^^^^^^^ required by this const generic parameter in `foo` -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/mgca/tuple_expr_type_mismatch.stderr b/tests/ui/const-generics/mgca/tuple_expr_type_mismatch.stderr index 4e7560e4583ef..5d5d7f4d3aa15 100644 --- a/tests/ui/const-generics/mgca/tuple_expr_type_mismatch.stderr +++ b/tests/ui/const-generics/mgca/tuple_expr_type_mismatch.stderr @@ -16,11 +16,5 @@ error: the constant `1` is not of type `char` LL | qux::<{ (1i32, 'a') }>(); | ^^^^^^^^^^^ expected `char`, found `i32` -error: the constant `'a'` is not of type `i32` - --> $DIR/tuple_expr_type_mismatch.rs:18:13 - | -LL | qux::<{ (1i32, 'a') }>(); - | ^^^^^^^^^^^ expected `i32`, found `char` - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/mgca/type_const-mismatched-types.stderr b/tests/ui/const-generics/mgca/type_const-mismatched-types.stderr index 3cba92197dcae..8f1f6f4ac9488 100644 --- a/tests/ui/const-generics/mgca/type_const-mismatched-types.stderr +++ b/tests/ui/const-generics/mgca/type_const-mismatched-types.stderr @@ -10,11 +10,11 @@ error: the constant `5` is not of type `u32` LL | const FREE2: isize = gca!(FREE); | ^^^^^^^^^^^^^^^^^^ expected `u32`, found `usize` -error: the constant `5` is not of type `isize` +error: the constant `FREE` is not of type `isize` --> $DIR/type_const-mismatched-types.rs:9:1 | LL | const FREE2: isize = gca!(FREE); - | ^^^^^^^^^^^^^^^^^^ expected `isize`, found `usize` + | ^^^^^^^^^^^^^^^^^^ expected `isize`, found `u32` error: the constant `false` is not of type `usize` --> $DIR/type_const-mismatched-types.rs:19:5 diff --git a/tests/ui/const-generics/min_const_generics/forbid-self-no-normalize.stderr b/tests/ui/const-generics/min_const_generics/forbid-self-no-normalize.stderr index 87cac5849df89..3863ba6c1d74b 100644 --- a/tests/ui/const-generics/min_const_generics/forbid-self-no-normalize.stderr +++ b/tests/ui/const-generics/min_const_generics/forbid-self-no-normalize.stderr @@ -12,5 +12,18 @@ LL | impl BindsParam for ::Assoc { = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions = help: alternatively, you can use `#![feature(gca_const_items)]` and extract the expression into a `type const` item -error: aborting due to 1 previous error +error[E0599]: no associated function or constant named `MAX` found for type `_` in the current scope + --> $DIR/forbid-self-no-normalize.rs:12:31 + | +LL | type ArrayTy = [u8; Self::MAX]; + | ^^^ associated function or constant not found in `_` + | + = help: items from traits can only be used if the trait is in scope +help: trait `RangePattern` which provides `MAX` is implemented but not in scope; perhaps you want to import it + | +LL + use core::pat::RangePattern; + | + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr b/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr index f5a57f864564d..3edaf80e8f7ae 100644 --- a/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr +++ b/tests/ui/const-generics/normalizing_with_unconstrained_impl_params.stderr @@ -10,6 +10,14 @@ error[E0308]: mismatched types LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { | ^^ expected `usize`, found `()` +error[E0284]: type annotations needed + --> $DIR/normalizing_with_unconstrained_impl_params.rs:6:5 + | +LL | fn next(&mut self) -> Option {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type + | + = note: cannot satisfy ` as Iterator>::Item == _` + error[E0046]: not all trait items implemented, missing: `Item` --> $DIR/normalizing_with_unconstrained_impl_params.rs:4:1 | @@ -18,6 +26,21 @@ LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact< | = help: implement the missing item: `type Item = /* Type */;` +error[E0283]: type annotations needed: cannot satisfy `ConstChunksExact<'a, T, N>: Iterator` + --> $DIR/normalizing_with_unconstrained_impl_params.rs:4:59 + | +LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: multiple `impl`s satisfying `ConstChunksExact<'a, T, N>: Iterator` found + --> $DIR/normalizing_with_unconstrained_impl_params.rs:4:1 + | +LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0392]: lifetime parameter `'a` is never used --> $DIR/normalizing_with_unconstrained_impl_params.rs:9:25 | @@ -62,6 +85,14 @@ LL | LL ~ impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, {}, N> { | +error[E0284]: type annotations needed + --> $DIR/normalizing_with_unconstrained_impl_params.rs:6:27 + | +LL | fn next(&mut self) -> Option {} + | ^^^^^^^^^^^^^^^^^^ cannot infer type + | + = note: cannot satisfy ` as Iterator>::Item == _` + error[E0308]: mismatched types --> $DIR/normalizing_with_unconstrained_impl_params.rs:6:27 | @@ -73,7 +104,7 @@ LL | fn next(&mut self) -> Option {} = note: expected enum `Option<_>` found unit type `()` -error: aborting due to 8 previous errors +error: aborting due to 11 previous errors -Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0520, E0637. +Some errors have detailed explanations: E0046, E0207, E0283, E0284, E0308, E0392, E0520, E0637. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/const-generics/raw-ptr-const-param-deref.adt_const_params.stderr b/tests/ui/const-generics/raw-ptr-const-param-deref.adt_const_params.stderr index 18f47f7dc23e6..333c57dd4a7e5 100644 --- a/tests/ui/const-generics/raw-ptr-const-param-deref.adt_const_params.stderr +++ b/tests/ui/const-generics/raw-ptr-const-param-deref.adt_const_params.stderr @@ -10,6 +10,31 @@ error[E0741]: using raw pointers as const generic parameters is forbidden LL | impl Const

{ | ^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0284]: type annotations needed + --> $DIR/raw-ptr-const-param-deref.rs:21:16 + | +LL | assert_eq!(Const::<{ &A as *const _ }>::get(), 3) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `main::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/raw-ptr-const-param-deref.rs:21:16 + | +LL | assert_eq!(Const::<{ &A as *const _ }>::get(), 3) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `P` declared on the struct `Const` + | + = note: cannot satisfy `main::{constant#0} == _` +note: required by a const generic parameter in `Const::

::get` + --> $DIR/raw-ptr-const-param-deref.rs:13:6 + | +LL | impl Const

{ + | ^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Const::

::get` +LL | +LL | fn get() -> u32 { + | + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/raw-ptr-const-param-deref.full.stderr b/tests/ui/const-generics/raw-ptr-const-param-deref.full.stderr index 18f47f7dc23e6..333c57dd4a7e5 100644 --- a/tests/ui/const-generics/raw-ptr-const-param-deref.full.stderr +++ b/tests/ui/const-generics/raw-ptr-const-param-deref.full.stderr @@ -10,6 +10,31 @@ error[E0741]: using raw pointers as const generic parameters is forbidden LL | impl Const

{ | ^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0284]: type annotations needed + --> $DIR/raw-ptr-const-param-deref.rs:21:16 + | +LL | assert_eq!(Const::<{ &A as *const _ }>::get(), 3) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `main::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/raw-ptr-const-param-deref.rs:21:16 + | +LL | assert_eq!(Const::<{ &A as *const _ }>::get(), 3) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `P` declared on the struct `Const` + | + = note: cannot satisfy `main::{constant#0} == _` +note: required by a const generic parameter in `Const::

::get` + --> $DIR/raw-ptr-const-param-deref.rs:13:6 + | +LL | impl Const

{ + | ^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Const::

::get` +LL | +LL | fn get() -> u32 { + | + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0284, E0741. +For more information about an error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr b/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr index fca2966e3a30a..aa0732b63d5a6 100644 --- a/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr +++ b/tests/ui/const-generics/raw-ptr-const-param-deref.min.stderr @@ -14,5 +14,30 @@ LL | impl Const

{ | = note: the only supported types are integers, `bool`, and `char` -error: aborting due to 2 previous errors +error[E0284]: type annotations needed + --> $DIR/raw-ptr-const-param-deref.rs:21:16 + | +LL | assert_eq!(Const::<{ &A as *const _ }>::get(), 3) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `_` + | + = note: cannot satisfy `main::{constant#0} == _` + +error[E0284]: type annotations needed + --> $DIR/raw-ptr-const-param-deref.rs:21:16 + | +LL | assert_eq!(Const::<{ &A as *const _ }>::get(), 3) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `P` declared on the struct `Const` + | + = note: cannot satisfy `main::{constant#0} == _` +note: required by a const generic parameter in `Const::

::get` + --> $DIR/raw-ptr-const-param-deref.rs:13:6 + | +LL | impl Const

{ + | ^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Const::

::get` +LL | +LL | fn get() -> u32 { + | + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/slice-const-param-mismatch.adt_const_params.stderr b/tests/ui/const-generics/slice-const-param-mismatch.adt_const_params.stderr index d970b12df6a1d..44947bd68a01a 100644 --- a/tests/ui/const-generics/slice-const-param-mismatch.adt_const_params.stderr +++ b/tests/ui/const-generics/slice-const-param-mismatch.adt_const_params.stderr @@ -6,6 +6,8 @@ LL | struct ConstString; | = help: add `#![feature(unsized_const_params)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: required for `str` to implement `ConstParamTy_` + = note: 1 redundant requirement hidden = note: required for `&'static str` to implement `ConstParamTy_` error[E0658]: use of unstable library feature `unsized_const_params` @@ -16,6 +18,8 @@ LL | struct ConstBytes; | = help: add `#![feature(unsized_const_params)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: required for `[u8]` to implement `ConstParamTy_` + = note: 1 redundant requirement hidden = note: required for `&'static [u8]` to implement `ConstParamTy_` error[E0308]: mismatched types diff --git a/tests/ui/const-generics/sneaky-array-repeat-expr.stderr b/tests/ui/const-generics/sneaky-array-repeat-expr.stderr index e532f27a10da9..f1740af2143ab 100644 --- a/tests/ui/const-generics/sneaky-array-repeat-expr.stderr +++ b/tests/ui/const-generics/sneaky-array-repeat-expr.stderr @@ -1,34 +1,25 @@ -error: constant expression depends on a generic parameter - --> $DIR/sneaky-array-repeat-expr.rs:11:20 +error[E0282]: type annotations needed for `[(); _]` + --> $DIR/sneaky-array-repeat-expr.rs:11:9 | LL | let bar = [(); <()>::Assoc]; - | ^^^^^^^^^^^ + | ^^^ -- type must be known at this point | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/sneaky-array-repeat-expr.rs:11:15 - | -LL | let bar = [(); <()>::Assoc]; - | ^^^^^^^^^^^^^^^^^ +help: consider giving `bar` an explicit type, where the placeholders `_` are specified | - = note: this may fail depending on what value the parameter takes +LL | let bar: [_; _] = [(); <()>::Assoc]; + | ++++++++ -error: constant expression depends on a generic parameter - --> $DIR/sneaky-array-repeat-expr.rs:26:21 +error[E0282]: type annotations needed for `[(); _]` + --> $DIR/sneaky-array-repeat-expr.rs:26:9 | LL | let bar2 = [(); <()>::Assoc2]; - | ^^^^^^^^^^^^ + | ^^^^ -- type must be known at this point | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/sneaky-array-repeat-expr.rs:26:16 - | -LL | let bar2 = [(); <()>::Assoc2]; - | ^^^^^^^^^^^^^^^^^^ +help: consider giving `bar2` an explicit type, where the placeholders `_` are specified | - = note: this may fail depending on what value the parameter takes +LL | let bar2: [_; _] = [(); <()>::Assoc2]; + | ++++++++ -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr index 2aa79df096579..dede01f1cd5c4 100644 --- a/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr +++ b/tests/ui/const-generics/trait-resolution-error-with-const-generics-77919.stderr @@ -29,7 +29,35 @@ LL | const VAL: T; LL | impl TypeVal for Multiply where N: TypeVal {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation -error: aborting due to 3 previous errors +error[E0599]: the associated function or constant `VAL` exists for struct `Multiply`, but its trait bounds were not satisfied + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:3:33 + | +LL | [1; >::VAL]; + | ^^^ associated function or constant cannot be called on `Multiply` due to unsatisfied trait bounds +... +LL | struct Five; + | ----------- doesn't satisfy `Five: TypeVal<{type error}>` +LL | struct Multiply { + | --------------------- associated function or constant `VAL` not found for this struct because it doesn't satisfy `Multiply: TypeVal<_>` + | +note: trait bound `Five: TypeVal<{type error}>` was not satisfied + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:12:55 + | +LL | impl TypeVal for Multiply where N: TypeVal {} + | -------------- -------------- ^^^^^^^^^^^^ unsatisfied trait bound introduced here +note: the trait `TypeVal` must be implemented + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:5:1 + | +LL | trait TypeVal { + | ^^^^^^^^^^^^^^^^ + = help: items from traits can only be used if the trait is implemented and in scope +note: `TypeVal` defines an item `VAL`, perhaps you need to implement it + --> $DIR/trait-resolution-error-with-const-generics-77919.rs:5:1 + | +LL | trait TypeVal { + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0046, E0425. +Some errors have detailed explanations: E0046, E0425, E0599. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/const-generics/try-from-with-const-genericsrs-98299.stderr b/tests/ui/const-generics/try-from-with-const-genericsrs-98299.stderr index c80efd6df8a89..7430a109795e0 100644 --- a/tests/ui/const-generics/try-from-with-const-genericsrs-98299.stderr +++ b/tests/ui/const-generics/try-from-with-const-genericsrs-98299.stderr @@ -6,16 +6,69 @@ LL | SmallCString::try_from(p).map(|cstr| cstr); | | | type must be known at this point | +note: required for `SmallCString<_>` to implement `TryFrom<()>` + --> $DIR/try-from-with-const-genericsrs-98299.rs:11:22 + | +LL | impl TryFrom<()> for SmallCString { + | -------------- ^^^^^^^^^^^ ^^^^^^^^^^^^^^^ + | | + | unsatisfied trait bound introduced here +help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified + | +LL | SmallCString::try_from(p).map(|cstr: SmallCString| cstr); + | +++++++++++++++++ + +error[E0284]: type annotations needed for `SmallCString<_>` + --> $DIR/try-from-with-const-genericsrs-98299.rs:5:36 + | +LL | SmallCString::try_from(p).map(|cstr| cstr); + | ^^^^ + | +note: required by a const generic parameter in `SmallCString` + --> $DIR/try-from-with-const-genericsrs-98299.rs:9:25 + | +LL | pub struct SmallCString {} + | ^^^^^^^^^^^^^^ required by this const generic parameter in `SmallCString` +help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified + | +LL | SmallCString::try_from(p).map(|cstr: SmallCString| cstr); + | +++++++++++++++++ + +error[E0284]: type annotations needed for `SmallCString<_>` + --> $DIR/try-from-with-const-genericsrs-98299.rs:5:36 + | +LL | SmallCString::try_from(p).map(|cstr| cstr); + | --- ^^^^ + | | + | type must be known at this point + | +note: required by a const generic parameter in `SmallCString` + --> $DIR/try-from-with-const-genericsrs-98299.rs:9:25 + | +LL | pub struct SmallCString {} + | ^^^^^^^^^^^^^^ required by this const generic parameter in `SmallCString` +help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified + | +LL | SmallCString::try_from(p).map(|cstr: SmallCString| cstr); + | +++++++++++++++++ + +error[E0284]: type annotations needed for `SmallCString<_>` + --> $DIR/try-from-with-const-genericsrs-98299.rs:5:36 + | +LL | SmallCString::try_from(p).map(|cstr| cstr); + | ^^^^ + | note: required by a const generic parameter in `SmallCString` --> $DIR/try-from-with-const-genericsrs-98299.rs:9:25 | LL | pub struct SmallCString {} | ^^^^^^^^^^^^^^ required by this const generic parameter in `SmallCString` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified | LL | SmallCString::try_from(p).map(|cstr: SmallCString| cstr); | +++++++++++++++++ -error: aborting due to 1 previous error +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/const-generics/type-dependent/issue-71382.stderr b/tests/ui/const-generics/type-dependent/issue-71382.stderr index 3830b1527c372..8b5c14f9ba383 100644 --- a/tests/ui/const-generics/type-dependent/issue-71382.stderr +++ b/tests/ui/const-generics/type-dependent/issue-71382.stderr @@ -6,5 +6,28 @@ LL | fn test u8>(&self) -> u8 { | = note: the only supported types are integers, `bool`, and `char` -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `the constant `pass` can be evaluated` + --> $DIR/issue-71382.rs:9:21 + | +LL | self.test::() + | ^^^^ cannot satisfy `the constant `pass` can be evaluated` + +error[E0284]: type annotations needed + --> $DIR/issue-71382.rs:9:21 + | +LL | self.test::() + | ---- ^^^^ cannot infer the value of the const parameter `FN` declared on the method `test` + | | + | type must be known at this point + | +note: required by a const generic parameter in `Test::test` + --> $DIR/issue-71382.rs:12:13 + | +LL | impl Test { +... +LL | fn test u8>(&self) -> u8 { + | ^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Test::test` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/consts/closure-type-error-during-const-eval-66706.stderr b/tests/ui/consts/closure-type-error-during-const-eval-66706.stderr index e774b1adf1187..c5d45fa66b405 100644 --- a/tests/ui/consts/closure-type-error-during-const-eval-66706.stderr +++ b/tests/ui/consts/closure-type-error-during-const-eval-66706.stderr @@ -28,18 +28,18 @@ LL | [0; match [|f @ &ref _| () ] {} ] | | | while parsing this `match` expression -error[E0282]: type annotations needed - --> $DIR/closure-type-error-during-const-eval-66706.rs:3:14 +error[E0284]: type annotations needed: cannot satisfy `_: '_` + --> $DIR/closure-type-error-during-const-eval-66706.rs:3:16 | LL | [0; [|_: _ &_| ()].len()] - | ^ cannot infer type + | ^^ cannot satisfy `_: '_` -error[E0282]: type annotations needed +error[E0284]: type annotations needed: cannot satisfy `_: '_` --> $DIR/closure-type-error-during-const-eval-66706.rs:14:11 | LL | [0; [|&_: _ &_| {}; 0 ].len()] - | ^^^^^ cannot infer type + | ^^^^^ cannot satisfy `_: '_` error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/consts/issue-50439.stderr b/tests/ui/consts/issue-50439.stderr index 7a8cd45ecc7d1..f9d93fcb1e1e5 100644 --- a/tests/ui/consts/issue-50439.stderr +++ b/tests/ui/consts/issue-50439.stderr @@ -1,18 +1,14 @@ -error: constant expression depends on a generic parameter - --> $DIR/issue-50439.rs:25:22 +error[E0282]: type annotations needed for `[(); _]` + --> $DIR/issue-50439.rs:25:13 | LL | let _ = [(); 0 - !!( as ReflectDrop>::REFLECT_DROP) as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ -- type must be known at this point | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/issue-50439.rs:25:17 - | -LL | let _ = [(); 0 - !!( as ReflectDrop>::REFLECT_DROP) as usize]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider giving this pattern a type, where the placeholders `_` are specified | - = note: this may fail depending on what value the parameter takes +LL | let _: [_; _] = [(); 0 - !!( as ReflectDrop>::REFLECT_DROP) as usize]; + | ++++++++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr b/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr index 839299f1c94c2..d1272a68a7e42 100644 --- a/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr +++ b/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr @@ -1,18 +1,11 @@ -error[E0631]: type mismatch in coroutine arguments +error[E0277]: the trait bound `{coroutine@$DIR/arg-count-mismatch-on-unit-input.rs:8:5: 8:12}: Coroutine` is not satisfied --> $DIR/arg-count-mismatch-on-unit-input.rs:5:13 | LL | fn foo() -> impl Coroutine { - | ^^^^^^^^^^^^^^^^^^ expected due to this -... -LL | |_: ()| {} - | ---------- - | | - | found signature defined here - | return type was inferred to be `{coroutine@$DIR/arg-count-mismatch-on-unit-input.rs:8:5: 8:12}` here + | ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | - = note: expected coroutine signature `fn(u8) -> _` - found coroutine signature `fn(()) -> _` + = help: the nightly-only, unstable trait `Coroutine` is not implemented for `{coroutine@$DIR/arg-count-mismatch-on-unit-input.rs:8:5: 8:12}` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/coroutine/auto-trait-regions.stderr b/tests/ui/coroutine/auto-trait-regions.stderr index ea2b5cc18cda3..c7bd83cd2dbaf 100644 --- a/tests/ui/coroutine/auto-trait-regions.stderr +++ b/tests/ui/coroutine/auto-trait-regions.stderr @@ -1,18 +1,10 @@ -error: implementation of `Foo` is not general enough +error: higher-ranked lifetime error --> $DIR/auto-trait-regions.rs:31:5 | -LL | let generator = #[coroutine] move || { - | ------- this coroutine captures a value whose type is not `Foo` -... LL | assert_foo(generator); | ^^^^^^^^^^^^^^^^^^^^^ | -note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... - --> $DIR/auto-trait-regions.rs:21:18 - | -LL | fn assert_foo(f: T) {} - | ^^^ required by this bound in `assert_foo` - = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` + = note: could not prove `{coroutine@$DIR/auto-trait-regions.rs:26:34: 26:41}: Foo` error[E0626]: borrow may still be in use when coroutine yields --> $DIR/auto-trait-regions.rs:45:19 @@ -46,21 +38,13 @@ help: add `static` to mark this coroutine as unmovable LL | let generator = #[coroutine] static move || { | ++++++ -error: implementation of `Foo` is not general enough +error: lifetime bound not satisfied --> $DIR/auto-trait-regions.rs:51:5 | -LL | let generator = #[coroutine] move || { - | ------- this coroutine captures a value whose type is not `Foo` -... LL | assert_foo(generator); | ^^^^^^^^^^^^^^^^^^^^^ | -note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... - --> $DIR/auto-trait-regions.rs:21:18 - | -LL | fn assert_foo(f: T) {} - | ^^^ required by this bound in `assert_foo` - = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` + = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) error: aborting due to 4 previous errors diff --git a/tests/ui/coroutine/gen_block_is_coro.stderr b/tests/ui/coroutine/gen_block_is_coro.stderr index fac09f6000597..d22fe632f552a 100644 --- a/tests/ui/coroutine/gen_block_is_coro.stderr +++ b/tests/ui/coroutine/gen_block_is_coro.stderr @@ -3,24 +3,18 @@ error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:8:5: 8:8}: C | LL | fn foo() -> impl Coroutine { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:8:5: 8:8}` -LL | gen { yield 42 } - | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:8:5: 8:8}` here error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:12:5: 12:8}: Coroutine` is not satisfied --> $DIR/gen_block_is_coro.rs:11:13 | LL | fn bar() -> impl Coroutine { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:12:5: 12:8}` -LL | gen { yield 42 } - | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:12:5: 12:8}` here error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:16:5: 16:8}: Coroutine` is not satisfied --> $DIR/gen_block_is_coro.rs:15:13 | LL | fn baz() -> impl Coroutine { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:16:5: 16:8}` -LL | gen { yield 42 } - | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:16:5: 16:8}` here error: aborting due to 3 previous errors diff --git a/tests/ui/coroutine/gen_block_is_no_future.stderr b/tests/ui/coroutine/gen_block_is_no_future.stderr index 43e18dbc2a9c1..bf0985a76a28e 100644 --- a/tests/ui/coroutine/gen_block_is_no_future.stderr +++ b/tests/ui/coroutine/gen_block_is_no_future.stderr @@ -3,8 +3,6 @@ error[E0277]: `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a fut | LL | fn foo() -> impl std::future::Future { | ^^^^^^^^^^^^^^^^^^^^^^^^ `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a future -LL | gen { yield 42 } - | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` here | = help: the trait `Future` is not implemented for `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` diff --git a/tests/ui/coroutine/gen_block_move.fixed b/tests/ui/coroutine/gen_block_move.fixed index e58c9b3f9fe32..e249404a0a168 100644 --- a/tests/ui/coroutine/gen_block_move.fixed +++ b/tests/ui/coroutine/gen_block_move.fixed @@ -4,7 +4,7 @@ fn moved() -> impl Iterator { let mut x = "foo".to_string(); - gen move { //~ ERROR: gen block may outlive the current function + gen { //~ ERROR: gen block may outlive the current function yield 42; if x == "foo" { return } x.clear(); diff --git a/tests/ui/coroutine/gen_block_move.stderr b/tests/ui/coroutine/gen_block_move.stderr index 720b8d73322e7..8907c15c55072 100644 --- a/tests/ui/coroutine/gen_block_move.stderr +++ b/tests/ui/coroutine/gen_block_move.stderr @@ -1,27 +1,19 @@ -error[E0373]: gen block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/gen_block_move.rs:7:5 +error[E0597]: `x` does not live long enough + --> $DIR/gen_block_move.rs:10:9 | +LL | let mut x = "foo".to_string(); + | ----- binding `x` declared here LL | gen { - | ^^^ may outlive borrowed value `x` + | --- value captured here by coroutine ... LL | x.clear(); - | - `x` is borrowed here - | -note: gen block is returned here - --> $DIR/gen_block_move.rs:7:5 - | -LL | / gen { -LL | | yield 42; -LL | | if x == "foo" { return } -LL | | x.clear(); -LL | | for x in 3..6 { yield x } -LL | | } - | |_____^ -help: to force the gen block to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | gen move { - | ++++ + | ^ borrowed value does not live long enough +... +LL | } + | -- borrow later used here + | | + | `x` dropped here while still borrowed error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/coroutine/issue-88653.stderr b/tests/ui/coroutine/issue-88653.stderr index 772a7f8424a50..0efaf1c391f65 100644 --- a/tests/ui/coroutine/issue-88653.stderr +++ b/tests/ui/coroutine/issue-88653.stderr @@ -1,24 +1,11 @@ -error[E0631]: type mismatch in coroutine arguments +error[E0277]: the trait bound `{coroutine@$DIR/issue-88653.rs:15:5: 15:10}: Coroutine<(bool,)>` is not satisfied --> $DIR/issue-88653.rs:8:22 | -LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> { - | ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this -... -LL | |bar| { - | ----- - | | - | _____found signature defined here - | | -LL | | -LL | | -LL | | if bar { -... | -LL | | } - | |_____- return type was inferred to be `{coroutine@$DIR/issue-88653.rs:15:5: 15:10}` here +LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> { + | ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | - = note: expected coroutine signature `fn((bool,)) -> _` - found coroutine signature `fn(bool) -> _` + = help: the nightly-only, unstable trait `Coroutine<(bool,)>` is not implemented for `{coroutine@$DIR/issue-88653.rs:15:5: 15:10}` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/coroutine/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr index 9211256766669..9dfabd4d2e531 100644 --- a/tests/ui/coroutine/resume-arg-late-bound.stderr +++ b/tests/ui/coroutine/resume-arg-late-bound.stderr @@ -1,15 +1,21 @@ -error: implementation of `Coroutine` is not general enough - --> $DIR/resume-arg-late-bound.rs:15:5 +error[E0277]: the trait bound `for<'a> {coroutine@$DIR/resume-arg-late-bound.rs:11:28: 11:44}: Coroutine<&'a mut bool>` is not satisfied + --> $DIR/resume-arg-late-bound.rs:15:10 | LL | test(gen); - | ^^^^^^^^^ + | ---- ^^^ the trait `for<'a> Coroutine<&'a mut bool>` is not implemented for `{coroutine@$DIR/resume-arg-late-bound.rs:11:28: 11:44}` + | | + | required by a bound introduced by this call | -note: `{coroutine@...}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... +note: required by a bound in `test` --> $DIR/resume-arg-late-bound.rs:8:17 | LL | fn test(a: impl for<'a> Coroutine<&'a mut bool>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test` - = note: ...but it actually implements `Coroutine<&'2 mut bool>`, for some specific lifetime `'2` +help: consider mutably borrowing here + | +LL | test(&mut gen); + | ++++ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/coroutine/resume-arg-outlives.stderr b/tests/ui/coroutine/resume-arg-outlives.stderr index 045c77e8d054c..f4b119e5ce306 100644 --- a/tests/ui/coroutine/resume-arg-outlives.stderr +++ b/tests/ui/coroutine/resume-arg-outlives.stderr @@ -1,11 +1,11 @@ error: lifetime may not live long enough - --> $DIR/resume-arg-outlives.rs:17:5 + --> $DIR/resume-arg-outlives.rs:8:1 | LL | fn demo<'not_static>(s: &'not_static str) -> Pin + 'static>> { - | ----------- lifetime `'not_static` defined here -... -LL | generator - | ^^^^^^^^^ returning this value requires that `'not_static` must outlive `'static` + | ^^^^^^^^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | lifetime `'not_static` defined here + | requires that `'not_static` must outlive `'static` | help: consider changing `impl Coroutine<&'not_static str> + 'static`'s explicit `'static` bound to the lifetime of argument `s` | diff --git a/tests/ui/coroutine/static-move-suggestion.fixed b/tests/ui/coroutine/static-move-suggestion.fixed index 56445be4715ff..1d6e4a6288311 100644 --- a/tests/ui/coroutine/static-move-suggestion.fixed +++ b/tests/ui/coroutine/static-move-suggestion.fixed @@ -7,7 +7,7 @@ fn check() -> impl Sized { let x = 0; #[coroutine] - static move || { + static || { //~^ ERROR E0373 yield; x diff --git a/tests/ui/coroutine/static-move-suggestion.stderr b/tests/ui/coroutine/static-move-suggestion.stderr index 6d890468b322c..44c05c2fd3b75 100644 --- a/tests/ui/coroutine/static-move-suggestion.stderr +++ b/tests/ui/coroutine/static-move-suggestion.stderr @@ -1,26 +1,20 @@ -error[E0373]: coroutine may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/static-move-suggestion.rs:10:5 +error[E0597]: `x` does not live long enough + --> $DIR/static-move-suggestion.rs:13:9 | +LL | let x = 0; + | - binding `x` declared here +LL | #[coroutine] LL | static || { - | ^^^^^^^^^ may outlive borrowed value `x` + | --------- value captured here by coroutine ... LL | x - | - `x` is borrowed here - | -note: coroutine is returned here - --> $DIR/static-move-suggestion.rs:10:5 - | -LL | / static || { -LL | | -LL | | yield; -LL | | x -LL | | } - | |_____^ -help: to force the coroutine to take ownership of `x` (and any other referenced variables), use the `move` keyword - | -LL | static move || { - | ++++ + | ^ borrowed value does not live long enough +LL | } +LL | } + | -- borrow later used here + | | + | `x` dropped here while still borrowed error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/custom_test_frameworks/mismatch.stderr b/tests/ui/custom_test_frameworks/mismatch.stderr index 7cdfaa9e804ee..20e2151e12f15 100644 --- a/tests/ui/custom_test_frameworks/mismatch.stderr +++ b/tests/ui/custom_test_frameworks/mismatch.stderr @@ -1,11 +1,14 @@ -error[E0277]: the trait bound `TestDescAndFn: Testable` is not satisfied +error[E0277]: the trait bound `&TestDescAndFn: CoerceUnsized<&dyn Testable>` is not satisfied in `TestDescAndFn` --> $DIR/mismatch.rs:9:1 | LL | #[test] | ------- in this attribute macro expansion LL | fn wrong_kind(){} - | ^^^^^^^^^^^^^^^^^ the trait `Testable` is not implemented for `TestDescAndFn` + | ^^^^^^^^^^^^^^^^^ within `TestDescAndFn`, the trait `Testable` is not implemented for `TestDescAndFn` | +note: required because it appears within the type `TestDescAndFn` + --> $SRC_DIR/test/src/types.rs:LL:COL + = note: required for `&TestDescAndFn` to implement `CoerceUnsized<&dyn Testable>` = note: required for the cast from `&TestDescAndFn` to `&dyn Testable` error: aborting due to 1 previous error diff --git a/tests/ui/delegation/ice-line-bounds-issue-148732.stderr b/tests/ui/delegation/ice-line-bounds-issue-148732.stderr index 196f984626ce5..72762397a8761 100644 --- a/tests/ui/delegation/ice-line-bounds-issue-148732.stderr +++ b/tests/ui/delegation/ice-line-bounds-issue-148732.stderr @@ -25,14 +25,14 @@ error: failed to resolve delegation callee LL | reuse a as b { | ^ -error[E0277]: `fn() {b}` doesn't implement `Debug` +error[E0277]: `&fn() {b}` doesn't implement `Debug` --> $DIR/ice-line-bounds-issue-148732.rs:4:5 | LL | reuse a as b { | - consider calling this function ... LL | dbg!(b); - | ^^^^^^^ the trait `Debug` is not implemented for fn item `fn() {b}` + | ^^^^^^^ within `&fn() {b}`, the trait `Debug` is not implemented for `&fn() {b}` | = help: use parentheses to call this function: `b()` diff --git a/tests/ui/delegation/inherent-impls-parent-generics.stderr b/tests/ui/delegation/inherent-impls-parent-generics.stderr index 5fe1efbf81c13..774526db7d6c8 100644 --- a/tests/ui/delegation/inherent-impls-parent-generics.stderr +++ b/tests/ui/delegation/inherent-impls-parent-generics.stderr @@ -70,25 +70,6 @@ error: parent segment of delegation to inherent impl can not contain infers LL | reuse S::<_, 123>::foo_self as s9; | ^^^^^^^^ -error[E0284]: type annotations needed - --> $DIR/inherent-impls-parent-generics.rs:14:10 - | -LL | reuse E::foo_static as e; - | - ^^^^^^^^^^ cannot infer the value of the const parameter `C` declared on the enum `E` - | | - | type must be known at this point - | -note: required by a const generic parameter in `E` - --> $DIR/inherent-impls-parent-generics.rs:4:23 - | -LL | enum E<'a: 'a, A: 'a, const C: usize> { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `E` -help: consider specifying the generic arguments - | -LL - reuse E::foo_static as e; -LL + reuse E:: as e; - | - error[E0284]: type annotations needed --> $DIR/inherent-impls-parent-generics.rs:14:10 | @@ -141,25 +122,6 @@ help: provide the argument LL | reuse E::foo_self(/* value */) as e1; | +++++++++++++ -error[E0284]: type annotations needed - --> $DIR/inherent-impls-parent-generics.rs:23:10 - | -LL | reuse E::foo_static::<'static, (), true> as e2; - | - ^^^^^^^^^^ cannot infer the value of the const parameter `C` declared on the enum `E` - | | - | type must be known at this point - | -note: required by a const generic parameter in `E` - --> $DIR/inherent-impls-parent-generics.rs:4:23 - | -LL | enum E<'a: 'a, A: 'a, const C: usize> { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `E` -help: consider specifying the generic arguments - | -LL - reuse E::foo_static::<'static, (), true> as e2; -LL + reuse E:: as e2; - | - error[E0284]: type annotations needed --> $DIR/inherent-impls-parent-generics.rs:23:10 | @@ -256,24 +218,6 @@ help: provide the argument LL | reuse E::<'_, _, _>::foo_self(/* value */) as e9; | +++++++++++++ -error[E0284]: type annotations needed - --> $DIR/inherent-impls-parent-generics.rs:55:10 - | -LL | reuse S::foo_static as s; - | - ^^^^^^^^^^ cannot infer the value of the const parameter `C` declared on the struct `S` - | | - | type must be known at this point - | -note: required by a const generic parameter in `S` - --> $DIR/inherent-impls-parent-generics.rs:46:13 - | -LL | struct S { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `S` -help: consider specifying the generic arguments - | -LL | reuse S::::foo_static as s; - | ++++++++ - error[E0284]: type annotations needed --> $DIR/inherent-impls-parent-generics.rs:55:10 | @@ -325,24 +269,6 @@ help: provide the argument LL | reuse S::foo_self(/* value */) as s1; | +++++++++++++ -error[E0284]: type annotations needed - --> $DIR/inherent-impls-parent-generics.rs:64:10 - | -LL | reuse S::foo_static::<'static, (), true> as s2; - | - ^^^^^^^^^^ cannot infer the value of the const parameter `C` declared on the struct `S` - | | - | type must be known at this point - | -note: required by a const generic parameter in `S` - --> $DIR/inherent-impls-parent-generics.rs:46:13 - | -LL | struct S { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `S` -help: consider specifying the generic arguments - | -LL | reuse S::::foo_static::<'static, (), true> as s2; - | ++++++++ - error[E0284]: type annotations needed --> $DIR/inherent-impls-parent-generics.rs:64:10 | @@ -438,7 +364,7 @@ help: provide the argument LL | reuse S::<_, 123>::foo_self(/* value */) as s9; | +++++++++++++ -error: aborting due to 34 previous errors +error: aborting due to 30 previous errors Some errors have detailed explanations: E0061, E0284. For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/deref/option-result-as_deref.stderr b/tests/ui/deref/option-result-as_deref.stderr index 0aa57d0597733..96d2dd7c4ab4f 100644 --- a/tests/ui/deref/option-result-as_deref.stderr +++ b/tests/ui/deref/option-result-as_deref.stderr @@ -6,6 +6,7 @@ LL | let _m = &Some(42).as_deref(); | = note: the following trait bounds were not satisfied: `{integer}: Deref` + which is required by `<{integer} as Deref>::Target = _` error[E0599]: the method `as_deref_mut` exists for enum `Option<{integer}>`, but its trait bounds were not satisfied --> $DIR/option-result-as_deref.rs:6:28 @@ -15,6 +16,7 @@ LL | let _e = &mut Some(42).as_deref_mut(); | = note: the following trait bounds were not satisfied: `{integer}: Deref` + which is required by `<{integer} as Deref>::Target = _` error[E0599]: the method `as_deref` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied --> $DIR/option-result-as_deref.rs:8:22 @@ -24,6 +26,7 @@ LL | let _o = &Ok(42).as_deref(); | = note: the following trait bounds were not satisfied: `{integer}: Deref` + which is required by `<{integer} as Deref>::Target = _` error[E0599]: the method `as_deref_mut` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied --> $DIR/option-result-as_deref.rs:10:26 @@ -33,6 +36,7 @@ LL | let _w = &mut Ok(42).as_deref_mut(); | = note: the following trait bounds were not satisfied: `{integer}: Deref` + which is required by `<{integer} as Deref>::Target = _` error: aborting due to 4 previous errors diff --git a/tests/ui/deref/pin-impl-deref.stderr b/tests/ui/deref/pin-impl-deref.stderr index 985a816309c0b..191452779014e 100644 --- a/tests/ui/deref/pin-impl-deref.stderr +++ b/tests/ui/deref/pin-impl-deref.stderr @@ -30,28 +30,6 @@ note: required by a bound in `impl_deref_mut` LL | fn impl_deref_mut(_: impl DerefMut) {} | ^^^^^^^^ required by this bound in `impl_deref_mut` -error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/pin-impl-deref.rs:31:20 - | -LL | impl_deref_mut(r_pin) - | -------------- ^^^^^ within `MyPinType`, the trait `Unpin` is not implemented for `PhantomPinned` - | | - | required by a bound introduced by this call - | - = note: consider using the `pin!` macro - consider using `Box::pin` if you need to access the pinned value outside of the current scope -note: required because it appears within the type `MyPinType` - --> $DIR/pin-impl-deref.rs:15:18 - | -LL | struct MyPinType(core::marker::PhantomPinned); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this field - = note: required for `Pin<&MyPinType>` to implement `DerefMut` -note: required by a bound in `impl_deref_mut` - --> $DIR/pin-impl-deref.rs:22:27 - | -LL | fn impl_deref_mut(_: impl DerefMut) {} - | ^^^^^^^^ required by this bound in `impl_deref_mut` - error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/pin-impl-deref.rs:36:20 | @@ -74,6 +52,6 @@ note: required by a bound in `impl_deref_mut` LL | fn impl_deref_mut(_: impl DerefMut) {} | ^^^^^^^^ required by this bound in `impl_deref_mut` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/derives/debug/derives-span-Debug.stderr b/tests/ui/derives/debug/derives-span-Debug.stderr index 0f322e37b05c3..412137fe27a7a 100644 --- a/tests/ui/derives/debug/derives-span-Debug.stderr +++ b/tests/ui/derives/debug/derives-span-Debug.stderr @@ -1,62 +1,38 @@ -error[E0277]: `Error` doesn't implement `Debug` +error[E0277]: `&Error` doesn't implement `Debug` --> $DIR/derives-span-Debug.rs:9:9 | LL | #[derive(Debug)] | ----- in this derive macro expansion ... LL | x: Error, - | ^^^^^^^^ the trait `Debug` is not implemented for `Error` - | -help: consider annotating `Error` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct Error; - | + | ^^^^^^^^ within `&Error`, the trait `Debug` is not implemented for `&Error` -error[E0277]: `Error` doesn't implement `Debug` +error[E0277]: `&Error` doesn't implement `Debug` --> $DIR/derives-span-Debug.rs:16:9 | LL | #[derive(Debug)] | ----- in this derive macro expansion ... LL | Error, - | ^^^^^ the trait `Debug` is not implemented for `Error` - | -help: consider annotating `Error` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct Error; - | + | ^^^^^ within `&Error`, the trait `Debug` is not implemented for `&Error` -error[E0277]: `Error` doesn't implement `Debug` +error[E0277]: `&Error` doesn't implement `Debug` --> $DIR/derives-span-Debug.rs:21:5 | LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Struct { LL | x: Error, - | ^^^^^^^^ the trait `Debug` is not implemented for `Error` - | -help: consider annotating `Error` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct Error; - | + | ^^^^^^^^ within `&Error`, the trait `Debug` is not implemented for `&Error` -error[E0277]: `Error` doesn't implement `Debug` +error[E0277]: `&Error` doesn't implement `Debug` --> $DIR/derives-span-Debug.rs:26:5 | LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct TupleStruct( LL | Error, - | ^^^^^ the trait `Debug` is not implemented for `Error` - | -help: consider annotating `Error` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct Error; - | + | ^^^^^ within `&Error`, the trait `Debug` is not implemented for `&Error` error: aborting due to 4 previous errors diff --git a/tests/ui/derives/deriving-from-wrong-target.stderr b/tests/ui/derives/deriving-from-wrong-target.stderr index 4547cea5ba6a1..82af1d323e880 100644 --- a/tests/ui/derives/deriving-from-wrong-target.stderr +++ b/tests/ui/derives/deriving-from-wrong-target.stderr @@ -72,6 +72,27 @@ help: function arguments must have a statically known size, borrowed types alway LL | last: &T, | + -error: aborting due to 6 previous errors +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/deriving-from-wrong-target.rs:31:10 + | +LL | #[derive(From)] + | ^^^^ doesn't have a size known at compile-time +LL | struct SUnsizedField { + | - this type parameter needs to be `Sized` + | +note: required because it appears within the type `SUnsizedField` + --> $DIR/deriving-from-wrong-target.rs:33:5 + | +LL | struct SUnsizedField { +LL | last: T, + | ^^^^^^^ required by this field + = note: structs must have a statically known size to be initialized +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - struct SUnsizedField { +LL + struct SUnsizedField { + | + +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/derives/deriving-with-repr-packed-2.stderr b/tests/ui/derives/deriving-with-repr-packed-2.stderr index 6bd3fff39790a..270d8cc4494d5 100644 --- a/tests/ui/derives/deriving-with-repr-packed-2.stderr +++ b/tests/ui/derives/deriving-with-repr-packed-2.stderr @@ -5,7 +5,7 @@ LL | pub struct Foo(T, T, T); | ----------------- method `clone` not found for this struct because it doesn't satisfy `Foo: Clone` LL | LL | struct NonCopy; - | -------------- doesn't satisfy `NonCopy: Clone` or `NonCopy: Copy` + | -------------- doesn't satisfy `NonCopy: Clone` ... LL | _ = x.clone(); | ^^^^^ method cannot be called on `Foo` due to unsatisfied trait bounds @@ -18,9 +18,7 @@ LL | let x: Foo = Foo(1, 2, 3); ... LL | let x: Foo = Foo(NonCopy, NonCopy, NonCopy); | - earlier `x` shadowed here with type `Foo` -note: the following trait bounds were not satisfied: - `NonCopy: Clone` - `NonCopy: Copy` +note: trait bound `NonCopy: Clone` was not satisfied --> $DIR/deriving-with-repr-packed-2.rs:7:16 | LL | #[derive(Copy, Clone, Default, PartialEq, Eq)] @@ -29,9 +27,9 @@ LL | #[repr(packed)] LL | pub struct Foo(T, T, T); | ^ type parameter would need to implement `Clone` = help: consider manually implementing the trait to avoid undesired bounds -help: consider annotating `NonCopy` with `#[derive(Clone, Copy)]` +help: consider annotating `NonCopy` with `#[derive(Clone)]` | -LL + #[derive(Clone, Copy)] +LL + #[derive(Clone)] LL | struct NonCopy; | diff --git a/tests/ui/derives/eq-ord/derive-eq-check-all-variants.stderr b/tests/ui/derives/eq-ord/derive-eq-check-all-variants.stderr index 19026145c66cc..0bc4f765ceebe 100644 --- a/tests/ui/derives/eq-ord/derive-eq-check-all-variants.stderr +++ b/tests/ui/derives/eq-ord/derive-eq-check-all-variants.stderr @@ -1,23 +1,17 @@ -error[E0277]: the trait bound `f64: Eq` is not satisfied +error[E0277]: the trait bound `Option: Eq` is not satisfied --> $DIR/derive-eq-check-all-variants.rs:6:11 | LL | #[derive(PartialEq, Eq)] | -- in this derive macro expansion ... LL | Float(Option), - | ^^^^^^^^^^^ the trait `Eq` is not implemented for `f64` + | ^^^^^^^^^^^ the trait `Eq` is not implemented for `Option` | - = help: the following other types implement trait `Eq`: - i128 - i16 - i32 - i64 - i8 - isize - u128 - u16 - and 4 others - = note: required for `Option` to implement `Eq` +help: the trait `Eq` is conditionally implemented for `Option` + --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unsatisfied requirement introduced here: `_: Eq` note: required by a bound in `std::cmp::AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL diff --git a/tests/ui/derives/eq-ord/derives-span-PartialEq.stderr b/tests/ui/derives/eq-ord/derives-span-PartialEq.stderr index c2e928885ce2a..8028a39569d37 100644 --- a/tests/ui/derives/eq-ord/derives-span-PartialEq.stderr +++ b/tests/ui/derives/eq-ord/derives-span-PartialEq.stderr @@ -6,17 +6,6 @@ LL | #[derive(PartialEq)] ... LL | x: Error, | ^^^^^^^^ - | -note: an implementation of `PartialEq` might be missing for `Error` - --> $DIR/derives-span-PartialEq.rs:4:1 - | -LL | struct Error; - | ^^^^^^^^^^^^ must implement `PartialEq` -help: consider annotating `Error` with `#[derive(PartialEq)]` - | -LL + #[derive(PartialEq)] -LL | struct Error; - | error[E0369]: binary operation `==` cannot be applied to type `&Error` --> $DIR/derives-span-PartialEq.rs:16:9 @@ -26,17 +15,6 @@ LL | #[derive(PartialEq)] ... LL | Error, | ^^^^^ - | -note: an implementation of `PartialEq` might be missing for `Error` - --> $DIR/derives-span-PartialEq.rs:4:1 - | -LL | struct Error; - | ^^^^^^^^^^^^ must implement `PartialEq` -help: consider annotating `Error` with `#[derive(PartialEq)]` - | -LL + #[derive(PartialEq)] -LL | struct Error; - | error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq.rs:21:5 diff --git a/tests/ui/derives/eq-ord/do-not-suggest-calling-fn-in-derive-macro.stderr b/tests/ui/derives/eq-ord/do-not-suggest-calling-fn-in-derive-macro.stderr index af78f64546310..e75e959bf7a50 100644 --- a/tests/ui/derives/eq-ord/do-not-suggest-calling-fn-in-derive-macro.stderr +++ b/tests/ui/derives/eq-ord/do-not-suggest-calling-fn-in-derive-macro.stderr @@ -6,6 +6,12 @@ LL | #[derive(PartialEq)] LL | pub struct Function { LL | callback: Rc, | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `Rc` does not implement `PartialEq>` + --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL + ::: $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL + | + = note: `Rc` is defined in another crate error: aborting due to 1 previous error diff --git a/tests/ui/derives/redundant-derive-note-on-unimplemented.stderr b/tests/ui/derives/redundant-derive-note-on-unimplemented.stderr index 69e6e53a19d28..f381da831c501 100644 --- a/tests/ui/derives/redundant-derive-note-on-unimplemented.stderr +++ b/tests/ui/derives/redundant-derive-note-on-unimplemented.stderr @@ -1,31 +1,24 @@ -error[E0277]: `X` doesn't implement `Debug` +error[E0277]: `S` doesn't implement `Debug` --> $DIR/redundant-derive-note-on-unimplemented.rs:14:22 | LL | println!("{:?}", S(X)); - | ---- ^^^^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | ---- ^^^^ `S` cannot be formatted using `{:?}` because it doesn't implement `Debug` | | | required by this formatting parameter | - = help: the trait `Debug` is not implemented for `X` +help: the trait `Debug` is not implemented for `S` + --> $DIR/redundant-derive-note-on-unimplemented.rs:9:1 + | +LL | struct S(T); + | ^^^^^^^^^^^ + = note: add `#[derive(Debug)]` to `S` or manually `impl Debug for S` help: the trait `Debug` is conditionally implemented for `S` --> $DIR/redundant-derive-note-on-unimplemented.rs:8:10 | LL | #[derive(Debug)] | ^^^^^ LL | struct S(T); - | - unsatisfied requirement introduced here: `X: Debug` -note: required for `S` to implement `Debug` - --> $DIR/redundant-derive-note-on-unimplemented.rs:9:8 - | -LL | #[derive(Debug)] - | ----- in this derive macro expansion -LL | struct S(T); - | ^ - type parameter would need to implement `Debug` -help: consider annotating `X` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct X; - | + | - unsatisfied requirement introduced here: `_: Debug` error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/E0271.ascii.stderr b/tests/ui/diagnostic-width/E0271.ascii.stderr index f1e9a9366925a..eb0f3f6b22a7c 100644 --- a/tests/ui/diagnostic-width/E0271.ascii.stderr +++ b/tests/ui/diagnostic-width/E0271.ascii.stderr @@ -14,6 +14,9 @@ note: expected this to be `Foo` | LL | type Error = E; | ^ +note: required because it appears within the type `Result<_, ()>` + --> $SRC_DIR/core/src/result.rs:LL:COL + = note: required for `Box>` to implement `CoerceUnsized>` = note: required for the cast from `Box>` to `Box<_>` = note: the full name for the type has been written to '$TEST_BUILD_DIR/E0271.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console diff --git a/tests/ui/diagnostic-width/E0271.unicode.stderr b/tests/ui/diagnostic-width/E0271.unicode.stderr index ecb09c53a76c6..00e1e32ef8564 100644 --- a/tests/ui/diagnostic-width/E0271.unicode.stderr +++ b/tests/ui/diagnostic-width/E0271.unicode.stderr @@ -13,7 +13,10 @@ note: expected this to be `Foo` ╭▸ $DIR/E0271.rs:9:18 │ LL │ type Error = E; - │ ━ + ╰╴ ━ +note: required because it appears within the type `Result<_, ()>` + ╭▸ $SRC_DIR/core/src/result.rs:LL:COL + ├ note: required for `Box>` to implement `CoerceUnsized>` ├ note: required for the cast from `Box>` to `Box<_>` ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/E0271.long-type-$LONG_TYPE_HASH.txt' ╰ note: consider using `--verbose` to print the full type name to the console diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr index 0eb00461f5524..b24c0b1f4058b 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr @@ -11,16 +11,10 @@ error[E0277]: the trait bound `{integer}: Alias` is not satisfied --> $DIR/on_impl_trait.rs:16:9 | LL | foo(&1); - | --- ^^ the trait `Test` is not implemented for `{integer}` + | --- ^^ the trait `Alias` is not implemented for `{integer}` | | | required by a bound introduced by this call | -help: this trait has no implementations, consider adding one - --> $DIR/on_impl_trait.rs:6:1 - | -LL | trait Test {} - | ^^^^^^^^^^ - = note: required for `{integer}` to implement `Alias` note: required by a bound in `foo` --> $DIR/on_impl_trait.rs:13:11 | diff --git a/tests/ui/did_you_mean/casting-fn-item-to-fn-pointer.stderr b/tests/ui/did_you_mean/casting-fn-item-to-fn-pointer.stderr index 2b08a9563fa00..2625aa94c1889 100644 --- a/tests/ui/did_you_mean/casting-fn-item-to-fn-pointer.stderr +++ b/tests/ui/did_you_mean/casting-fn-item-to-fn-pointer.stderr @@ -10,13 +10,6 @@ help: the trait `FromIterator<(&_, fn() {foo})>` is not implemented for `Vec<(&s = help: for that trait implementation, expected `fn()`, found `fn() {foo}` = note: fn items are distinct from fn pointers = help: consider casting the fn item to a fn pointer: `foo as fn()` -note: the method call chain might not have had the expected associated types - --> $DIR/casting-fn-item-to-fn-pointer.rs:6:47 - | -LL | let _: Vec<(&str, fn())> = [("foo", foo)].into_iter().collect(); - | -------------- ^^^^^^^^^^^ `Iterator::Item` is `(&str, fn() {foo})` here - | | - | this expression has type `[(&str, fn() {foo}); 1]` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL @@ -32,13 +25,6 @@ help: the trait `FromIterator` is not implemented for `Vec` = help: for that trait implementation, expected `fn()`, found `fn() {foo}` = note: fn items are distinct from fn pointers = help: consider casting the fn item to a fn pointer: `foo as fn()` -note: the method call chain might not have had the expected associated types - --> $DIR/casting-fn-item-to-fn-pointer.rs:7:30 - | -LL | let _: Vec = [foo].into_iter().collect(); - | ----- ^^^^^^^^^^^ `Iterator::Item` is `fn() {foo}` here - | | - | this expression has type `[fn() {foo}; 1]` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL diff --git a/tests/ui/did_you_mean/recursion_limit.stderr b/tests/ui/did_you_mean/recursion_limit.stderr index 5ff75c32c1684..d05c9d3026670 100644 --- a/tests/ui/did_you_mean/recursion_limit.stderr +++ b/tests/ui/did_you_mean/recursion_limit.stderr @@ -1,90 +1,30 @@ -error[E0275]: overflow evaluating the requirement `J: Send` +warning: overflow evaluating the requirement `A: Send` --> $DIR/recursion_limit.rs:34:5 | -LL | macro_rules! link { -... LL | is_send::(); | ^^^^^^^^^^^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit`) -note: required because it appears within the type `I` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { I, J } - | -------------- in this macro invocation -note: required because it appears within the type `H` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { H, I } - | -------------- in this macro invocation -note: required because it appears within the type `G` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { G, H } - | -------------- in this macro invocation -note: required because it appears within the type `F` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { F, G } - | -------------- in this macro invocation -note: required because it appears within the type `E` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { E, F } - | -------------- in this macro invocation -note: required because it appears within the type `D` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { D, E } - | -------------- in this macro invocation -note: required because it appears within the type `C` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { C, D } - | -------------- in this macro invocation -note: required because it appears within the type `B` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { B, C } - | -------------- in this macro invocation -note: required because it appears within the type `A` - --> $DIR/recursion_limit.rs:11:24 - | -LL | enum $id { $id($t) } - | ^^ required by this field -... -LL | link! { A, B } - | -------------- in this macro invocation -note: required by a bound in `is_send` - --> $DIR/recursion_limit.rs:31:14 + = note: which requires `B: Send` + = note: which requires `C: Send` + = note: which requires `D: Send` + = note: which requires `E: Send` + = note: which requires `F: Send` + = note: which requires `G: Send` + = note: which requires `H: Send` + = note: which requires `I: Send` + = note: which requires `J: Send` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: queries overflow the depth limit! | -LL | fn is_send() { } - | ^^^^ required by this bound in `is_send` + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`recursion_limit`) + = note: query depth increased by 12 when computing layout of `A` -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/drop/dropck-normalize-errors.nll.stderr b/tests/ui/drop/dropck-normalize-errors.nll.stderr index e650af44cab5c..e5520b47ae7a6 100644 --- a/tests/ui/drop/dropck-normalize-errors.nll.stderr +++ b/tests/ui/drop/dropck-normalize-errors.nll.stderr @@ -1,24 +1,14 @@ -error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>` +error[E0277]: the size for values of type `BDecoder` cannot be known at compilation time --> $DIR/dropck-normalize-errors.rs:20:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ unsatisfied trait bound + | ^^^^^^^^^^^^ doesn't have a size known at compile-time | -help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:15:1 - | -LL | struct NonImplementedStruct; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:12:1 - | -LL | trait NonImplementedTrait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:31:12 +help: within `ADecoder<'a>`, the trait `Sized` is not implemented for `BDecoder` + --> $DIR/dropck-normalize-errors.rs:31:1 | LL | pub struct BDecoder { - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `ADecoder<'a>` --> $DIR/dropck-normalize-errors.rs:17:12 | @@ -26,27 +16,17 @@ LL | pub struct ADecoder<'a> { | ^^^^^^^^ = note: the return type of a function must have a statically known size -error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder` +error[E0277]: the size for values of type `BDecoder` cannot be known at compilation time --> $DIR/dropck-normalize-errors.rs:28:20 | LL | type Decoder = BDecoder; - | ^^^^^^^^ unsatisfied trait bound + | ^^^^^^^^ doesn't have a size known at compile-time | -help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:15:1 - | -LL | struct NonImplementedStruct; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:12:1 - | -LL | trait NonImplementedTrait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:31:12 +help: the trait `Sized` is not implemented for `BDecoder` + --> $DIR/dropck-normalize-errors.rs:31:1 | LL | pub struct BDecoder { - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ note: required by a bound in `Decode::Decoder` --> $DIR/dropck-normalize-errors.rs:9:5 | diff --git a/tests/ui/drop/dropck-normalize-errors.polonius.stderr b/tests/ui/drop/dropck-normalize-errors.polonius.stderr index e650af44cab5c..e5520b47ae7a6 100644 --- a/tests/ui/drop/dropck-normalize-errors.polonius.stderr +++ b/tests/ui/drop/dropck-normalize-errors.polonius.stderr @@ -1,24 +1,14 @@ -error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>` +error[E0277]: the size for values of type `BDecoder` cannot be known at compilation time --> $DIR/dropck-normalize-errors.rs:20:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ unsatisfied trait bound + | ^^^^^^^^^^^^ doesn't have a size known at compile-time | -help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:15:1 - | -LL | struct NonImplementedStruct; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:12:1 - | -LL | trait NonImplementedTrait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:31:12 +help: within `ADecoder<'a>`, the trait `Sized` is not implemented for `BDecoder` + --> $DIR/dropck-normalize-errors.rs:31:1 | LL | pub struct BDecoder { - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ note: required because it appears within the type `ADecoder<'a>` --> $DIR/dropck-normalize-errors.rs:17:12 | @@ -26,27 +16,17 @@ LL | pub struct ADecoder<'a> { | ^^^^^^^^ = note: the return type of a function must have a statically known size -error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder` +error[E0277]: the size for values of type `BDecoder` cannot be known at compilation time --> $DIR/dropck-normalize-errors.rs:28:20 | LL | type Decoder = BDecoder; - | ^^^^^^^^ unsatisfied trait bound + | ^^^^^^^^ doesn't have a size known at compile-time | -help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` - --> $DIR/dropck-normalize-errors.rs:15:1 - | -LL | struct NonImplementedStruct; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: this trait has no implementations, consider adding one - --> $DIR/dropck-normalize-errors.rs:12:1 - | -LL | trait NonImplementedTrait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `BDecoder` - --> $DIR/dropck-normalize-errors.rs:31:12 +help: the trait `Sized` is not implemented for `BDecoder` + --> $DIR/dropck-normalize-errors.rs:31:1 | LL | pub struct BDecoder { - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ note: required by a bound in `Decode::Decoder` --> $DIR/dropck-normalize-errors.rs:9:5 | diff --git a/tests/ui/dropck/dropck-after-failed-type-lowering.stderr b/tests/ui/dropck/dropck-after-failed-type-lowering.stderr index 0922d2e4340e8..5037a7f792850 100644 --- a/tests/ui/dropck/dropck-after-failed-type-lowering.stderr +++ b/tests/ui/dropck/dropck-after-failed-type-lowering.stderr @@ -14,24 +14,6 @@ help: add missing lifetime argument LL | h: Option<::C<'a>>, | ++++ -error[E0277]: the trait bound `G: B` is not satisfied - --> $DIR/dropck-after-failed-type-lowering.rs:11:8 - | -LL | h: Option<::C>, - | ^^^^^^^^^^^^^^^^^^^ the trait `B` is not implemented for `G` - | -help: consider restricting type parameter `G` with trait `B` - | -LL | struct F { - | +++ - -error[E0277]: the trait bound `E: B` is not satisfied - --> $DIR/dropck-after-failed-type-lowering.rs:5:18 - | -LL | fn d() -> F { - | ^^^^ the trait `B` is not implemented for `E` - -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0107, E0277. -For more information about an error, try `rustc --explain E0107`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/dropck/dropck-only-error-gat.stderr b/tests/ui/dropck/dropck-only-error-gat.stderr index bee5caa6f2481..dab85a31a7759 100644 --- a/tests/ui/dropck/dropck-only-error-gat.stderr +++ b/tests/ui/dropck/dropck-only-error-gat.stderr @@ -1,16 +1,15 @@ -error[E0277]: the trait bound `::Associated: Clone` is not satisfied +error[E0271]: type mismatch resolving `::Gat<::Associated> == _` --> $DIR/dropck-only-error-gat.rs:37:21 | LL | pub fn new() -> Self { - | ^^^^ the trait `Clone` is not implemented for `::Associated` + | ^^^^ type mismatch resolving `::Gat<::Associated> == _` | -note: required by a bound in `GatTrait::Gat` - --> $DIR/dropck-only-error-gat.rs:14:17 +note: types differ + --> $DIR/dropck-only-error-gat.rs:20:26 | -LL | pub trait GatTrait { -LL | type Gat; - | ^^^^^ required by this bound in `GatTrait::Gat` +LL | type Gat = Box; + | ^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr index 223bf9ce08aee..1fea755d67766 100644 --- a/tests/ui/dst/dst-bad-coerce1.stderr +++ b/tests/ui/dst/dst-bad-coerce1.stderr @@ -9,13 +9,13 @@ LL | let f3: &Fat<[usize]> = f2; = note: expected reference `&Fat<[usize]>` found reference `&Fat<[isize; 3]>` -error[E0277]: the trait bound `Foo: Bar` is not satisfied +error[E0277]: the trait bound `Foo: Bar` is not satisfied in `Fat` --> $DIR/dst-bad-coerce1.rs:20:29 | LL | let f3: &Fat = f2; | ^^ unsatisfied trait bound | -help: the trait `Bar` is not implemented for `Foo` +help: within `Fat`, the trait `Bar` is not implemented for `Foo` --> $DIR/dst-bad-coerce1.rs:7:1 | LL | struct Foo; @@ -25,6 +25,18 @@ help: this trait has no implementations, consider adding one | LL | trait Bar { fn bar(&self) {} } | ^^^^^^^^^ +note: required because it appears within the type `Foo` + --> $DIR/dst-bad-coerce1.rs:7:8 + | +LL | struct Foo; + | ^^^ +note: required because it appears within the type `Fat` + --> $DIR/dst-bad-coerce1.rs:4:5 + | +LL | struct Fat { +LL | ptr: T + | ^^^^^^ required by this field + = note: required for `&Fat` to implement `CoerceUnsized<&Fat>` = note: required for the cast from `&Fat` to `&Fat` error: aborting due to 2 previous errors diff --git a/tests/ui/dst/dst-bad-deep-2.stderr b/tests/ui/dst/dst-bad-deep-2.stderr index fd6e7be576c7d..09f34865c8852 100644 --- a/tests/ui/dst/dst-bad-deep-2.stderr +++ b/tests/ui/dst/dst-bad-deep-2.stderr @@ -13,6 +13,20 @@ LL | struct Fat(T); = note: all function arguments must have a statically known size = help: unsized fn params are gated as an unstable feature -error: aborting due to 1 previous error +error[E0277]: the size for values of type `[isize]` cannot be known at compilation time + --> $DIR/dst-bad-deep-2.rs:11:34 + | +LL | let h: &Fat> = &Fat(*g); + | ^^^^^^^ doesn't have a size known at compile-time + | + = help: within `Fat>`, the trait `Sized` is not implemented for `[isize]` +note: required because it appears within the type `Fat<[isize]>` + --> $DIR/dst-bad-deep-2.rs:6:23 + | +LL | struct Fat(T); + | ^ required by this field + = note: the return type of a function must have a statically known size + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dyn-compatibility/associated-consts.stderr b/tests/ui/dyn-compatibility/associated-consts.stderr index 11d02dd2904c8..12419857ecfbc 100644 --- a/tests/ui/dyn-compatibility/associated-consts.stderr +++ b/tests/ui/dyn-compatibility/associated-consts.stderr @@ -14,6 +14,44 @@ LL | const X: usize; | ^ ...because it contains associated const `X` = help: consider moving `X` to another trait -error: aborting due to 1 previous error +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/associated-consts.rs:8:35 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/associated-consts.rs:5:11 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | const X: usize; + | ^ ...because it contains associated const `X` + = help: consider moving `X` to another trait +help: consider using an opaque type instead + | +LL - fn make_bar(t: &T) -> &dyn Bar { +LL + fn make_bar(t: &T) -> &impl Bar { + | + +error[E0308]: mismatched types + --> $DIR/associated-consts.rs:10:5 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | - -------- expected `&dyn Bar` because of return type + | | + | found this type parameter +LL | +LL | t + | ^ expected `&dyn Bar`, found `&T` + | + = note: expected reference `&dyn Bar` + found reference `&T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/dyn-incompat-const-slice.stderr b/tests/ui/dyn-compatibility/dyn-incompat-const-slice.stderr index 2978278bb286d..897479a3c46e4 100644 --- a/tests/ui/dyn-compatibility/dyn-incompat-const-slice.stderr +++ b/tests/ui/dyn-compatibility/dyn-incompat-const-slice.stderr @@ -22,6 +22,16 @@ help: alternatively, consider constraining `qiz` so it is explicitly marked as n LL | fn qiz() where Self: Sized; | +++++++++++++++++ +error[E0308]: mismatched types + --> $DIR/dyn-incompat-const-slice.rs:18:33 + | +LL | const BAR : Bar = Bar { foos: &[&FOO]}; + | ^^^^ expected `&dyn Qiz`, found `&Foo` + | + = note: expected reference `&'static (dyn Qiz + 'static)` + found reference `&Foo` + = help: `Foo` implements `Qiz` so you could box the found value and coerce it to the trait object `Box`, you will have to change the expected type as well + error[E0038]: the trait `Qiz` is not dyn compatible --> $DIR/dyn-incompat-const-slice.rs:18:31 | @@ -46,6 +56,7 @@ help: alternatively, consider constraining `qiz` so it is explicitly marked as n LL | fn qiz() where Self: Sized; | +++++++++++++++++ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/generics.stderr b/tests/ui/dyn-compatibility/generics.stderr index 79dccc4224487..11afe9f8beaa5 100644 --- a/tests/ui/dyn-compatibility/generics.stderr +++ b/tests/ui/dyn-compatibility/generics.stderr @@ -30,6 +30,43 @@ LL | fn bar(&self, t: T); | ^^^ ...because method `bar` has generic type parameters = help: consider moving `bar` to another trait +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/generics.rs:15:35 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/generics.rs:7:8 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait +help: consider using an opaque type instead + | +LL - fn make_bar(t: &T) -> &dyn Bar { +LL + fn make_bar(t: &T) -> &impl Bar { + | + +error[E0308]: mismatched types + --> $DIR/generics.rs:17:5 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | - -------- expected `&dyn Bar` because of return type + | | + | found this type parameter +LL | +LL | t + | ^ expected `&dyn Bar`, found `&T` + | + = note: expected reference `&dyn Bar` + found reference `&T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + error[E0038]: the trait `Bar` is not dyn compatible --> $DIR/generics.rs:22:15 | @@ -46,6 +83,7 @@ LL | fn bar(&self, t: T); | ^^^ ...because method `bar` has generic type parameters = help: consider moving `bar` to another trait -error: aborting due to 3 previous errors +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/ice-generics-of-crate-root-152335.stderr b/tests/ui/dyn-compatibility/ice-generics-of-crate-root-152335.stderr index 06fd8bced4af1..cce8227020209 100644 --- a/tests/ui/dyn-compatibility/ice-generics-of-crate-root-152335.stderr +++ b/tests/ui/dyn-compatibility/ice-generics-of-crate-root-152335.stderr @@ -46,34 +46,6 @@ LL | impl> Mirror for T {} | | | unsatisfied trait bound introduced here -error[E0277]: the size for values of type `RustaceansAreAwesome` cannot be known at compilation time - --> $DIR/ice-generics-of-crate-root-152335.rs:23:5 - | -LL | fn transmute(&self, t: T) -> ::Assoc; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `RustaceansAreAwesome` to implement `Mirror` - --> $DIR/ice-generics-of-crate-root-152335.rs:36:42 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here - -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/ice-generics-of-crate-root-152335.rs:23:5 - | -LL | fn transmute(&self, t: T) -> ::Assoc; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `Self` to implement `Mirror` - --> $DIR/ice-generics-of-crate-root-152335.rs:36:42 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here - error[E0038]: the trait `Foo` is not dyn compatible --> $DIR/ice-generics-of-crate-root-152335.rs:14:20 | @@ -108,24 +80,6 @@ LL | impl> Mirror for T {} | | | unsatisfied trait bound introduced here -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/ice-generics-of-crate-root-152335.rs:17:1 - | -LL | trait Foo: Super - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `Self` to implement `Mirror` - --> $DIR/ice-generics-of-crate-root-152335.rs:36:42 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here -help: consider further restricting `Self` - | -LL | trait Foo: Super + Sized - | +++++++ - error[E0046]: not all trait items implemented, missing: `Assoc` --> $DIR/ice-generics-of-crate-root-152335.rs:36:1 | @@ -159,25 +113,7 @@ LL | impl> Mirror for T {} | | | unsatisfied trait bound introduced here -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/ice-generics-of-crate-root-152335.rs:23:5 - | -LL | fn transmute(&self, t: T) -> ::Assoc; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `Self` to implement `Mirror` - --> $DIR/ice-generics-of-crate-root-152335.rs:36:42 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here -help: consider further restricting `Self` - | -LL | fn transmute(&self, t: T) -> ::Assoc where Self: Sized; - | +++++++++++++++++ - -error: aborting due to 12 previous errors +error: aborting due to 8 previous errors -Some errors have detailed explanations: E0038, E0046, E0271, E0277, E0405, E0601. +Some errors have detailed explanations: E0038, E0046, E0271, E0405, E0601. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/mentions-Self.stderr b/tests/ui/dyn-compatibility/mentions-Self.stderr index 9d41e1d92ddf7..6336cc477cfa6 100644 --- a/tests/ui/dyn-compatibility/mentions-Self.stderr +++ b/tests/ui/dyn-compatibility/mentions-Self.stderr @@ -30,6 +30,81 @@ LL | fn baz(&self) -> Self; | ^^^^ ...because method `baz` references the `Self` type in its return type = help: consider moving `baz` to another trait -error: aborting due to 2 previous errors +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/mentions-Self.rs:18:35 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/mentions-Self.rs:7:22 + | +LL | trait Bar { + | --- this trait is not dyn compatible... +LL | fn bar(&self, x: &Self); + | ^^^^^ ...because method `bar` references the `Self` type in this parameter + = help: consider moving `bar` to another trait +help: consider using an opaque type instead + | +LL - fn make_bar(t: &T) -> &dyn Bar { +LL + fn make_bar(t: &T) -> &impl Bar { + | + +error[E0308]: mismatched types + --> $DIR/mentions-Self.rs:20:5 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | - -------- expected `&dyn Bar` because of return type + | | + | found this type parameter +LL | +LL | t + | ^ expected `&dyn Bar`, found `&T` + | + = note: expected reference `&dyn Bar` + found reference `&T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error[E0038]: the trait `Baz` is not dyn compatible + --> $DIR/mentions-Self.rs:23:35 + | +LL | fn make_baz(t: &T) -> &dyn Baz { + | ^^^ `Baz` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/mentions-Self.rs:11:22 + | +LL | trait Baz { + | --- this trait is not dyn compatible... +LL | fn baz(&self) -> Self; + | ^^^^ ...because method `baz` references the `Self` type in its return type + = help: consider moving `baz` to another trait +help: consider using an opaque type instead + | +LL - fn make_baz(t: &T) -> &dyn Baz { +LL + fn make_baz(t: &T) -> &impl Baz { + | + +error[E0308]: mismatched types + --> $DIR/mentions-Self.rs:25:5 + | +LL | fn make_baz(t: &T) -> &dyn Baz { + | - -------- expected `&dyn Baz` because of return type + | | + | found this type parameter +LL | +LL | t + | ^ expected `&dyn Baz`, found `&T` + | + = note: expected reference `&dyn Baz` + found reference `&T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/sized-2.stderr b/tests/ui/dyn-compatibility/sized-2.stderr index 70bd5f6dd36cf..1659fbc13f940 100644 --- a/tests/ui/dyn-compatibility/sized-2.stderr +++ b/tests/ui/dyn-compatibility/sized-2.stderr @@ -13,6 +13,43 @@ LL | trait Bar LL | where Self : Sized | ^^^^^ ...because it requires `Self: Sized` -error: aborting due to 1 previous error +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/sized-2.rs:10:35 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/sized-2.rs:5:18 + | +LL | trait Bar + | --- this trait is not dyn compatible... +LL | where Self : Sized + | ^^^^^ ...because it requires `Self: Sized` +help: consider using an opaque type instead + | +LL - fn make_bar(t: &T) -> &dyn Bar { +LL + fn make_bar(t: &T) -> &impl Bar { + | + +error[E0308]: mismatched types + --> $DIR/sized-2.rs:12:5 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | - -------- expected `&dyn Bar` because of return type + | | + | found this type parameter +LL | +LL | t + | ^ expected `&dyn Bar`, found `&T` + | + = note: expected reference `&dyn Bar` + found reference `&T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/sized-3.stderr b/tests/ui/dyn-compatibility/sized-3.stderr index 88d3bb5810fe2..eff6c11c81072 100644 --- a/tests/ui/dyn-compatibility/sized-3.stderr +++ b/tests/ui/dyn-compatibility/sized-3.stderr @@ -33,6 +33,37 @@ LL | fn unsize_subtrait(x: Box) -> Box { = note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit +error[E0038]: the trait `Sized` is not dyn compatible + --> $DIR/sized-3.rs:8:51 + | +LL | fn unsize_sized(x: Box) -> Box { + | ^^^^^ `Sized` is not dyn compatible + | + = note: the trait is not dyn compatible because it requires `Self: Sized` + = note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit +help: consider using an opaque type instead + | +LL - fn unsize_sized(x: Box) -> Box { +LL + fn unsize_sized(x: Box) -> Box { + | + +error[E0308]: mismatched types + --> $DIR/sized-3.rs:10:5 + | +LL | fn unsize_sized(x: Box) -> Box { + | - -------------- expected `Box<(dyn Sized + 'static)>` because of return type + | | + | found this type parameter +LL | +LL | x + | ^ expected `Box`, found `Box` + | + = note: expected struct `Box<(dyn Sized + 'static)>` + found struct `Box` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + error[E0038]: the trait `Sized` is not dyn compatible --> $DIR/sized-3.rs:20:15 | @@ -83,6 +114,7 @@ LL | let _bx = unsize_subtrait(bx); = note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit -error: aborting due to 7 previous errors +error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/sized.stderr b/tests/ui/dyn-compatibility/sized.stderr index 0cc41179d9a84..be9ed3af2b752 100644 --- a/tests/ui/dyn-compatibility/sized.stderr +++ b/tests/ui/dyn-compatibility/sized.stderr @@ -13,6 +13,43 @@ LL | trait Bar: Sized { | | | this trait is not dyn compatible... -error: aborting due to 1 previous error +error[E0038]: the trait `Bar` is not dyn compatible + --> $DIR/sized.rs:8:36 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | ^^^ `Bar` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/sized.rs:4:12 + | +LL | trait Bar: Sized { + | --- ^^^^^ ...because it requires `Self: Sized` + | | + | this trait is not dyn compatible... +help: consider using an opaque type instead + | +LL - fn make_bar(t: &T) -> &dyn Bar { +LL + fn make_bar(t: &T) -> &impl Bar { + | + +error[E0308]: mismatched types + --> $DIR/sized.rs:10:5 + | +LL | fn make_bar(t: &T) -> &dyn Bar { + | - -------- expected `&dyn Bar` because of return type + | | + | found this type parameter +LL | +LL | t + | ^ expected `&dyn Bar`, found `&T` + | + = note: expected reference `&dyn Bar` + found reference `&T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr index a8c2f512a9ada..a445024e2a2c9 100644 --- a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr +++ b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr @@ -1,10 +1,5 @@ error[E0311]: the parameter type `Self` may not live long enough | -note: ...that is required by this bound - --> $DIR/supertrait-mentions-GAT.rs:6:15 - | -LL | Self: 'a; - | ^^ = help: consider adding an explicit lifetime bound `Self: 'a`... error[E0038]: the trait `SuperTrait` is not dyn compatible diff --git a/tests/ui/eii/static/subtype_wrong.stderr b/tests/ui/eii/static/subtype_wrong.stderr index 77a1353aecc32..a1980d34d9a62 100644 --- a/tests/ui/eii/static/subtype_wrong.stderr +++ b/tests/ui/eii/static/subtype_wrong.stderr @@ -1,12 +1,11 @@ -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/subtype_wrong.rs:12:1 | LL | static HELLO_IMPL: for<'a> fn(&'a u8) -> &'a u8 = |_| todo!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected fn pointer `for<'a> fn(&'a _) -> &'static _` - found fn pointer `for<'a> fn(&'a _) -> &'a _` + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/ergonomic-clones/closure/fn-once.stderr b/tests/ui/ergonomic-clones/closure/fn-once.stderr index 40f1200695cc3..788a6706f72ef 100644 --- a/tests/ui/ergonomic-clones/closure/fn-once.stderr +++ b/tests/ui/ergonomic-clones/closure/fn-once.stderr @@ -9,6 +9,12 @@ LL | vec LL | Box::new(closure) | ----------------- the requirement to implement `Fn` derives from here | +note: required because it's used within this closure + --> $DIR/fn-once.rs:7:19 + | +LL | let closure = use || { + | ^^^^^^ + = note: required for `Box<{closure@$DIR/fn-once.rs:7:19: 7:25}>` to implement `CoerceUnsized Vec>>` = note: required for the cast from `Box<{closure@$DIR/fn-once.rs:7:19: 7:25}>` to `Box<(dyn Fn() -> Vec + 'static)>` error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0059.stderr b/tests/ui/error-codes/E0059.stderr index 43191db8be109..1887cc672f29b 100644 --- a/tests/ui/error-codes/E0059.stderr +++ b/tests/ui/error-codes/E0059.stderr @@ -1,3 +1,12 @@ +error[E0059]: type parameter to bare `FnOnce` trait must be a tuple + --> $DIR/E0059.rs:3:29 + | +LL | fn foo>(f: F) -> F::Output { f(3) } + | ^^^^^^^^^ the nightly-only, unstable trait `std::marker::Tuple` is not implemented for `i32` + | +note: required by a bound in `FnOnce` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL + error[E0059]: type parameter to bare `Fn` trait must be a tuple --> $DIR/E0059.rs:3:11 | @@ -19,7 +28,7 @@ error[E0059]: cannot use call notation; the first type parameter for the functio LL | fn foo>(f: F) -> F::Output { f(3) } | ^^^^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0059, E0277. For more information about an error, try `rustc --explain E0059`. diff --git a/tests/ui/error-codes/E0229.stderr b/tests/ui/error-codes/E0229.stderr index 7c967e89ddbc1..8bc087f64699d 100644 --- a/tests/ui/error-codes/E0229.stderr +++ b/tests/ui/error-codes/E0229.stderr @@ -47,6 +47,38 @@ help: consider restricting type parameter `I` with trait `Foo` LL | fn baz(x: &>::A) {} | +++++ +error[E0229]: associated item constraints are not allowed here + --> $DIR/E0229.rs:13:25 + | +LL | fn baz(x: &>::A) {} + | ^^^^^^^ associated item constraint not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider removing this associated item binding + | +LL - fn baz(x: &>::A) {} +LL + fn baz(x: &::A) {} + | + +error[E0229]: associated item constraints are not allowed here + --> $DIR/E0229.rs:13:25 + | +LL | fn baz(x: &>::A) {} + | ^^^^^^^ associated item constraint not allowed here + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider removing this associated item binding + | +LL - fn baz(x: &>::A) {} +LL + fn baz(x: &::A) {} + | + +error: the type `&::A` is not well-formed + --> $DIR/E0229.rs:13:14 + | +LL | fn baz(x: &>::A) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + error[E0277]: the trait bound `I: Foo` is not satisfied --> $DIR/E0229.rs:13:14 | @@ -58,7 +90,7 @@ help: consider restricting type parameter `I` with trait `Foo` LL | fn baz(x: &>::A) {} | +++++ -error: aborting due to 5 previous errors +error: aborting due to 8 previous errors Some errors have detailed explanations: E0229, E0277. For more information about an error, try `rustc --explain E0229`. diff --git a/tests/ui/error-codes/E0308-2.stderr b/tests/ui/error-codes/E0308-2.stderr index b149779179734..2bc85d2fb5ac8 100644 --- a/tests/ui/error-codes/E0308-2.stderr +++ b/tests/ui/error-codes/E0308-2.stderr @@ -1,18 +1,16 @@ -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/E0308-2.rs:9:13 | LL | impl Eq for &dyn DynEq {} - | ^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^ | - = note: expected trait `<&dyn DynEq as PartialEq>` - found trait `<&(dyn DynEq + 'static) as PartialEq>` -note: the anonymous lifetime as defined here... +note: lifetime parameter instantiated with the anonymous lifetime as defined here --> $DIR/E0308-2.rs:9:13 | LL | impl Eq for &dyn DynEq {} | ^ - = note: ...does not necessarily outlive the static lifetime + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/error-codes/E0582.stderr b/tests/ui/error-codes/E0582.stderr index ac97a6ff00a81..894b692e5d1be 100644 --- a/tests/ui/error-codes/E0582.stderr +++ b/tests/ui/error-codes/E0582.stderr @@ -10,21 +10,23 @@ error[E0582]: binding for associated type `Item` references lifetime `'a`, which LL | where F: for<'a> Iterator | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/E0582.rs:22:5 +error[E0271]: type mismatch resolving ` Option<&i32> {mk_unexpected_char_err::<'_>} as FnOnce<()>>::Output == Option<&i32>` + --> $DIR/E0582.rs:22:9 | LL | bar(mk_unexpected_char_err) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | --- ^^^^^^^^^^^^^^^^^^^^^^ types differ + | | + | required by a bound introduced by this call | - = note: expected enum `Option<&_>` - found enum `Option<&'a _>` -note: the lifetime requirement is introduced here +note: required by a bound in `bar` --> $DIR/E0582.rs:28:30 | +LL | fn bar(t: F) +... LL | where F: for<'a> Fn() -> Option<&'a i32> - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ required by this bound in `bar` error: aborting due to 3 previous errors -Some errors have detailed explanations: E0308, E0582. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0271, E0582. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/error-emitter/multiline-removal-suggestion.svg b/tests/ui/error-emitter/multiline-removal-suggestion.svg index e1a15eba86fc0..13c45cb0705c9 100644 --- a/tests/ui/error-emitter/multiline-removal-suggestion.svg +++ b/tests/ui/error-emitter/multiline-removal-suggestion.svg @@ -1,4 +1,4 @@ - + ; | ^^^^^^^^ expected fn item, found a different fn item | = note: expected fn item `fn(()) -> () {bar::<()>}` - found fn item `fn(I) -> I {foo::}` -help: use parentheses to call this function - | -LL | x = foo::(/* I */); - | +++++++++ + found fn item `fn(_) -> _ {foo::<_>}` + = note: different fn items have unique types, even if their signatures are the same + = help: consider casting both fn items to fn pointers using `as fn(())` error: aborting due to 2 previous errors diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr index b2aa1abbbdb6e..357914cec4f5d 100644 --- a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr +++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr @@ -2,15 +2,10 @@ error[E0309]: the parameter type `T` may not live long enough --> $DIR/implied-bounds-unnorm-associated-type-5.rs:6:13 | LL | impl<'a, T> Trait<'a> for T { - | -- ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | -- ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds | | | the parameter type `T` must be valid for the lifetime `'a` as defined here... | -note: ...that is required by this bound - --> $DIR/implied-bounds-unnorm-associated-type-5.rs:1:18 - | -LL | trait Trait<'a>: 'a { - | ^^ help: consider adding an explicit lifetime bound | LL | impl<'a, T: 'a> Trait<'a> for T { diff --git a/tests/ui/foreign/foreign-safe-fn-arg-mismatch.stderr b/tests/ui/foreign/foreign-safe-fn-arg-mismatch.stderr index 73ccecff5ab8c..26d6fc3030774 100644 --- a/tests/ui/foreign/foreign-safe-fn-arg-mismatch.stderr +++ b/tests/ui/foreign/foreign-safe-fn-arg-mismatch.stderr @@ -1,44 +1,36 @@ -error[E0593]: function is expected to take 1 argument, but it takes 0 arguments +error[E0277]: expected an `Fn(i32)` closure, found `fn() {foo}` --> $DIR/foreign-safe-fn-arg-mismatch.rs:11:10 | -LL | pub safe fn foo(); - | ------------------ takes 0 arguments -... LL | test(foo); - | ---- ^^^ expected function that takes 1 argument + | ---- ^^^ expected an `Fn(i32)` closure, found `fn() {foo}` | | | required by a bound introduced by this call | + = help: the trait `Fn(i32)` is not implemented for fn item `fn() {foo}` + = note: expected a closure taking 0 arguments, but one taking 1 argument was given note: required by a bound in `test` --> $DIR/foreign-safe-fn-arg-mismatch.rs:8:17 | LL | fn test(_: impl Fn(i32)) {} | ^^^^^^^ required by this bound in `test` -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `Fn(i32)` closure, found `fn(u32) {bar}` --> $DIR/foreign-safe-fn-arg-mismatch.rs:12:10 | -LL | pub safe fn bar(x: u32); - | ------------------------ found signature defined here -... LL | test(bar); - | ---- ^^^ expected due to this + | ---- ^^^ expected an `Fn(i32)` closure, found `fn(u32) {bar}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(i32) -> _` - found function signature `fn(u32) -> _` + = help: the trait `Fn(i32)` is not implemented for fn item `fn(u32) {bar}` + = note: expected a closure with signature `fn(i32)` + found a closure with signature `fn(u32)` note: required by a bound in `test` --> $DIR/foreign-safe-fn-arg-mismatch.rs:8:17 | LL | fn test(_: impl Fn(i32)) {} | ^^^^^^^ required by this bound in `test` -help: consider wrapping the function in a closure - | -LL | test(|arg0: i32| bar(/* u32 */)); - | +++++++++++ +++++++++++ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0593, E0631. -For more information about an error, try `rustc --explain E0593`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/function-pointer/unsized-ret.stderr b/tests/ui/function-pointer/unsized-ret.stderr index 66116273ff4d6..61d09c90957ab 100644 --- a/tests/ui/function-pointer/unsized-ret.stderr +++ b/tests/ui/function-pointer/unsized-ret.stderr @@ -12,13 +12,13 @@ note: required by a bound in `foo` LL | fn foo, T:std::marker::Tuple>(f: Option, t: T) { | ^^^^^ required by this bound in `foo` -error[E0277]: the size for values of type `(dyn std::fmt::Display + 'a)` cannot be known at compilation time +error[E0277]: the size for values of type `dyn std::fmt::Display` cannot be known at compilation time --> $DIR/unsized-ret.rs:13:11 | LL | foo:: fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&(),)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)` + = help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `Sized` is not implemented for `dyn std::fmt::Display` = note: required because it appears within the type `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)` note: required by a bound in `foo` --> $DIR/unsized-ret.rs:5:11 diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr index 77a637c470cc2..8bb72833e301c 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-1.stderr @@ -14,11 +14,6 @@ note: due to a current limitation of the type system, this implies a `'static` l | LL | for<'a> I::Item<'a>: Debug, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: requirement that the value outlives `'static` introduced here - --> $DIR/hrtb-implied-1.rs:26:26 - | -LL | for<'a> I::Item<'a>: Debug, - | ^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/bugs/issue-87735.stderr b/tests/ui/generic-associated-types/bugs/issue-87735.stderr index 60e1d71cdac7d..7cd22aadee3be 100644 --- a/tests/ui/generic-associated-types/bugs/issue-87735.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-87735.stderr @@ -13,6 +13,50 @@ LL | LL ~ impl<'b, T, U> AsRef2 for Foo | +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/issue-87735.rs:36:3 + | +LL | impl<'b, T, U> AsRef2 for Foo + | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... +... +LL | fn as_ref2<'a>(&'a self) -> Self::Output<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | T: AsRef2 = &'b [U]> + 'b, + | ++++ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/issue-87735.rs:36:3 + | +LL | impl<'b, T, U> AsRef2 for Foo + | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... +... +LL | fn as_ref2<'a>(&'a self) -> Self::Output<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | T: AsRef2 = &'b [U]> + 'b, + | ++++ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/issue-87735.rs:36:3 + | +LL | impl<'b, T, U> AsRef2 for Foo + | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... +... +LL | fn as_ref2<'a>(&'a self) -> Self::Output<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | T: AsRef2 = &'b [U]> + 'b, + | ++++ + error[E0309]: the parameter type `U` may not live long enough --> $DIR/issue-87735.rs:34:3 | @@ -20,19 +64,14 @@ LL | type Output<'a> = FooRef<'a, U> where Self: 'a; | ^^^^^^^^^^^^--^ | | | | | the parameter type `U` must be valid for the lifetime `'a` as defined here... - | ...so that the type `U` will meet its required lifetime bounds... + | ...so that the type `U` will meet its required lifetime bounds | -note: ...that is required by this bound - --> $DIR/issue-87735.rs:23:22 - | -LL | struct FooRef<'a, U>(&'a [U]); - | ^^^^^^^ help: consider adding an explicit lifetime bound | LL | type Output<'a> = FooRef<'a, U> where Self: 'a, U: 'a; | +++++++ -error: aborting due to 2 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0207, E0309. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/generic-associated-types/bugs/issue-87803.stderr b/tests/ui/generic-associated-types/bugs/issue-87803.stderr index 31ed47749a87c..5b9e1acd62886 100644 --- a/tests/ui/generic-associated-types/bugs/issue-87803.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-87803.stderr @@ -1,11 +1,24 @@ -error[E0195]: lifetime parameters or bounds on method `scan` do not match the trait declaration - --> $DIR/issue-87803.rs:20:12 +error[E0195]: lifetime parameters do not match the trait definition + --> $DIR/issue-87803.rs:20:13 | +LL | fn scan<'a>(&mut self, s : &'a str) -> &'a str { + | ^^ + | + = note: lifetime parameters differ in whether they are early- or late-bound +note: `'a` differs between the trait and impl + --> $DIR/issue-87803.rs:11:13 + | +LL | trait Scanner { + | ------------- in this trait... +... LL | fn scan<'a>(&mut self, i : Self::Input<'a>) -> Self::Token<'a>; - | ---- lifetimes in impl do not match this method in trait + | ^^ `'a` is early-bound +... +LL | impl Scanner for IdScanner { + | -------------------------- in this impl... ... LL | fn scan<'a>(&mut self, s : &'a str) -> &'a str { - | ^^^^ lifetimes do not match method in trait + | ^^ `'a` is late-bound error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/bugs/issue-88382.stderr b/tests/ui/generic-associated-types/bugs/issue-88382.stderr index 8b6c8929dd608..0a8cf7722feb2 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88382.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88382.stderr @@ -2,31 +2,23 @@ error[E0283]: type annotations needed --> $DIR/issue-88382.rs:26:40 | LL | do_something(SomeImplementation(), test); - | ------------ ^^^^ cannot infer type of the type parameter `I` declared on the function `test` + | ------------ ^^^^ cannot infer type for fn item `for<'b, 'a> fn(&'b mut <_ as Iterable>::Iterator<'a>) {test::<_>}` | | | required by a bound introduced by this call | - = note: the type must implement `Iterable` -help: the trait `Iterable` is implemented for `SomeImplementation` - --> $DIR/issue-88382.rs:13:1 - | -LL | impl Iterable for SomeImplementation { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: cannot satisfy `<_ as Iterable>::Iterator<'_> == std::iter::Empty` -note: required by a bound in `test` - --> $DIR/issue-88382.rs:29:16 - | -LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {} - | ^^^^^^^^ required by this bound in `test` + = note: cannot satisfy `for<'a> for<'a, 'a> fn(&'a mut <_ as Iterable>::Iterator<'a>) {test::<_>}: Fn(&'a mut std::iter::Empty)` + = note: the type must also implement `Iterable` + = note: cannot satisfy `<_ as Iterable>::Iterator<'_> == _` note: required by a bound in `do_something` --> $DIR/issue-88382.rs:20:48 | LL | fn do_something(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something` -help: consider specifying a concrete type for the type parameter `I` +note: required by a bound in `test` + --> $DIR/issue-88382.rs:29:16 | -LL | do_something(SomeImplementation(), test::); - | ++++++++++++++ +LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {} + | ^^^^^^^^ required by this bound in `test` error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/bugs/issue-88526.stderr b/tests/ui/generic-associated-types/bugs/issue-88526.stderr index ea2962c693f0a..3edb22bec49ee 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88526.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88526.stderr @@ -14,7 +14,7 @@ LL | type I<'a> = &'a F; | ^^^^^^^--^ | | | | | the parameter type `F` must be valid for the lifetime `'a` as defined here... - | ...so that the reference type `&'a F` does not outlive the data it points at + | ...so that the type `F` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/generic-associated-types/extended/lending_iterator.stderr b/tests/ui/generic-associated-types/extended/lending_iterator.stderr index 7af95dc96a10a..c27d60fe6e9fb 100644 --- a/tests/ui/generic-associated-types/extended/lending_iterator.stderr +++ b/tests/ui/generic-associated-types/extended/lending_iterator.stderr @@ -1,11 +1,13 @@ -error[E0276]: impl has stricter requirements than trait +error[E0311]: the parameter type `I` may not live long enough --> $DIR/lending_iterator.rs:8:45 | -LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; - | ------------------------------------------------------------------------ definition of `from_iter` from trait -... LL | fn from_iter LendingIterator = A>>(mut iter: I) -> Self { - | ^^^^^^^^^^^^ impl has extra requirement `I: 'x` + | ^^^^^^^^^^^^ + | | + | the parameter type `I` must be valid for lifetime `'x`... + | ...so that the type `I` will meet its required lifetime bounds + | + = help: consider adding an explicit lifetime bound `I: 'x`... error: `Self` does not live long enough --> $DIR/lending_iterator.rs:28:9 @@ -21,4 +23,4 @@ LL | fn from_iter LendingIterator = A>>(iter: T) -> Self error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/generic-associated-types/extended/lending_iterator_2.stderr b/tests/ui/generic-associated-types/extended/lending_iterator_2.stderr index 47c32a28aea53..0a6b109793b9a 100644 --- a/tests/ui/generic-associated-types/extended/lending_iterator_2.stderr +++ b/tests/ui/generic-associated-types/extended/lending_iterator_2.stderr @@ -1,12 +1,14 @@ -error[E0276]: impl has stricter requirements than trait +error[E0311]: the parameter type `I` may not live long enough --> $DIR/lending_iterator_2.rs:8:45 | -LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; - | ------------------------------------------------------------------------ definition of `from_iter` from trait -... LL | fn from_iter LendingIterator = A>>(mut iter: I) -> Self { - | ^^^^^^^^^^^^ impl has extra requirement `I: 'x` + | ^^^^^^^^^^^^ + | | + | the parameter type `I` must be valid for lifetime `'x`... + | ...so that the type `I` will meet its required lifetime bounds + | + = help: consider adding an explicit lifetime bound `I: 'x`... error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr index 9e56955aff17b..a679fcf39b9ce 100644 --- a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr +++ b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr @@ -1,16 +1,22 @@ -error: implementation of `Lengthen` is not general enough +error[E0277]: the trait bound `for<'b> &'a str: Lengthen<&'b str>` is not satisfied --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:20:20 | LL | type Gat<'a> = &'a str; - | ^^^^^^^ + | ^^^^^^^ the trait `for<'b> Lengthen<&'b str>` is not implemented for `&'a str` | -note: `Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, for any lifetime `'0`... +help: the trait `Lengthen<&'b _>` is not implemented for `&'a _` + but trait `Lengthen<&_>` is implemented for `&_` + --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:7:1 + | +LL | impl<'a> Lengthen<&'a str> for &'a str { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `Gat::Gat` --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 | LL | trait Gat { LL | type Gat<'a>: for<'b> Lengthen>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Gat::Gat` - = note: ...but `Lengthen<&'1 str>` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` 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/gat-in-trait-path.stderr b/tests/ui/generic-associated-types/gat-in-trait-path.stderr index 8dec88f6d932f..58bec15f50ec8 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path.stderr +++ b/tests/ui/generic-associated-types/gat-in-trait-path.stderr @@ -30,6 +30,24 @@ LL | type A<'a> where Self: 'a; | ^ ...because it contains generic associated type `A` = help: consider moving `A` to another trait -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/gat-in-trait-path.rs:27:5 + | +LL | f(Box::new(foo)); + | - ^^^^^^^^^^^^^ expected `Box = &()>>`, found `Box>` + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<(dyn Foo = &'a ()> + 'static)>` + found struct `Box>` + = help: `Fooer<{integer}>` implements `Foo` so you could box the found value and coerce it to the trait object `Box`, you will have to change the expected type as well +note: function defined here + --> $DIR/gat-in-trait-path.rs:22:4 + | +LL | fn f(_arg : Box Foo = &'a ()>>) {} + | ^ ------------------------------------------- + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/generic-associated-types/generic-associated-types-where.stderr b/tests/ui/generic-associated-types/generic-associated-types-where.stderr index 637f86f7bec28..bcc98e71b64ae 100644 --- a/tests/ui/generic-associated-types/generic-associated-types-where.stderr +++ b/tests/ui/generic-associated-types/generic-associated-types-where.stderr @@ -1,13 +1,11 @@ -error[E0277]: `T` doesn't implement `std::fmt::Display` +error[E0271]: type mismatch resolving `::Assoc2 == _` --> $DIR/generic-associated-types-where.rs:18:22 | LL | type Assoc2 = Vec; - | ^^^^^^ the trait `std::fmt::Display` is not implemented for `T` - | -help: consider restricting type parameter `T` with trait `Display` - | -LL | type Assoc2 = Vec; - | +++++++++++++++++++ + | ^^^^^^ + | | + | types differ + | type mismatch resolving `::Assoc2 == _` error[E0276]: impl has stricter requirements than trait --> $DIR/generic-associated-types-where.rs:20:38 @@ -20,5 +18,5 @@ LL | type Assoc3 = Vec where T: Iterator; error: aborting due to 2 previous errors -Some errors have detailed explanations: E0276, E0277. -For more information about an error, try `rustc --explain E0276`. +Some errors have detailed explanations: E0271, E0276. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr index 65e1dff479e54..1d2a5e9630e13 100644 --- a/tests/ui/generic-associated-types/impl_bounds.stderr +++ b/tests/ui/generic-associated-types/impl_bounds.stderr @@ -1,26 +1,33 @@ -error[E0276]: impl has stricter requirements than trait +error[E0310]: the parameter type `T` may not live long enough --> $DIR/impl_bounds.rs:14:39 | -LL | type A<'a> where Self: 'a; - | ---------- definition of `A` from trait -... LL | type A<'a> = (&'a ()) where Self: 'static; - | ^^^^^^^ impl has extra requirement `T: 'static` + | ^^^^^^^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `Fooy` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | impl Foo for Fooy { + | +++++++++ -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/impl_bounds.rs:16:48 | -LL | type B<'a, 'b> where 'a: 'b; - | -------------- definition of `B` from trait -... LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; - | ^^ impl has extra requirement `'b: 'a` + | ^^ | -help: copy the `where` clause predicates from the trait +note: lifetime parameter instantiated with the lifetime `'b` as defined here + --> $DIR/impl_bounds.rs:16:16 | -LL - type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; -LL + type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b; +LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; + | ^^ +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/impl_bounds.rs:16:12 | +LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; + | ^^ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/impl_bounds.rs:18:33 @@ -76,5 +83,5 @@ LL | impl Foo for Fooy { error: aborting due to 4 previous errors -Some errors have detailed explanations: E0276, E0277. -For more information about an error, try `rustc --explain E0276`. +Some errors have detailed explanations: E0277, E0310, E0478. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr b/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr index 86e0f57454404..ac41775a6176e 100644 --- a/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr +++ b/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr @@ -1,87 +1,42 @@ -error: incompatible lifetime on type +error[E0478]: lifetime bound not satisfied --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:15:18 | LL | type T<'a> = Box; | ^^^^^^^^^^^^^^^ | -note: because this has an unmet lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:10:17 - | -LL | type T<'a>: A; - | ^ introduces a `'static` lifetime requirement -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:15:12 | LL | type T<'a> = Box; | ^^ - = note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` -note: this has an implicit `'static` lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:7:20 - | -LL | impl A for Box {} - | ^ -help: consider relaxing the implicit `'static` requirement - | -LL | impl A for Box {} - | ++++ + = note: but lifetime parameter must outlive the static lifetime -error: incompatible lifetime on type +error[E0478]: lifetime bound not satisfied --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:25:18 | LL | type T<'a> = Box; | ^^^^^^^^^^^^^^^ | -note: because this has an unmet lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:21:17 - | -LL | type T<'a>: C; - | ^ introduces a `'static` lifetime requirement -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:25:12 | LL | type T<'a> = Box; | ^^ -note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:19:1 - | -LL | impl C for Box {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: but lifetime parameter must outlive the static lifetime -error: incompatible lifetime on type +error[E0478]: lifetime bound not satisfied --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:35:18 | LL | type T<'a> = (Box, Box); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: because this has an unmet lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:31:17 - | -LL | type T<'a>: E; - | ^ introduces a `'static` lifetime requirement -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:35:12 | LL | type T<'a> = (Box, Box); | ^^ - = note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` -note: this has an implicit `'static` lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:29:21 - | -LL | impl E for (Box, Box) {} - | ^ -note: this has an implicit `'static` lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:29:33 - | -LL | impl E for (Box, Box) {} - | ^ -help: consider relaxing the implicit `'static` requirement - | -LL | impl E for (Box, Box) {} - | ++++ -help: consider relaxing the implicit `'static` requirement - | -LL | impl E for (Box, Box) {} - | ++++ + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/generic-associated-types/issue-84931.stderr b/tests/ui/generic-associated-types/issue-84931.stderr index 0181948110832..6a44a5ec273a5 100644 --- a/tests/ui/generic-associated-types/issue-84931.stderr +++ b/tests/ui/generic-associated-types/issue-84931.stderr @@ -1,9 +1,6 @@ error[E0477]: the type `StreamingSliceIter<'b, T>` does not fulfill the required lifetime --> $DIR/issue-84931.rs:14:21 | -LL | type Item<'a> where Self: 'a; - | ------------- definition of `Item` from trait -... LL | type Item<'a> = &'a mut T; | ^^^^^^^^^ | @@ -12,10 +9,6 @@ note: type must outlive the lifetime `'a` as defined here | LL | type Item<'a> = &'a mut T; | ^^ -help: copy the `where` clause predicates from the trait - | -LL | type Item<'a> = &'a mut T where Self: 'a; - | ++++++++++++++ error[E0309]: the parameter type `T` may not live long enough --> $DIR/issue-84931.rs:14:5 @@ -24,7 +17,7 @@ LL | type Item<'a> = &'a mut T; | ^^^^^^^^^^--^ | | | | | the parameter type `T` must be valid for the lifetime `'a` as defined here... - | ...so that the reference type `&'a mut T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/generic-associated-types/issue-86787.stderr b/tests/ui/generic-associated-types/issue-86787.stderr index 00795abbd05d4..840abf0a74cf5 100644 --- a/tests/ui/generic-associated-types/issue-86787.stderr +++ b/tests/ui/generic-associated-types/issue-86787.stderr @@ -9,24 +9,34 @@ LL | type TRef<'a>; = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information -error[E0276]: impl has stricter requirements than trait +error[E0309]: the associated type `::T` may not live long enough --> $DIR/issue-86787.rs:25:37 | -LL | type TRef<'a>; - | ------------- definition of `TRef` from trait -... +LL | type TRef<'a> = Either<&'a Left::T, &'a Right::T> + | -- the associated type `::T` must be valid for the lifetime `'a` as defined here... +LL | where LL | ::T: 'a, - | ^^ impl has extra requirement `::T: 'a` + | ^^ ...so that the type `::T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | ::T: 'a, ::T: 'a; + | ++++++++++++++++++++++++++++++++ -error[E0276]: impl has stricter requirements than trait +error[E0309]: the associated type `::T` may not live long enough --> $DIR/issue-86787.rs:26:38 | -LL | type TRef<'a>; - | ------------- definition of `TRef` from trait +LL | type TRef<'a> = Either<&'a Left::T, &'a Right::T> + | -- the associated type `::T` must be valid for the lifetime `'a` as defined here... ... LL | ::T: 'a; - | ^^ impl has extra requirement `::T: 'a` + | ^^ ...so that the type `::T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | ::T: 'a, ::T: 'a; + | +++++++++++++++++++++++++++++++++ error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/generic-associated-types/issue-87258_a.stderr b/tests/ui/generic-associated-types/issue-87258_a.stderr index f175c15bd02b2..53bc7ebaceb56 100644 --- a/tests/ui/generic-associated-types/issue-87258_a.stderr +++ b/tests/ui/generic-associated-types/issue-87258_a.stderr @@ -1,15 +1,36 @@ -error: item does not constrain `<&'c mut S as Trait2>::FooFuture::{opaque#0}` - --> $DIR/issue-87258_a.rs:18:8 +warning: trait `Trait1` is more private than the item `Trait2::FooFuture` + --> $DIR/issue-87258_a.rs:12:5 | -LL | fn foo<'a>() -> Self::FooFuture<'a> { - | ^^^ +LL | type FooFuture<'a>: Trait1; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `Trait2::FooFuture` is reachable at visibility `pub` | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/issue-87258_a.rs:17:26 +note: but trait `Trait1` is only usable at visibility `pub(crate)` + --> $DIR/issue-87258_a.rs:5:1 | +LL | trait Trait1 {} + | ^^^^^^^^^^^^ + = note: `#[warn(private_bounds)]` on by default + +error[E0446]: private trait `Trait1` in public interface + --> $DIR/issue-87258_a.rs:17:5 + | +LL | trait Trait1 {} + | ------------ `Trait1` declared as private +... +LL | type FooFuture<'a> = impl Trait1; + | ^^^^^^^^^^^^^^^^^^ can't leak private trait + +error[E0446]: private trait `Trait1` in public interface + --> $DIR/issue-87258_a.rs:17:5 + | +LL | trait Trait1 {} + | ------------ `Trait1` declared as private +... LL | type FooFuture<'a> = impl Trait1; - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ can't leak private trait + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0446`. diff --git a/tests/ui/generic-associated-types/issue-87258_b.stderr b/tests/ui/generic-associated-types/issue-87258_b.stderr index 56abcef0d3776..b1d0336290a11 100644 --- a/tests/ui/generic-associated-types/issue-87258_b.stderr +++ b/tests/ui/generic-associated-types/issue-87258_b.stderr @@ -1,15 +1,25 @@ -error: item does not constrain `Helper::{opaque#0}` - --> $DIR/issue-87258_b.rs:21:8 +warning: trait `Trait1` is more private than the item `Trait2::FooFuture` + --> $DIR/issue-87258_b.rs:12:5 | -LL | fn foo<'a>() -> Self::FooFuture<'a> { - | ^^^ +LL | type FooFuture<'a>: Trait1; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `Trait2::FooFuture` is reachable at visibility `pub` | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/issue-87258_b.rs:16:49 +note: but trait `Trait1` is only usable at visibility `pub(crate)` + --> $DIR/issue-87258_b.rs:5:1 + | +LL | trait Trait1 {} + | ^^^^^^^^^^^^ + = note: `#[warn(private_bounds)]` on by default + +error[E0446]: private type alias `Helper` in public interface + --> $DIR/issue-87258_b.rs:19:5 | LL | type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1; - | ^^^^^^^^^^^ + | --------------------------------------------- `Helper` declared as private +... +LL | type FooFuture<'a> = Helper<'c, 'a, S>; + | ^^^^^^^^^^^^^^^^^^ can't leak private type alias -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0446`. diff --git a/tests/ui/generic-associated-types/issue-88287.stderr b/tests/ui/generic-associated-types/issue-88287.stderr index 71cd6677e63fb..76c88ede634dd 100644 --- a/tests/ui/generic-associated-types/issue-88287.stderr +++ b/tests/ui/generic-associated-types/issue-88287.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/issue-88287.rs:35:9 + --> $DIR/issue-88287.rs:34:5 | LL | type SearchFutureTy<'f, A, B: 'f> | - this type parameter needs to be `Sized` ... -LL | async move { todo!() } - | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | fn search<'c>(&'c self, _client: &'c ()) -> Self::Future<'c, Self, Criteria> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | note: required by an implicit `Sized` bound in `>` --> $DIR/issue-88287.rs:24:6 diff --git a/tests/ui/generic-associated-types/issue-88595.stderr b/tests/ui/generic-associated-types/issue-88595.stderr index 87dd7118c06f2..12968d86a3121 100644 --- a/tests/ui/generic-associated-types/issue-88595.stderr +++ b/tests/ui/generic-associated-types/issue-88595.stderr @@ -10,19 +10,11 @@ note: for this opaque type LL | type B<'b> = impl Clone; | ^^^^^^^^^^ -error: non-defining opaque type use in defining scope - --> $DIR/issue-88595.rs:21:35 +error: non-defining use of `>::B<'_>` in the defining scope + --> $DIR/issue-88595.rs:21:5 | LL | fn a(&'a self) -> Self::B<'a> {} - | ^^ - | -note: lifetime used multiple times - --> $DIR/issue-88595.rs:18:6 - | -LL | impl<'a> A<'a> for C { - | ^^ -LL | type B<'b> = impl Clone; - | ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr index bf944aac79758..643685e7afd92 100644 --- a/tests/ui/generic-associated-types/issue-90014-tait2.stderr +++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr @@ -1,12 +1,11 @@ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/issue-90014-tait2.rs:25:9 +error[E0282]: type annotations needed + --> $DIR/issue-90014-tait2.rs:24:27 | -LL | type Fut<'a> = impl Future; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | Box::new((async { () },)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn make_fut(&self) -> Box Trait<'a, Thing = Fut<'a>>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/generic-associated-types/issue-90014.stderr b/tests/ui/generic-associated-types/issue-90014.stderr index 2bb9d0c7ba609..d2783069f2fcc 100644 --- a/tests/ui/generic-associated-types/issue-90014.stderr +++ b/tests/ui/generic-associated-types/issue-90014.stderr @@ -1,9 +1,6 @@ error[E0477]: the type `&mut ()` does not fulfill the required lifetime --> $DIR/issue-90014.rs:15:20 | -LL | type Fut<'a> - | ------------ definition of `Fut` from trait -... LL | type Fut<'a> = impl Future; | ^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -12,10 +9,6 @@ note: type must outlive the lifetime `'a` as defined here | LL | type Fut<'a> = impl Future; | ^^ -help: copy the `where` clause predicates from the trait - | -LL | type Fut<'a> = impl Future where Self: 'a; - | ++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/issue-92033.stderr b/tests/ui/generic-associated-types/issue-92033.stderr index 5dfd66d544a35..a02ae2b6ac09a 100644 --- a/tests/ui/generic-associated-types/issue-92033.stderr +++ b/tests/ui/generic-associated-types/issue-92033.stderr @@ -1,9 +1,6 @@ error[E0477]: the type `&'s Texture` does not fulfill the required lifetime --> $DIR/issue-92033.rs:20:28 | -LL | type TextureIter<'a>: Iterator - | -------------------------------------------------- definition of `TextureIter` from trait -... LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -12,10 +9,6 @@ note: type must outlive the lifetime `'a` as defined here | LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; | ^^ -help: copy the `where` clause predicates from the trait - | -LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture> where Self: 'a; - | ++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr b/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr index 9ff343c255b7a..a9edfc3d31f17 100644 --- a/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr +++ b/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr @@ -1,18 +1,20 @@ -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/mismatched-where-clause-regions.rs:8:38 | -LL | type T<'a1, 'b1> - | ---------------- definition of `T` from trait -... LL | type T<'a2, 'b2> = () where 'b2: 'a2; - | ^^^ impl has extra requirement `'b2: 'a2` + | ^^^ | -help: copy the `where` clause predicates from the trait +note: lifetime parameter instantiated with the lifetime `'b2` as defined here + --> $DIR/mismatched-where-clause-regions.rs:8:17 | -LL - type T<'a2, 'b2> = () where 'b2: 'a2; -LL + type T<'a2, 'b2> = () where 'a2: 'b2; +LL | type T<'a2, 'b2> = () where 'b2: 'a2; + | ^^^ +note: but lifetime parameter must outlive the lifetime `'a2` as defined here + --> $DIR/mismatched-where-clause-regions.rs:8:12 | +LL | type T<'a2, 'b2> = () where 'b2: 'a2; + | ^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/generic-associated-types/missing-where-clause-on-trait.stderr b/tests/ui/generic-associated-types/missing-where-clause-on-trait.stderr index d0eb27343a967..f37788db90fe7 100644 --- a/tests/ui/generic-associated-types/missing-where-clause-on-trait.stderr +++ b/tests/ui/generic-associated-types/missing-where-clause-on-trait.stderr @@ -1,18 +1,20 @@ -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/missing-where-clause-on-trait.rs:7:39 | -LL | type Assoc<'a, 'b>; - | ------------------ definition of `Assoc` from trait -... LL | type Assoc<'a, 'b> = () where 'a: 'b; - | ^^ impl has extra requirement `'a: 'b` + | ^^ | -help: remove the `where` clause +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/missing-where-clause-on-trait.rs:7:16 | -LL - type Assoc<'a, 'b> = () where 'a: 'b; -LL + type Assoc<'a, 'b> = () ; +LL | type Assoc<'a, 'b> = () where 'a: 'b; + | ^^ +note: but lifetime parameter must outlive the lifetime `'b` as defined here + --> $DIR/missing-where-clause-on-trait.rs:7:20 | +LL | type Assoc<'a, 'b> = () where 'a: 'b; + | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr index 3155d78210c95..7d88fcea1e47d 100644 --- a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr +++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr @@ -11,6 +11,19 @@ LL | trait Trait { LL | type P; | ^^^^ required by this bound in `Trait::P` -error: aborting due to 1 previous error +error[E0271]: type mismatch resolving `<() as Trait>::P == _` + --> $DIR/multiple-type-params-with-unmet-bounds.rs:8:12 + | +LL | let _: <() as Trait>::P; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Trait>::P == _` + | +note: types differ + --> $DIR/multiple-type-params-with-unmet-bounds.rs:5:32 + | +LL | type P = (); + | ^^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/generic-associated-types/own-bound-span.stderr b/tests/ui/generic-associated-types/own-bound-span.stderr index 4d0688111e0d0..2e7ffa24b4ce5 100644 --- a/tests/ui/generic-associated-types/own-bound-span.stderr +++ b/tests/ui/generic-associated-types/own-bound-span.stderr @@ -11,6 +11,19 @@ LL | trait D { LL | type P; | ^^^^ required by this bound in `D::P` -error: aborting due to 1 previous error +error[E0271]: type mismatch resolving `::P == _` + --> $DIR/own-bound-span.rs:14:12 + | +LL | let _: ::P; + | ^^^^^^^^^^^^^^^^^^^ type mismatch resolving `::P == _` + | +note: types differ + --> $DIR/own-bound-span.rs:10:23 + | +LL | type P = (); + | ^^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/generic-associated-types/projection-bound-cycle-generic.stderr b/tests/ui/generic-associated-types/projection-bound-cycle-generic.stderr index 1b3b264e75088..4e2ac8ab240db 100644 --- a/tests/ui/generic-associated-types/projection-bound-cycle-generic.stderr +++ b/tests/ui/generic-associated-types/projection-bound-cycle-generic.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement ` as Foo>::Item == _ LL | type Item = [T] where [T]: Sized; | ^^^^^^^^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement ` as Foo>::Item == _` + --> $DIR/projection-bound-cycle-generic.rs:23:17 + | +LL | type Item = [T] where [T]: Sized; + | ^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/generic-associated-types/projection-bound-cycle.stderr b/tests/ui/generic-associated-types/projection-bound-cycle.stderr index 6f5eee9928ce6..62ce8aae73d3c 100644 --- a/tests/ui/generic-associated-types/projection-bound-cycle.stderr +++ b/tests/ui/generic-associated-types/projection-bound-cycle.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement `::Item == _` LL | type Item = str where str: Sized; | ^^^^^^^^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `::Item == _` + --> $DIR/projection-bound-cycle.rs:26:17 + | +LL | type Item = str where str: Sized; + | ^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr b/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr index 786aa00350c28..71ed25cb0c7bc 100644 --- a/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr +++ b/tests/ui/generic-associated-types/static-lifetime-tip-with-default-type.stderr @@ -5,7 +5,7 @@ LL | struct Foo(&'static T, &'static K); | ^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -19,7 +19,7 @@ LL | struct Foo(&'static T, &'static K); | ^^^^^^^^^^ | | | the parameter type `K` must be valid for the static lifetime... - | ...so that the reference type `&'static K` does not outlive the data it points at + | ...so that the type `K` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -33,7 +33,7 @@ LL | struct Bar(&'static r#T, &'static r#K); | ^^^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -47,7 +47,7 @@ LL | struct Bar(&'static r#T, &'static r#K); | ^^^^^^^^^^^^ | | | the parameter type `K` must be valid for the static lifetime... - | ...so that the reference type `&'static K` does not outlive the data it points at + | ...so that the type `K` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -61,7 +61,7 @@ LL | struct Boo(&'static T); | ^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -75,7 +75,7 @@ LL | = i32>(&'static T); | ^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -97,7 +97,7 @@ LL | struct S<'a, K: 'a = i32>(&'static K); | ^^^^^^^^^^ | | | the parameter type `K` must be valid for the static lifetime... - | ...so that the reference type `&'static K` does not outlive the data it points at + | ...so that the type `K` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr index 46e449c7bfea2..341d1f0637b8d 100644 --- a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr +++ b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr @@ -1,16 +1,16 @@ -error[E0391]: cycle detected when finding trait impls of `Foo` - --> $DIR/unknown-lifetime-ice-119827.rs:1:1 - | -LL | trait Foo { - | ^^^^^^^^^ - | -note: ...which requires computing type of ``... +error[E0391]: cycle detected when computing type of `` --> $DIR/unknown-lifetime-ice-119827.rs:8:1 | LL | impl Foo for Box {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires finding trait impls of `Foo`, completing the cycle - = note: cycle used when checking that `Foo` is well-formed + | +note: ...which requires finding trait impls of `Foo`... + --> $DIR/unknown-lifetime-ice-119827.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ + = note: ...which again requires computing type of ``, completing the cycle + = note: cycle used when checking that `` is well-formed = note: for more information, see and error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr index 4f41ec025fc7f..f7440351b4abe 100644 --- a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr @@ -1,9 +1,6 @@ error[E0478]: lifetime bound not satisfied --> $DIR/unsatisfied-item-lifetime-bound.rs:8:18 | -LL | type Y<'a: 'static>; - | ------------------- definition of `Y` from trait -... LL | type Y<'a> = &'a (); | ^^^^^^ | @@ -13,10 +10,6 @@ note: lifetime parameter instantiated with the lifetime `'a` as defined here LL | type Y<'a> = &'a (); | ^^ = note: but lifetime parameter must outlive the static lifetime -help: copy the `where` clause predicates from the trait - | -LL | type Y<'a> = &'a () where 'a: 'static; - | +++++++++++++++++ error[E0478]: lifetime bound not satisfied --> $DIR/unsatisfied-item-lifetime-bound.rs:13:8 diff --git a/tests/ui/generic-associated-types/unsatisfied-outlives-bound.stderr b/tests/ui/generic-associated-types/unsatisfied-outlives-bound.stderr index 1c9ac01ec0f3f..e813359b31e67 100644 --- a/tests/ui/generic-associated-types/unsatisfied-outlives-bound.stderr +++ b/tests/ui/generic-associated-types/unsatisfied-outlives-bound.stderr @@ -4,7 +4,7 @@ error[E0477]: the type `&'b ()` does not fulfill the required lifetime LL | type Item<'a> = &'b (); | ^^^^^^ | -note: type must outlive the lifetime `'a` as defined here as required by this binding +note: type must outlive the lifetime `'a` as defined here --> $DIR/unsatisfied-outlives-bound.rs:6:15 | LL | type Item<'a> = &'b (); @@ -16,11 +16,7 @@ error[E0477]: the type `&'a ()` does not fulfill the required lifetime LL | type Item<'a> = &'a (); | ^^^^^^ | -note: type must satisfy the static lifetime as required by this binding - --> $DIR/unsatisfied-outlives-bound.rs:11:20 - | -LL | type Item<'a>: 'static; - | ^^^^^^^ + = note: type must satisfy the static lifetime error: aborting due to 2 previous errors diff --git a/tests/ui/generic-const-items/reference-outlives-referent.stderr b/tests/ui/generic-const-items/reference-outlives-referent.stderr index 34553c51654bb..464c6e4479b2a 100644 --- a/tests/ui/generic-const-items/reference-outlives-referent.stderr +++ b/tests/ui/generic-const-items/reference-outlives-referent.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references +error[E0477]: the type `&'b ()` does not fulfill the required lifetime --> $DIR/reference-outlives-referent.rs:7:18 | LL | const Q<'a, 'b>: &'a &'b () = &&(); | ^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/reference-outlives-referent.rs:7:9 | LL | const Q<'a, 'b>: &'a &'b () = &&(); | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/reference-outlives-referent.rs:7:13 - | -LL | const Q<'a, 'b>: &'a &'b () = &&(); - | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/generics/missing-param-but-has-colon-144215.stderr b/tests/ui/generics/missing-param-but-has-colon-144215.stderr index bf6cee035e2e6..7caab6927c8e5 100644 --- a/tests/ui/generics/missing-param-but-has-colon-144215.stderr +++ b/tests/ui/generics/missing-param-but-has-colon-144215.stderr @@ -5,7 +5,7 @@ LL | struct S(&'static T); | ^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.stderr b/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.stderr index 7e0cdba6ff21e..04eb40919a274 100644 --- a/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.stderr +++ b/tests/ui/higher-ranked/anonymous-higher-ranked-lifetime.stderr @@ -1,234 +1,234 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 +error[E0277]: expected an `Fn(&(), &())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:8:8: 8:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:8:8 | LL | f1(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&(), &())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:8:8: 8:22}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _` - found closure signature `fn((), ()) -> _` +help: the trait `for<'a, 'b> Fn(&'a (), &'b ())` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:8:8: 8:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:8:8 + | +LL | f1(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 'b> fn(&'a (), &'b ())` + found a closure with signature `fn((), ())` note: required by a bound in `f1` --> $DIR/anonymous-higher-ranked-lifetime.rs:22:25 | LL | fn f1(_: F) where F: Fn(&(), &()) {} | ^^^^^^^^^^^^ required by this bound in `f1` -help: consider adjusting the signature so it borrows its arguments - | -LL | f1(|_: &(), _: &()| {}); - | + + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 +error[E0277]: expected an `Fn(&'a (), &())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:9:8: 9:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:9:8 | LL | f2(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&'a (), &())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:9:8: 9:22}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _` - found closure signature `fn((), ()) -> _` +help: the trait `for<'a, 'b> Fn(&'a (), &'b ())` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:9:8: 9:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:9:8 + | +LL | f2(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 'b> fn(&'a (), &'b ())` + found a closure with signature `fn((), ())` note: required by a bound in `f2` --> $DIR/anonymous-higher-ranked-lifetime.rs:23:25 | LL | fn f2(_: F) where F: for<'a> Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2` -help: consider adjusting the signature so it borrows its arguments - | -LL | f2(|_: &(), _: &()| {}); - | + + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 +error[E0277]: expected an `Fn(&(), &())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:10:8: 10:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:10:8 | LL | f3(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&(), &())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:10:8: 10:22}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> Fn(&(), &'a ())` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:10:8: 10:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:10:8 | - = note: expected closure signature `for<'a> fn(&(), &'a ()) -> _` - found closure signature `fn((), ()) -> _` +LL | f3(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&(), &'a ())` + found a closure with signature `fn((), ())` note: required by a bound in `f3` --> $DIR/anonymous-higher-ranked-lifetime.rs:24:29 | LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^ required by this bound in `f3` -help: consider adjusting the signature so it borrows its arguments - | -LL | f3(|_: &(), _: &()| {}); - | + + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5 +error[E0277]: expected an `Fn(&(), &'r ())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:11:8: 11:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:11:8 | LL | f4(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&(), &'r ())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:11:8: 11:22}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'a, 'r> fn(&'a (), &'r ()) -> _` - found closure signature `fn((), ()) -> _` +help: the trait `for<'a, 'r> Fn(&'a (), &'r ())` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:11:8: 11:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:11:8 + | +LL | f4(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 'r> fn(&'a (), &'r ())` + found a closure with signature `fn((), ())` note: required by a bound in `f4` --> $DIR/anonymous-higher-ranked-lifetime.rs:25:25 | LL | fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4` -help: consider adjusting the signature so it borrows its arguments - | -LL | f4(|_: &(), _: &()| {}); - | + + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 +error[E0277]: expected an `Fn(&'r (), &'r ())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:12:8: 12:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:12:8 | LL | f5(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&'r (), &'r ())` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:12:8: 12:22}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'r> Fn(&'r (), &'r ())` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:12:8: 12:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:12:8 | - = note: expected closure signature `for<'r> fn(&'r (), &'r ()) -> _` - found closure signature `fn((), ()) -> _` +LL | f5(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'r> fn(&'r (), &'r ())` + found a closure with signature `fn((), ())` note: required by a bound in `f5` --> $DIR/anonymous-higher-ranked-lifetime.rs:26:25 | LL | fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5` -help: consider adjusting the signature so it borrows its arguments - | -LL | f5(|_: &(), _: &()| {}); - | + + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:13:5 +error[E0277]: expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:13:8: 13:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:13:8 | LL | g1(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:13:8: 13:22}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _` - found closure signature `fn((), ()) -> _` +help: the trait `for<'a> Fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:13:8: 13:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:13:8 + | +LL | g1(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` + found a closure with signature `fn((), ())` note: required by a bound in `g1` --> $DIR/anonymous-higher-ranked-lifetime.rs:29:25 | LL | fn g1(_: F) where F: Fn(&(), Box) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1` -help: consider adjusting the signature so it borrows its argument - | -LL | g1(|_: &(), _: ()| {}); - | + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 +error[E0277]: expected an `Fn(&(), for<'a> fn(&'a ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:14:8: 14:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:14:8 | LL | g2(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&(), for<'a> fn(&'a ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:14:8: 14:22}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> Fn(&'a (), for<'a> fn(&'a ()))` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:14:8: 14:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:14:8 | - = note: expected closure signature `for<'a> fn(&'a (), for<'a> fn(&'a ())) -> _` - found closure signature `fn((), ()) -> _` +LL | g2(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a (), for<'a> fn(&'a ()))` + found a closure with signature `fn((), ())` note: required by a bound in `g2` --> $DIR/anonymous-higher-ranked-lifetime.rs:30:25 | LL | fn g2(_: F) where F: Fn(&(), fn(&())) {} | ^^^^^^^^^^^^^^^^ required by this bound in `g2` -help: consider adjusting the signature so it borrows its argument - | -LL | g2(|_: &(), _: ()| {}); - | + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:15:5 +error[E0277]: expected an `Fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:15:8: 15:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:15:8 | LL | g3(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:15:8: 15:22}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _` - found closure signature `fn((), ()) -> _` +help: the trait `for<'s> Fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:15:8: 15:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:15:8 + | +LL | g3(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'s> fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>)` + found a closure with signature `fn((), ())` note: required by a bound in `g3` --> $DIR/anonymous-higher-ranked-lifetime.rs:31:25 | LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3` -help: consider adjusting the signature so it borrows its argument - | -LL | g3(|_: &(), _: ()| {}); - | + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 +error[E0277]: expected an `Fn(&(), for<'r> fn(&'r ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:16:8: 16:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:16:8 | LL | g4(|_: (), _: ()| {}); - | ^^^--------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^ expected an `Fn(&(), for<'r> fn(&'r ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:16:8: 16:22}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> Fn(&'a (), for<'r> fn(&'r ()))` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:16:8: 16:22}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:16:8 | - = note: expected closure signature `for<'a> fn(&'a (), for<'r> fn(&'r ())) -> _` - found closure signature `fn((), ()) -> _` +LL | g4(|_: (), _: ()| {}); + | ^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a (), for<'r> fn(&'r ()))` + found a closure with signature `fn((), ())` note: required by a bound in `g4` --> $DIR/anonymous-higher-ranked-lifetime.rs:32:25 | LL | fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4` -help: consider adjusting the signature so it borrows its argument - | -LL | g4(|_: &(), _: ()| {}); - | + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:17:5 +error[E0277]: expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &(), for<'a, 'b> fn(&'a (), &'b ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:17:8: 17:36}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:17:8 | LL | h1(|_: (), _: (), _: (), _: ()| {}); - | ^^^----------------------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &(), for<'a, 'b> fn(&'a (), &'b ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:17:8: 17:36}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `for<'a, 'b> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'b (), for<'a, 'b> fn(&'a (), &'b ())) -> _` - found closure signature `fn((), (), (), ()) -> _` +help: the trait `for<'a, 'b> Fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'b (), for<'a, 'b> fn(&'a (), &'b ()))` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:17:8: 17:36}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:17:8 + | +LL | h1(|_: (), _: (), _: (), _: ()| {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 'b> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'b (), for<'a, 'b> fn(&'a (), &'b ()))` + found a closure with signature `fn((), (), (), ())` note: required by a bound in `h1` --> $DIR/anonymous-higher-ranked-lifetime.rs:35:25 | LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1` -help: consider adjusting the signature so it borrows its arguments - | -LL | h1(|_: &(), _: (), _: &(), _: ()| {}); - | + + -error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 +error[E0277]: expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:18:8: 18:36}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:18:8 | LL | h2(|_: (), _: (), _: (), _: ()| {}); - | ^^^----------------------------^^^^ - | | | - | | found signature defined here - | expected due to this + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn(&(), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` closure, found `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:18:8: 18:36}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a, 't0> Fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` is not implemented for closure `{closure@$DIR/anonymous-higher-ranked-lifetime.rs:18:8: 18:36}` + --> $DIR/anonymous-higher-ranked-lifetime.rs:18:8 | - = note: expected closure signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _` - found closure signature `fn((), (), (), ()) -> _` +LL | h2(|_: (), _: (), _: (), _: ()| {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ()))` + found a closure with signature `fn((), (), (), ())` note: required by a bound in `h2` --> $DIR/anonymous-higher-ranked-lifetime.rs:36:25 | LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2` -help: consider adjusting the signature so it borrows its arguments - | -LL | h2(|_: &(), _: (), _: &(), _: ()| {}); - | + + error: aborting due to 11 previous errors -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/do-not-blame-outlives-static-ice.stderr b/tests/ui/higher-ranked/do-not-blame-outlives-static-ice.stderr index c75a063e45fa0..45904b38ae89a 100644 --- a/tests/ui/higher-ranked/do-not-blame-outlives-static-ice.stderr +++ b/tests/ui/higher-ranked/do-not-blame-outlives-static-ice.stderr @@ -1,17 +1,55 @@ -error: implementation of `Trait` is not general enough +error[E0277]: the trait bound `for<'a> fn(&'a ()): Trait` is not satisfied + --> $DIR/do-not-blame-outlives-static-ice.rs:8:20 + | +LL | fn f(_: for<'a> fn(::Assoc)) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait` is not implemented for `for<'a> fn(&'a ())` + | +help: the trait `Trait` is not implemented for `for<'a> fn(&'a ())` + but trait `Trait` is implemented for it + --> $DIR/do-not-blame-outlives-static-ice.rs:6:1 + | +LL | impl Trait for fn(&()) { type Assoc = (); } + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `for<'a> fn(&'a ()): Trait` is not satisfied --> $DIR/do-not-blame-outlives-static-ice.rs:8:9 | LL | fn f(_: for<'a> fn(::Assoc)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Trait` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait` is not implemented for `for<'a> fn(&'a ())` + | +help: the trait `Trait` is not implemented for `for<'a> fn(&'a ())` + but trait `Trait` is implemented for it + --> $DIR/do-not-blame-outlives-static-ice.rs:6:1 | - = note: `for<'a> fn(&'a ())` must implement `Trait`, for any lifetime `'0`... - = note: ...but `Trait` is actually implemented for the type `for<'a> fn(&'a ())` +LL | impl Trait for fn(&()) { type Assoc = (); } + | ^^^^^^^^^^^^^^^^^^^^^^ -error: higher-ranked subtype error +error[E0277]: the trait bound `for<'a> fn(&'a ()): Trait` is not satisfied + --> $DIR/do-not-blame-outlives-static-ice.rs:8:6 + | +LL | fn f(_: for<'a> fn(::Assoc)) {} + | ^ the trait `for<'a> Trait` is not implemented for `for<'a> fn(&'a ())` + | +help: the trait `Trait` is not implemented for `for<'a> fn(&'a ())` + but trait `Trait` is implemented for it + --> $DIR/do-not-blame-outlives-static-ice.rs:6:1 + | +LL | impl Trait for fn(&()) { type Assoc = (); } + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `for<'a> fn(&'a ()): Trait` is not satisfied --> $DIR/do-not-blame-outlives-static-ice.rs:8:1 | LL | fn f(_: for<'a> fn(::Assoc)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait` is not implemented for `for<'a> fn(&'a ())` + | +help: the trait `Trait` is not implemented for `for<'a> fn(&'a ())` + but trait `Trait` is implemented for it + --> $DIR/do-not-blame-outlives-static-ice.rs:6:1 + | +LL | impl Trait for fn(&()) { type Assoc = (); } + | ^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr index 2e3fd6123346f..aa6fad41aef17 100644 --- a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr +++ b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr @@ -1,11 +1,19 @@ -error: implementation of `FnMut` is not general enough - --> $DIR/higher-ranked-lifetime-error.rs:12:5 +error[E0271]: type mismatch resolving ` &String {id} as FnOnce<(&String,)>>::Output == &String` + --> $DIR/higher-ranked-lifetime-error.rs:12:30 | LL | assert_all::<_, &String>(id); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnMut` is not general enough + | ------------------------ ^^ types differ + | | + | required by a bound introduced by this call | - = note: `for<'a> fn(&'a String) -> &'a String {id}` must implement `FnMut<(&String,)>` - = note: ...but it actually implements `FnMut<(&'0 String,)>`, for some specific lifetime `'0` +note: required by a bound in `assert_all` + --> $DIR/higher-ranked-lifetime-error.rs:3:26 + | +LL | fn assert_all(_f: F) +LL | where +LL | F: FnMut(&String) -> T, + | ^ required by this bound in `assert_all` error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr b/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr index 9e5de5e6fb61b..295ef3d7f789b 100644 --- a/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr +++ b/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr @@ -1,41 +1,63 @@ -error: implementation of `HR` is not general enough - --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:25:5 +error[E0277]: the trait bound `fn(&()): HR` is not satisfied + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:25:8 | LL | hr(not_hr_func); - | ^^^^^^^^^^^^^^^ + | -- ^^^^^^^^^^^ the trait `HR` is not implemented for `fn(&())` + | | + | required by a bound introduced by this call | -note: `HR` would have to be implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`... +help: the trait `HR` is not implemented for `fn(&())` + but it is implemented for `for<'a> fn(&'a ())` + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:14:1 + | +LL | impl HR for fn(&()) {} + | ^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `hr` --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:15:10 | LL | fn hr(_: T) {} | ^^ required by this bound in `hr` - = note: ...but `HR` is actually implemented for the type `for<'a> fn(&'a ())` -error: implementation of `NotHR` is not general enough - --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:27:5 +error[E0277]: the trait bound `for<'a> fn(&'a ()): NotHR` is not satisfied + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:27:12 | LL | not_hr(hr_func); - | ^^^^^^^^^^^^^^^ + | ------ ^^^^^^^ the trait `NotHR` is not implemented for `for<'a> fn(&'a ())` + | | + | required by a bound introduced by this call + | +help: the trait `NotHR` is not implemented for `for<'a> fn(&'a ())` + but it is implemented for `fn(&())` + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:18:1 | -note: `NotHR` would have to be implemented for the type `for<'a> fn(&'a ())` +LL | impl<'a> NotHR for fn(&'a ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `not_hr` --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:19:14 | LL | fn not_hr(_: T) {} | ^^^^^ required by this bound in `not_hr` - = note: ...but `NotHR` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` -error: implementation of `NotHR` is not general enough - --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:29:5 +error[E0277]: the trait bound `for<'b> fn(&'b ()): NotHR` is not satisfied + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:29:12 | LL | not_hr(hr_func2); - | ^^^^^^^^^^^^^^^^ + | ------ ^^^^^^^^ the trait `NotHR` is not implemented for `for<'b> fn(&'b ())` + | | + | required by a bound introduced by this call + | +help: the trait `NotHR` is not implemented for `for<'b> fn(&'b ())` + but it is implemented for `fn(&())` + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:18:1 | -note: `NotHR` would have to be implemented for the type `for<'b> fn(&'b ())` +LL | impl<'a> NotHR for fn(&'a ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `not_hr` --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:19:14 | LL | fn not_hr(_: T) {} | ^^^^^ required by this bound in `not_hr` - = note: ...but `NotHR` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr index 53586decee2c5..5693bc4d100a5 100644 --- a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr +++ b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr @@ -1,20 +1,32 @@ -error: implementation of `DistributedIteratorMulti` is not general enough - --> $DIR/hrtb-associated-type-leak-check-55731.rs:49:5 +error[E0277]: the trait bound `for<'a> Map, X>: DistributedIteratorMulti<&'a ()>` is not satisfied + --> $DIR/hrtb-associated-type-leak-check-55731.rs:49:11 | -LL | / multi(Map { +LL | multi(Map { + | _____-----_^ + | | | + | | required by a bound introduced by this call LL | | i: Cloned(PhantomData), LL | | f: X, LL | | }); - | |______^ + | |_____^ unsatisfied trait bound | -note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`... +help: the trait `for<'a> DistributedIteratorMulti<&'a ()>` is not implemented for `Map, X>` + --> $DIR/hrtb-associated-type-leak-check-55731.rs:25:1 + | +LL | struct Map { + | ^^^^^^^^^^^^^^^^ +note: required by a bound in `multi` --> $DIR/hrtb-associated-type-leak-check-55731.rs:43:8 | LL | fn multi(_reducer: I) LL | where LL | I: for<'a> DistributedIteratorMulti<&'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `multi` - = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn main() where for<'a> Map, X>: DistributedIteratorMulti<&'a ()> { + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr b/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr index f9862b8ab13a4..15b5c3594e886 100644 --- a/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr +++ b/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr @@ -1,3 +1,21 @@ +error[E0277]: the trait bound `for<'a> fn(&'a ()): X` is not satisfied + --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:26:16 + | +LL | indirect::(); + | ^^^^^^^ the trait `X` is not implemented for `for<'a> fn(&'a ())` + | +help: the trait `X` is not implemented for `for<'a> fn(&'a ())` + but it is implemented for `fn(&())` + --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:13:1 + | +LL | impl<'a> X for fn(&'a ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `indirect` + --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:21:16 + | +LL | fn indirect() { + | ^ required by this bound in `indirect` + error[E0599]: no associated function or constant named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:31:24 | @@ -11,19 +29,7 @@ note: `X` defines an item `make_g`, perhaps you need to implement it LL | trait X { | ^^^^^^^ -error: implementation of `X` is not general enough - --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:26:5 - | -LL | indirect::(); - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: `X` would have to be implemented for the type `for<'a> fn(&'a ())` - --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:21:16 - | -LL | fn indirect() { - | ^ required by this bound in `indirect` - = note: ...but `X` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` - error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0277, E0599. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/hrtb-with-assoc-type-projection.stderr b/tests/ui/higher-ranked/hrtb-with-assoc-type-projection.stderr index 79985580e23b5..20fa7eb747fb8 100644 --- a/tests/ui/higher-ranked/hrtb-with-assoc-type-projection.stderr +++ b/tests/ui/higher-ranked/hrtb-with-assoc-type-projection.stderr @@ -1,11 +1,12 @@ -error[E0277]: the trait bound `&u32: Foo` is not satisfied +error[E0277]: the trait bound `for<'t> , {closure@$DIR/hrtb-with-assoc-type-projection.rs:17:27: 17:36}> as Iterator>::Item: Foo` is not satisfied --> $DIR/hrtb-with-assoc-type-projection.rs:17:19 | LL | trigger_error(vec![], |x: &u32| x) - | ------------- ^^^^^^ the trait `Foo` is not implemented for `&u32` + | ------------- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | + = help: the trait `for<'t> Foo` is not implemented for `, {closure@$DIR/hrtb-with-assoc-type-projection.rs:17:27: 17:36}> as Iterator>::Item` help: this trait has no implementations, consider adding one --> $DIR/hrtb-with-assoc-type-projection.rs:6:1 | diff --git a/tests/ui/higher-ranked/leak-check/trait-object-assoc-type-bound-unsatisfied.stderr b/tests/ui/higher-ranked/leak-check/trait-object-assoc-type-bound-unsatisfied.stderr index 79ee006579e0b..c1db15c20ba70 100644 --- a/tests/ui/higher-ranked/leak-check/trait-object-assoc-type-bound-unsatisfied.stderr +++ b/tests/ui/higher-ranked/leak-check/trait-object-assoc-type-bound-unsatisfied.stderr @@ -1,10 +1,10 @@ -error[E0277]: `

>::Item` is not an iterator +error[E0277]: `

>::Item` is not an iterator --> $DIR/trait-object-assoc-type-bound-unsatisfied.rs:22:40 | LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator | - = help: the trait `Iterator` is not implemented for `

>::Item` + = help: the trait `for<'b> Iterator` is not implemented for `

>::Item` note: required for `Wrapper

` to implement `for<'b> Wrap<'b>` --> $DIR/trait-object-assoc-type-bound-unsatisfied.rs:9:13 | @@ -13,11 +13,17 @@ LL | impl<'b, P> Wrap<'b> for Wrapper

LL | where P: Process<'b>, LL |

>::Item: Iterator { | -------- unsatisfied trait bound introduced here +note: required because it appears within the type `Wrapper

` + --> $DIR/trait-object-assoc-type-bound-unsatisfied.rs:7:8 + | +LL | struct Wrapper

(P); + | ^^^^^^^ + = note: required for `Box>` to implement `CoerceUnsized Wrap<'b>>>` = note: required for the cast from `Box>` to `Box Wrap<'b>>` help: consider further restricting the associated type | -LL | fn push_process

(process: P) where P: Process<'static>,

>::Item: Iterator { - | ++++++++++++++++++++++++++++++++++++ +LL | fn push_process

(process: P) where P: Process<'static>, for<'b>

>::Item: Iterator { + | ++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/structually-relate-aliases.stderr b/tests/ui/higher-ranked/structually-relate-aliases.stderr index 8996bf11b3721..5419095812a8a 100644 --- a/tests/ui/higher-ranked/structually-relate-aliases.stderr +++ b/tests/ui/higher-ranked/structually-relate-aliases.stderr @@ -10,6 +10,17 @@ help: consider restricting type parameter `T` with trait `ToUnit` LL | impl ToUnit<'a>> Overlap fn(&'a (), Assoc<'a, T>)> for T {} | ++++++++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `T: Overlap fn(&'a (), >::Unit)>` is not satisfied + --> $DIR/structually-relate-aliases.rs:13:55 + | +LL | impl Overlap fn(&'a (), Assoc<'a, T>)> for T {} + | ^ the trait `Overlap fn(&'a (), >::Unit)>` is not implemented for `T` + | +help: consider restricting type parameter `T` with trait `Overlap` + | +LL | impl fn(&'a (), >::Unit)>> Overlap fn(&'a (), Assoc<'a, T>)> for T {} + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr b/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr index 6c17b1f4874b2..10b99061b86d3 100644 --- a/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr +++ b/tests/ui/higher-ranked/trait-bounds/due-to-where-clause.stderr @@ -1,11 +1,8 @@ -error: implementation of `Foo` is not general enough +error: higher-ranked lifetime error --> $DIR/due-to-where-clause.rs:2:5 | LL | test::(&mut 42); - | ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `FooS<'_>` must implement `Foo<'0>`, for any lifetime `'0`... - = note: ...but `FooS<'_>` actually implements `Foo<'1>`, for some specific lifetime `'1` + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/higher-trait-bounds-ice-60218.stderr b/tests/ui/higher-ranked/trait-bounds/higher-trait-bounds-ice-60218.stderr index 028d3cb104e40..34826ec70dd4b 100644 --- a/tests/ui/higher-ranked/trait-bounds/higher-trait-bounds-ice-60218.stderr +++ b/tests/ui/higher-ranked/trait-bounds/higher-trait-bounds-ice-60218.stderr @@ -1,11 +1,12 @@ -error[E0277]: the trait bound `&u32: Foo` is not satisfied +error[E0277]: the trait bound `for<'t> , {closure@$DIR/higher-trait-bounds-ice-60218.rs:17:27: 17:36}> as Iterator>::Item: Foo` is not satisfied --> $DIR/higher-trait-bounds-ice-60218.rs:17:19 | LL | trigger_error(vec![], |x: &u32| x) - | ------------- ^^^^^^ the trait `Foo` is not implemented for `&u32` + | ------------- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | + = help: the trait `for<'t> Foo` is not implemented for `, {closure@$DIR/higher-trait-bounds-ice-60218.rs:17:27: 17:36}> as Iterator>::Item` help: this trait has no implementations, consider adding one --> $DIR/higher-trait-bounds-ice-60218.rs:6:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-cache-issue-54302.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-cache-issue-54302.stderr index 186af160d9083..01bd351bf00a3 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-cache-issue-54302.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-cache-issue-54302.stderr @@ -1,11 +1,8 @@ -error: implementation of `Deserialize` is not general enough +error: higher-ranked lifetime error --> $DIR/hrtb-cache-issue-54302.rs:19:5 | LL | assert_deserialize_owned::<&'static str>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough - | - = note: `&str` must implement `Deserialize<'0>`, for any lifetime `'0`... - = note: ...but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr index 0946314f31e80..9d1d1f258a979 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr @@ -1,39 +1,22 @@ -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-conflate-regions.rs:27:10 +error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied + --> $DIR/hrtb-conflate-regions.rs:27:22 | LL | fn b() { want_foo2::(); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ unsatisfied trait bound | -note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - --> $DIR/hrtb-conflate-regions.rs:9:15 - | -LL | fn want_foo2() -LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo2` -note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +help: the trait `Foo<(&'a _, &'b _)>` is not implemented for `SomeStruct` + but trait `Foo<(&_, &_)>` is implemented for it --> $DIR/hrtb-conflate-regions.rs:22:1 | LL | impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-conflate-regions.rs:27:10 - | -LL | fn b() { want_foo2::(); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: required by a bound in `want_foo2` --> $DIR/hrtb-conflate-regions.rs:9:15 | LL | fn want_foo2() LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo2` -note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - --> $DIR/hrtb-conflate-regions.rs:22:1 - | -LL | impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr index 21dc5c66adf2b..e9d8f1657c1ba 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr @@ -1,27 +1,16 @@ -error[E0599]: the method `filterx` exists for struct `Map`, but its trait bounds were not satisfied - --> $DIR/hrtb-doesnt-borrow-self-1.rs:114:22 +error: lifetime may not live long enough + --> $DIR/hrtb-doesnt-borrow-self-1.rs:113:35 | -LL | pub struct Map { - | -------------------- method `filterx` not found for this struct because it doesn't satisfy `_: StreamExt` -... -LL | let filter = map.filterx(|x: &_| true); - | ^^^^^^^ method cannot be called due to unsatisfied trait bounds +LL | let map = source.mapx(|x: &_| x); + | - - ^ returning this value requires that `'1` must outlive `'2` + | | | + | | return type of closure is &'2 u64 + | let's call the lifetime of this reference `'1` | -note: the following trait bounds were not satisfied: - `&'a mut &Map: Stream` - `&'a mut &mut Map: Stream` - `&'a mut Map: Stream` - --> $DIR/hrtb-doesnt-borrow-self-1.rs:96:50 +help: dereference the return value | -LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} - | --------- - ^^^^^^ unsatisfied trait bound introduced here - = help: items from traits can only be used if the trait is implemented and in scope -note: `StreamExt` defines an item `filterx`, perhaps you need to implement it - --> $DIR/hrtb-doesnt-borrow-self-1.rs:64:1 - | -LL | pub trait StreamExt - | ^^^^^^^^^^^^^^^^^^^ +LL | let map = source.mapx(|x: &_| *x); + | + error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr index 91e65b2b07318..31c2973960d70 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr @@ -1,3 +1,35 @@ +error[E0271]: type mismatch resolving `<&mut Map &u64 {identity::}> as Stream>::Item == &u64` + --> $DIR/hrtb-doesnt-borrow-self-2.rs:111:38 + | +LL | let filter = map.filterx(|x: &_| true); + | ------- ------- ^^^^ type mismatch resolving `<&mut Map &u64 {identity::}> as Stream>::Item == &u64` + | | | + | | this closure + | required by a bound introduced by this call + | +note: types differ + --> $DIR/hrtb-doesnt-borrow-self-2.rs:36:17 + | +LL | type Item = T; + | ^ +note: required for `&'a mut Filter fn(&'a u64) -> &'a u64 {identity::}>, _>` to implement `for<'a> Stream` + --> $DIR/hrtb-doesnt-borrow-self-2.rs:50:19 + | +LL | impl<'a, A, F, T> Stream for &'a mut Filter + | ^^^^^^ ^^^^^^^^^^^^^^^^^^^^ +LL | where +LL | for<'b> &'b mut A: Stream, // <---- BAD + | -------- unsatisfied trait bound introduced here +note: required by a bound in `StreamExt::filterx` + --> $DIR/hrtb-doesnt-borrow-self-2.rs:81:42 + | +LL | pub trait StreamExt +... +LL | fn filterx(self, func: F) -> Filter +... +LL | for<'a> &'a mut Filter: Stream, + | ^^^^^^ required by this bound in `StreamExt::filterx` + error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, {closure@...}>`, but its trait bounds were not satisfied --> $DIR/hrtb-doesnt-borrow-self-2.rs:112:24 | @@ -7,10 +39,17 @@ LL | pub struct Filter { LL | let count = filter.countx(); | ^^^^^^ method cannot be called due to unsatisfied trait bounds | +note: trait bound `<&'b mut Map fn(&'a u64) -> &'a u64 {identity::}> as Stream>::Item = &u64` was not satisfied + --> $DIR/hrtb-doesnt-borrow-self-2.rs:52:31 + | +LL | impl<'a, A, F, T> Stream for &'a mut Filter + | ------ -------------------- +LL | where +LL | for<'b> &'b mut A: Stream, // <---- BAD + | ^^^^^^^^ unsatisfied trait bound introduced here note: the following trait bounds were not satisfied: `&'a mut &Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` `&'a mut &mut Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` - `&'a mut Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` --> $DIR/hrtb-doesnt-borrow-self-2.rs:98:50 | LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} @@ -24,6 +63,7 @@ LL | pub trait StreamExt = note: the full name for the type has been written to '$TEST_BUILD_DIR/hrtb-doesnt-borrow-self-2.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0271, E0599. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr index 8ec6646e73074..9aad1cf11ace3 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr @@ -1,21 +1,23 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 +error[E0277]: the trait bound `(): Trait fn(&'b u32)>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:11 | LL | foo::<()>(); - | ^^^^^^^^^^^ + | ^^ the trait `Trait fn(&'b u32)>` is not implemented for `()` | -note: `()` must implement `Trait fn(&'b u32)>` +help: the trait `Trait fn(&'b _)>` is not implemented for `()` + but trait `Trait` is implemented for it + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:14:1 + | +LL | impl<'a> Trait for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `foo` --> $DIR/hrtb-exists-forall-trait-contravariant.rs:10:8 | LL | fn foo() LL | where LL | T: Trait fn(&'b u32)>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` -note: ...but it actually implements `Trait`, for some specific lifetime `'0` - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:14:1 - | -LL | impl<'a> Trait for () {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr index 4beade083b781..f1785bc6d4c7d 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr @@ -1,21 +1,23 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-covariant.rs:33:5 +error[E0277]: the trait bound `(): Trait fn(fn(&'b u32))>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-covariant.rs:33:11 | LL | foo::<()>(); - | ^^^^^^^^^^^ + | ^^ the trait `Trait fn(fn(&'b u32))>` is not implemented for `()` | -note: `()` must implement `Trait fn(fn(&'b u32))>` +help: the trait `Trait fn(fn(&'b _))>` is not implemented for `()` + but trait `Trait` is implemented for it + --> $DIR/hrtb-exists-forall-trait-covariant.rs:14:1 + | +LL | impl<'a> Trait for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `foo` --> $DIR/hrtb-exists-forall-trait-covariant.rs:10:8 | LL | fn foo() LL | where LL | T: Trait fn(fn(&'b u32))>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` -note: ...but it actually implements `Trait`, for some specific lifetime `'0` - --> $DIR/hrtb-exists-forall-trait-covariant.rs:14:1 - | -LL | impl<'a> Trait for () {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr index 691d5499bc175..f15cf60fb9ea2 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr @@ -1,21 +1,23 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 +error[E0277]: the trait bound `(): Trait fn(Cell<&'b u32>)>` is not satisfied + --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:11 | LL | foo::<()>(); - | ^^^^^^^^^^^ + | ^^ the trait `Trait fn(Cell<&'b u32>)>` is not implemented for `()` | -note: `()` must implement `Trait fn(Cell<&'b u32>)>` +help: the trait `Trait fn(Cell<&'b _>)>` is not implemented for `()` + but trait `Trait)>` is implemented for it + --> $DIR/hrtb-exists-forall-trait-invariant.rs:16:1 + | +LL | impl<'a> Trait)> for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `foo` --> $DIR/hrtb-exists-forall-trait-invariant.rs:12:8 | LL | fn foo() LL | where LL | T: Trait fn(Cell<&'b u32>)>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` -note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` - --> $DIR/hrtb-exists-forall-trait-invariant.rs:16:1 - | -LL | impl<'a> Trait)> for () {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr index 8e224e3447205..10935e81da997 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr @@ -1,43 +1,41 @@ -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:24:5 +error[E0277]: the trait bound `for<'a> StaticInt: Foo<&'a isize>` is not satisfied + --> $DIR/hrtb-just-for-static.rs:24:17 | LL | want_hrtb::() - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ unsatisfied trait bound | -note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... +help: the trait `Foo<&'a _>` is not implemented for `StaticInt` + but trait `Foo<&'static _>` is implemented for it + --> $DIR/hrtb-just-for-static.rs:22:1 + | +LL | impl Foo<&'static isize> for StaticInt { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `want_hrtb` --> $DIR/hrtb-just-for-static.rs:9:15 | LL | fn want_hrtb() LL | where T : for<'a> Foo<&'a isize> | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `want_hrtb` -note: ...but it actually implements `Foo<&'static isize>` - --> $DIR/hrtb-just-for-static.rs:22:1 - | -LL | impl Foo<&'static isize> for StaticInt { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: lifetime may not live long enough - --> $DIR/hrtb-just-for-static.rs:30:5 +error[E0277]: the trait bound `for<'a> &'a u32: Foo<&'a isize>` is not satisfied + --> $DIR/hrtb-just-for-static.rs:30:17 | -LL | fn give_some<'a>() { - | -- lifetime `'a` defined here LL | want_hrtb::<&'a u32>() - | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | ^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `&'a u32` | -note: due to a current limitation of the type system, this implies a `'static` lifetime +help: the trait `Foo<&'a _>` is not implemented for `&'a _` + but trait `Foo<&_>` is implemented for `&_` + --> $DIR/hrtb-just-for-static.rs:28:1 + | +LL | impl<'a> Foo<&'a isize> for &'a u32 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `want_hrtb` --> $DIR/hrtb-just-for-static.rs:9:15 | +LL | fn want_hrtb() LL | where T : for<'a> Foo<&'a isize> - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:30:5 - | -LL | want_hrtb::<&'a u32>() - | ^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo<&'0 isize>` would have to be implemented for the type `&u32`, for any lifetime `'0`... - = note: ...but `Foo<&'1 isize>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `want_hrtb` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr index b1d725f896cf2..d507a7f9359d6 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr @@ -53,24 +53,13 @@ note: due to a current limitation of the type system, this implies a `'static` l LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, | ^^^^^^^^^^^^^^^^^^^^^^ -error: implementation of `Bar` is not general enough +error: higher-ranked lifetime error --> $DIR/hrtb-perfect-forwarding.rs:43:5 | LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... - --> $DIR/hrtb-perfect-forwarding.rs:37:8 - | -LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) -LL | where -LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo_hrtb_bar_not` -note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` - --> $DIR/hrtb-perfect-forwarding.rs:14:1 - | -LL | impl<'a, X, F> Bar for &'a mut F where F: Bar {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: could not prove `for<'a> &mut T: Foo<&'a isize>` warning: function cannot return without recursing --> $DIR/hrtb-perfect-forwarding.rs:48:1 diff --git a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr index 0592e9e149f00..06817c429c8fc 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr @@ -1,15 +1,21 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-46989.rs:38:5 +error[E0277]: the trait bound `for<'a> fn(&'a i32): Foo` is not satisfied + --> $DIR/issue-46989.rs:38:18 | LL | assert_foo::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ the trait `Foo` is not implemented for `for<'a> fn(&'a i32)` | -note: `Foo` would have to be implemented for the type `for<'a> fn(&'a i32)` +help: the trait `Foo` is not implemented for `for<'a> fn(&'a _)` + but it is implemented for `fn(&_)` + --> $DIR/issue-46989.rs:33:1 + | +LL | impl Foo for fn(A) {} + | ^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `assert_foo` --> $DIR/issue-46989.rs:35:18 | LL | fn assert_foo() {} | ^^^ required by this bound in `assert_foo` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr index d53ff3b080da5..1011d163928fe 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr @@ -1,32 +1,18 @@ -error: implementation of `Trait` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-59311.rs:17:5 | LL | v.t(|| {}); | ^^^^^^^^^^ | -note: `Trait` would have to be implemented for the type `&'a V` - --> $DIR/issue-59311.rs:15:20 - | -LL | pub fn crash(v: &V) -LL | where -LL | for<'a> &'a V: Trait + 'static, - | ^^^^^ required by this bound in `crash` - = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0` + = note: could not prove `{closure@$DIR/issue-59311.rs:17:9: 17:11} well-formed` -error: implementation of `Trait` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-59311.rs:17:5 | LL | v.t(|| {}); | ^^^^^^^^^^ | -note: `Trait` would have to be implemented for the type `&'a V` - --> $DIR/issue-59311.rs:15:20 - | -LL | pub fn crash(v: &V) -LL | where -LL | for<'a> &'a V: Trait + 'static, - | ^^^^^ required by this bound in `crash` - = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0` + = note: could not prove `{closure@$DIR/issue-59311.rs:17:9: 17:11} well-formed` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: higher-ranked lifetime error diff --git a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr index 591d5fdd75283..28191963fccab 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr @@ -1,34 +1,3 @@ -error[E0271]: type mismatch resolving ` as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` - --> $DIR/issue-62203-hrtb-ice.rs:39:9 - | -LL | let v = Unit2.m( - | - required by a bound introduced by this call -LL | / L { -LL | | f: |x| { -LL | | drop(x); -LL | | Unit4 -LL | | }, -LL | | }, - | |_________^ type mismatch resolving ` as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` - | -note: expected this to be `<_ as Ty<'_>>::V` - --> $DIR/issue-62203-hrtb-ice.rs:21:14 - | -LL | type O = T::Output; - | ^^^^^^^^^ - = note: expected associated type `<_ as Ty<'_>>::V` - found struct `Unit4` - = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` or calling a method that returns `<_ as Ty<'_>>::V` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html -note: required by a bound in `T1::m` - --> $DIR/issue-62203-hrtb-ice.rs:27:51 - | -LL | trait T1: for<'r> Ty<'r> { -LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 -LL | where -LL | F: for<'r> T0<'r, (>::V,), O = >::V>, - | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` - error[E0271]: expected `{closure@issue-62203-hrtb-ice.rs:40:16}` to return `Unit3`, but it returns `Unit4` --> $DIR/issue-62203-hrtb-ice.rs:42:17 | @@ -58,6 +27,28 @@ LL | where LL | F: for<'r> T0<'r, (>::V,), O = >::V>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` +error[E0271]: type mismatch resolving ` as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` + --> $DIR/issue-62203-hrtb-ice.rs:39:9 + | +LL | let v = Unit2.m( + | - required by a bound introduced by this call +LL | / L { +LL | | f: |x| { +LL | | drop(x); +LL | | Unit4 +LL | | }, +LL | | }, + | |_________^ types differ + | +note: required by a bound in `T1::m` + --> $DIR/issue-62203-hrtb-ice.rs:27:51 + | +LL | trait T1: for<'r> Ty<'r> { +LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 +LL | where +LL | F: for<'r> T0<'r, (>::V,), O = >::V>, + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/assoc-type-projection-in-dyn-and-fn.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/assoc-type-projection-in-dyn-and-fn.stderr index 2aeca47b2ebb9..ad73f08d871d4 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/assoc-type-projection-in-dyn-and-fn.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/assoc-type-projection-in-dyn-and-fn.stderr @@ -10,6 +10,12 @@ help: this trait has no implementations, consider adding one LL | trait Trait2<'a> { | ^^^^^^^^^^^^^^^^ +error: the type `Box<(dyn for<'a> Trait1<<() as Trait2<'a>>::Ty> + 'static)>` is not well-formed + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:12:16 + | +LL | fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:12:16 | @@ -22,6 +28,60 @@ help: this trait has no implementations, consider adding one LL | trait Trait2<'a> { | ^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:15:52 + | +LL | let _e: (usize, usize) = unsafe{mem::transmute(param)}; + | ^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:8:1 + | +LL | trait Trait2<'a> { + | ^^^^^^^^^^^^^^^^ + +error: the type `Box Trait1<<() as Trait2<'a>>::Ty>>` is not well-formed + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:15:37 + | +LL | let _e: (usize, usize) = unsafe{mem::transmute(param)}; + | ^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:12:9 + | +LL | fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { + | ^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:8:1 + | +LL | trait Trait2<'a> { + | ^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:15:37 + | +LL | let _e: (usize, usize) = unsafe{mem::transmute(param)}; + | ^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:8:1 + | +LL | trait Trait2<'a> { + | ^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:12:1 + | +LL | fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/assoc-type-projection-in-dyn-and-fn.rs:8:1 + | +LL | trait Trait2<'a> { + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr index 2671765ef8e6b..1427c2c658c0d 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr @@ -1,19 +1,32 @@ -error[E0277]: expected an `Fn(<_ as ATC<'a>>::Type)` closure, found `F` - --> $DIR/issue-62529-3.rs:25:14 +error[E0283]: type annotations needed + --> $DIR/issue-62529-3.rs:25:9 | LL | call(f, ()); - | ---- ^ expected an `Fn(<_ as ATC<'a>>::Type)` closure, found `F` - | | - | required by a bound introduced by this call + | ^^^^ cannot infer type of the type parameter `T` declared on the function `call` | - = note: expected a closure with signature `for<'a> fn(<_ as ATC<'a>>::Type)` - found a closure with signature `fn(())` + = note: the type must implement `for<'a> ATC<'a>` +help: the trait `ATC<'a>` is implemented for `()` + --> $DIR/issue-62529-3.rs:16:1 + | +LL | impl<'a> ATC<'a> for () { + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: cannot satisfy `for<'a> <_ as ATC<'a>>::Type == _` + = note: cannot satisfy `for<'a> F: FnOnce(<_ as ATC<'a>>::Type)` note: required by a bound in `call` - --> $DIR/issue-62529-3.rs:9:36 + --> $DIR/issue-62529-3.rs:9:16 | LL | fn call<'b, T: for<'a> ATC<'a>, F: for<'a> Fn(>::Type)>( - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call` + | ^^^^^^^^^^^^^^^ required by this bound in `call` +note: required by a bound in `call` + --> $DIR/issue-62529-3.rs:9:44 + | +LL | fn call<'b, T: for<'a> ATC<'a>, F: for<'a> Fn(>::Type)>( + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call` +help: consider specifying the generic arguments + | +LL | call::(f, ()); + | ++++++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr index 5080d35bdde27..c7ac94e91909d 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr @@ -20,6 +20,45 @@ help: consider restricting type parameter `T` with trait `SomeTrait` LL | fn give_me_ice SomeTrait<'a>>() { | +++++++++++++++++++++++ -error: aborting due to 2 previous errors +error[E0277]: expected an `Fn(&'static ())` closure, found `for<'a> fn(&'a ()) -> >::Associated` + --> $DIR/issue-85455.rs:8:14 + | +LL | callee:: >::Associated>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn(&'static ())` closure, found `for<'a> fn(&'a ()) -> >::Associated` + | + = help: the trait `Fn(&'static ())` is not implemented for `for<'a> fn(&'a ()) -> >::Associated` +note: required by a bound in `callee` + --> $DIR/issue-85455.rs:13:14 + | +LL | fn callee>() { + | ^^^^^^^^^^^^^^^^^^ required by this bound in `callee` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn give_me_ice() where for<'a> fn(&'a ()) -> >::Associated: Fn(&'static ()) { + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied + --> $DIR/issue-85455.rs:8:5 + | +LL | callee:: >::Associated>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T` + | +help: consider restricting type parameter `T` with trait `SomeTrait` + | +LL | fn give_me_ice SomeTrait<'a>>() { + | +++++++++++++++++++++++ + +error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied + --> $DIR/issue-85455.rs:8:25 + | +LL | callee:: >::Associated>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T` + | +help: consider restricting type parameter `T` with trait `SomeTrait` + | +LL | fn give_me_ice SomeTrait<'a>>() { + | +++++++++++++++++++++++ + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.stderr index b0c8e10fcec30..d79bdf14d801b 100644 --- a/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.stderr +++ b/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.stderr @@ -1,9 +1,10 @@ -error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}` +error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}` --> $DIR/auto-trait-leak.rs:11:16 | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^ | + = note: ...which requires computing type of opaque `cycle1::{opaque#0}`... note: ...which requires borrow-checking `cycle1`... --> $DIR/auto-trait-leak.rs:11:1 | @@ -13,17 +14,13 @@ LL | fn cycle1() -> impl Clone { = note: ...which requires checking if `cycle1` contains FFI-unwind calls... = note: ...which requires building MIR for `cycle1`... = note: ...which requires match-checking `cycle1`... -note: ...which requires type-checking `cycle1`... - --> $DIR/auto-trait-leak.rs:12:5 - | -LL | send(cycle2().clone()); - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`... -note: ...which requires computing type of opaque `cycle2::{opaque#0}`... + = note: ...which requires type-checking `cycle1`... +note: ...which requires computing type of `cycle2::{opaque#0}`... --> $DIR/auto-trait-leak.rs:17:16 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ + = note: ...which requires computing type of opaque `cycle2::{opaque#0}`... note: ...which requires borrow-checking `cycle2`... --> $DIR/auto-trait-leak.rs:17:1 | @@ -33,14 +30,9 @@ LL | fn cycle2() -> impl Clone { = note: ...which requires checking if `cycle2` contains FFI-unwind calls... = note: ...which requires building MIR for `cycle2`... = note: ...which requires match-checking `cycle2`... -note: ...which requires type-checking `cycle2`... - --> $DIR/auto-trait-leak.rs:18:5 - | -LL | send(cycle1().clone()); - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires evaluating trait selection obligation `cycle1::{opaque#0}: core::marker::Send`... - = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle - = note: cycle used when computing type of `cycle1::{opaque#0}` + = note: ...which requires type-checking `cycle2`... + = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle + = note: cycle used when checking that `cycle1::{opaque#0}` is well-formed = note: for more information, see and error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/bound-normalization-fail.stderr b/tests/ui/impl-trait/bound-normalization-fail.stderr index fc124bd117199..d5abf982db53d 100644 --- a/tests/ui/impl-trait/bound-normalization-fail.stderr +++ b/tests/ui/impl-trait/bound-normalization-fail.stderr @@ -3,9 +3,6 @@ error[E0271]: type mismatch resolving ` as FooLike>::Output == () -> impl FooLike { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as FooLike>::Output == ::Assoc` -LL | -LL | Foo(()) - | ------- return type was inferred to be `Foo<()>` here | note: expected this to be `::Assoc` --> $DIR/bound-normalization-fail.rs:14:19 @@ -24,9 +21,6 @@ error[E0271]: type mismatch resolving ` as FooLike>::Output == >() -> impl FooLike { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as FooLike>::Output == >::Assoc` -LL | -LL | Foo(()) - | ------- return type was inferred to be `Foo<()>` here | note: expected this to be `>::Assoc` --> $DIR/bound-normalization-fail.rs:14:19 diff --git a/tests/ui/impl-trait/call_method_without_import.no_import.stderr b/tests/ui/impl-trait/call_method_without_import.no_import.stderr index 2ca79aa7c10f9..a019ea9df894b 100644 --- a/tests/ui/impl-trait/call_method_without_import.no_import.stderr +++ b/tests/ui/impl-trait/call_method_without_import.no_import.stderr @@ -1,12 +1,12 @@ -error[E0599]: no method named `fmt` found for opaque type `impl Debug` in the current scope +error[E0599]: no method named `fmt` found for type `_` in the current scope --> $DIR/call_method_without_import.rs:17:11 | LL | x.fmt(f); - | ^^^ method not found in `impl Debug` + | ^^^ method not found in `_` | --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | - = note: the method is available for `impl Debug` here + = note: the method is available for `_` here | = help: items from traits can only be used if the trait is in scope help: trait `Debug` which provides `fmt` is implemented but not in scope; perhaps you want to import it diff --git a/tests/ui/impl-trait/confusing-lifetime-error-issue-79033.stderr b/tests/ui/impl-trait/confusing-lifetime-error-issue-79033.stderr index 81cad8de969eb..91551b54c78e4 100644 --- a/tests/ui/impl-trait/confusing-lifetime-error-issue-79033.stderr +++ b/tests/ui/impl-trait/confusing-lifetime-error-issue-79033.stderr @@ -1,51 +1,39 @@ -error[E0373]: closure may outlive the current function, but it borrows `self.start.line`, which is owned by the current function - --> $DIR/confusing-lifetime-error-issue-79033.rs:24:38 +error[E0597]: `self.start.line` does not live long enough + --> $DIR/confusing-lifetime-error-issue-79033.rs:27:16 | +LL | pub fn lines<'a>(self, source: &'a str) -> impl Iterator { + | ---- binding `self` declared here +LL | let lines = source.split('\n'); LL | lines.enumerate().filter_map(|(i, line)| { - | ^^^^^^^^^^^ may outlive borrowed value `self.start.line` + | ----------- value captured here ... LL | if self.start.line as usize <= i && i <= self.end.line as usize { - | --------------- `self.start.line` is borrowed here - | -note: function requires argument type to outlive `'static` - --> $DIR/confusing-lifetime-error-issue-79033.rs:24:9 - | -LL | / lines.enumerate().filter_map(|(i, line)| { -LL | | -LL | | -LL | | if self.start.line as usize <= i && i <= self.end.line as usize { -... | -LL | | }) - | |__________^ -help: to force the closure to take ownership of `self.start.line` (and any other referenced variables), use the `move` keyword - | -LL | lines.enumerate().filter_map(move |(i, line)| { - | ++++ + | ^^^^^^^^^^^^^^^ borrowed value does not live long enough +... +LL | } + | - + | | + | `self.start.line` dropped here while still borrowed + | borrow later used here -error[E0373]: closure may outlive the current function, but it borrows `self.end.line`, which is owned by the current function - --> $DIR/confusing-lifetime-error-issue-79033.rs:24:38 +error[E0597]: `self.end.line` does not live long enough + --> $DIR/confusing-lifetime-error-issue-79033.rs:27:54 | +LL | pub fn lines<'a>(self, source: &'a str) -> impl Iterator { + | ---- binding `self` declared here +LL | let lines = source.split('\n'); LL | lines.enumerate().filter_map(|(i, line)| { - | ^^^^^^^^^^^ may outlive borrowed value `self.end.line` + | ----------- value captured here ... LL | if self.start.line as usize <= i && i <= self.end.line as usize { - | ------------- `self.end.line` is borrowed here - | -note: function requires argument type to outlive `'static` - --> $DIR/confusing-lifetime-error-issue-79033.rs:24:9 - | -LL | / lines.enumerate().filter_map(|(i, line)| { -LL | | -LL | | -LL | | if self.start.line as usize <= i && i <= self.end.line as usize { -... | -LL | | }) - | |__________^ -help: to force the closure to take ownership of `self.end.line` (and any other referenced variables), use the `move` keyword - | -LL | lines.enumerate().filter_map(move |(i, line)| { - | ++++ + | ^^^^^^^^^^^^^ borrowed value does not live long enough +... +LL | } + | - + | | + | `self.end.line` dropped here while still borrowed + | borrow later used here error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0373`. +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/impl-trait/cross-return-site-inference.stderr b/tests/ui/impl-trait/cross-return-site-inference.stderr index 5512c234af985..235ac2a1ef428 100644 --- a/tests/ui/impl-trait/cross-return-site-inference.stderr +++ b/tests/ui/impl-trait/cross-return-site-inference.stderr @@ -4,34 +4,36 @@ error[E0282]: type annotations needed LL | Ok(()) | ^^ cannot infer type of the type parameter `E` declared on the enum `Result` | + = note: cannot infer type of hidden type of opaque help: consider specifying the generic arguments | LL | Ok::<(), E>(()) | +++++++++ -error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type - --> $DIR/cross-return-site-inference.rs:38:16 +error[E0282]: type annotations needed + --> $DIR/cross-return-site-inference.rs:38:12 | LL | return Err(From::from("foo")); - | ^^^^^^^^^^^^^^^^^ cannot call associated function of trait + | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result` | -help: use a fully-qualified path to a specific available implementation + = note: cannot infer type of hidden type of opaque +help: consider specifying the generic arguments | -LL | return Err(::from("foo")); - | +++++++++++++++++++ + +LL | return Err::<(), E>(From::from("foo")); + | +++++++++ -error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type - --> $DIR/cross-return-site-inference.rs:44:9 +error[E0282]: type annotations needed + --> $DIR/cross-return-site-inference.rs:44:5 | LL | Err(From::from("foo")) - | ^^^^^^^^^^^^^^^^^ cannot call associated function of trait + | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result` | -help: use a fully-qualified path to a specific available implementation + = note: cannot infer type of hidden type of opaque +help: consider specifying the generic arguments | -LL | Err(::from("foo")) - | +++++++++++++++++++ + +LL | Err::<(), E>(From::from("foo")) + | +++++++++ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0282, E0790. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg index e3faf4315ff98..29e1606cdaeae 100644 --- a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg +++ b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg @@ -1,4 +1,4 @@ - + ` + | + = note: expected struct `Box<(dyn DynIncompatible + 'static)>` + found struct `Box` + = help: `B` implements `DynIncompatible` so you could box the found value and coerce it to the trait object `Box`, you will have to change the expected type as well + +error: aborting due to 9 previous errors -Some errors have detailed explanations: E0038, E0746. +Some errors have detailed explanations: E0038, E0308, E0746. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr index bba17eb2494e2..730c7c3698965 100644 --- a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr +++ b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr @@ -9,6 +9,12 @@ LL | return A; LL | } LL | B | ^ expected `A`, found `B` + | +note: return type inferred to be `A` here + --> $DIR/dyn-incompatible-trait-in-return-position-impl-trait.rs:34:16 + | +LL | return A; + | ^ error[E0308]: mismatched types --> $DIR/dyn-incompatible-trait-in-return-position-impl-trait.rs:43:5 @@ -22,6 +28,11 @@ LL | } LL | B | ^ expected `A`, found `B` | +note: return type inferred to be `A` here + --> $DIR/dyn-incompatible-trait-in-return-position-impl-trait.rs:41:16 + | +LL | return A; + | ^ help: you could change the return type to be a boxed trait object | LL - fn cat() -> impl DynCompatible { diff --git a/tests/ui/impl-trait/equality.stderr b/tests/ui/impl-trait/equality.stderr index a44be96052512..1e4be1208a945 100644 --- a/tests/ui/impl-trait/equality.stderr +++ b/tests/ui/impl-trait/equality.stderr @@ -10,38 +10,17 @@ LL | } LL | 0_u32 | ^^^^^ expected `i32`, found `u32` | +note: return type inferred to be `i32` here + --> $DIR/equality.rs:15:16 + | +LL | return 1_i32; + | ^^^^^ help: change the type of the numeric literal from `u32` to `i32` | LL - 0_u32 LL + 0_i32 | -error[E0277]: cannot add `impl Foo` to `u32` - --> $DIR/equality.rs:26:11 - | -LL | n + sum_to(n - 1) - | ^ no implementation for `u32 + impl Foo` - | - = help: the trait `Add` is not implemented for `u32` -help: the following other types implement trait `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | - = note: `u32` implements `Add` - ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL - | - = note: in this macro invocation - --> $SRC_DIR/core/src/internal_macros.rs:LL:COL - | - = note: `&u32` implements `Add` - ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL - | - = note: `u32` implements `Add<&u32>` - ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL - | - = note: `&u32` implements `Add` - = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -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/impl-trait/fallback_inference.stderr b/tests/ui/impl-trait/fallback_inference.stderr index 9d870ab5bd0d2..0158602ed815c 100644 --- a/tests/ui/impl-trait/fallback_inference.stderr +++ b/tests/ui/impl-trait/fallback_inference.stderr @@ -4,6 +4,7 @@ error[E0282]: type annotations needed LL | PhantomData | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `PhantomData` | + = note: cannot infer type of hidden type of opaque help: consider specifying a concrete type for the type parameter `T` | LL | PhantomData:: diff --git a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr index dc566ad50153a..384c644178b89 100644 --- a/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr +++ b/tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.pre2021.stderr @@ -3,14 +3,6 @@ error[E0277]: the trait bound `!: AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is | LL | fn ice() -> impl AsRef { | ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not implemented for `!` -... -LL | todo!() - | ------- return type was inferred to be `!` here - | -help: `!` can be coerced to any type; consider casting it to a concrete type that implements the trait - | -LL | todo!() as /* Type */ - | +++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/ice-148622-opaque-as-const-generics.stderr b/tests/ui/impl-trait/ice-148622-opaque-as-const-generics.stderr index bc76c6fe85e74..8baf76d16271a 100644 --- a/tests/ui/impl-trait/ice-148622-opaque-as-const-generics.stderr +++ b/tests/ui/impl-trait/ice-148622-opaque-as-const-generics.stderr @@ -6,9 +6,12 @@ LL | trait Foo { | = note: the only supported types are integers, `bool`, and `char` -error: the constant `N` is not of type `usize` +error[E0271]: type mismatch resolving `Opaque::{opaque#0} == usize` --> $DIR/ice-148622-opaque-as-const-generics.rs:8:22 | +LL | pub type Opaque = impl std::future::Future; + | ------------------------ the found future +... LL | fn bar(&self) -> [u8; N]; | ^^^^^^^ expected `usize`, found future | @@ -29,3 +32,4 @@ LL | pub type Opaque = impl std::future::Future; error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2015.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2015.stderr index 4ba59826231c5..311bf09b8584a 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2015.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2015.stderr @@ -1,13 +1,11 @@ -error[E0700]: hidden type for `impl Debug` captures lifetime that does not appear in bounds +error: lifetime may not live long enough --> $DIR/impl-fn-hrtb-bounds-2.rs:8:9 | -LL | fn a() -> impl Fn(&u8) -> impl Debug { - | ---------- opaque type defined here LL | |x| x - | --- ^ - | | - | hidden type `&u8` captures the anonymous lifetime as defined here + | -- ^ returning this value requires that `'1` must outlive `'2` + | || + | |return type of closure is &'2 u8 + | has type `&'1 u8` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2024.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2024.stderr index c7aedfe96bb9b..869bc5f945ee1 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2024.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds-2.edition2024.stderr @@ -10,6 +10,15 @@ note: lifetime declared here LL | fn a() -> impl Fn(&u8) -> impl Debug { | ^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `a::{opaque#0} == {closure@$DIR/impl-fn-hrtb-bounds-2.rs:8:5: 8:8}` + --> $DIR/impl-fn-hrtb-bounds-2.rs:7:11 + | +LL | fn a() -> impl Fn(&u8) -> impl Debug { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_fn_hrtb_bounds_2`) + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0657`. +Some errors have detailed explanations: E0275, E0657. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr index 36f52e8103a33..ca0faae90fb96 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr @@ -53,7 +53,31 @@ note: lifetime declared here LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) { | ^^ -error: aborting due to 4 previous errors +error[E0275]: overflow evaluating the requirement `a::{opaque#0} == {closure@$DIR/impl-fn-hrtb-bounds.rs:6:5: 6:8}` + --> $DIR/impl-fn-hrtb-bounds.rs:4:11 + | +LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_fn_hrtb_bounds`) + +error[E0275]: overflow evaluating the requirement `b::{opaque#0} == {closure@$DIR/impl-fn-hrtb-bounds.rs:11:5: 11:8}` + --> $DIR/impl-fn-hrtb-bounds.rs:9:11 + | +LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_fn_hrtb_bounds`) + +error[E0275]: overflow evaluating the requirement `c::{opaque#0} == {closure@$DIR/impl-fn-hrtb-bounds.rs:16:5: 16:8}` + --> $DIR/impl-fn-hrtb-bounds.rs:14:11 + | +LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_fn_hrtb_bounds`) + +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0106, E0657. +Some errors have detailed explanations: E0106, E0275, E0657. For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.stderr b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.stderr index 3e593a64ee77b..046c2c33643f5 100644 --- a/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.stderr +++ b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.stderr @@ -12,6 +12,15 @@ note: lifetime declared here LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { | ^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `a<'a>::{opaque#0}<'a> == {closure@$DIR/impl-fn-in-ret-pos-invalid-binder.rs:9:5: 9:8}` + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:7:15 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_fn_in_ret_pos_invalid_binder`) + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0657`. +Some errors have detailed explanations: E0275, E0657. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr index 5ba9567e14e37..68a8d0ce531a4 100644 --- a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr +++ b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr @@ -34,6 +34,15 @@ note: lifetime declared here LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ { | ^ -error: aborting due to 3 previous errors +error[E0275]: overflow evaluating the requirement `a::{opaque#0} == {closure@$DIR/impl-fn-parsing-ambiguities.rs:7:5: 7:8}` + --> $DIR/impl-fn-parsing-ambiguities.rs:4:11 + | +LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_fn_parsing_ambiguities`) + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0657`. +Some errors have detailed explanations: E0275, E0657. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr index 75d7224020969..f9bd95203adbe 100644 --- a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr +++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr @@ -5,7 +5,7 @@ LL | async fn foo() -> &'static impl T; | ^^^^^^^^^^^^^^^ | | | the associated type `impl T` must be valid for the static lifetime... - | ...so that the reference type `&'static impl T` does not outlive the data it points at + | ...so that the type `impl T` will meet its required lifetime bounds error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr index f1b006da1db50..07894853c6440 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr @@ -28,6 +28,12 @@ help: consider introducing lifetime `'a` here LL | trait Foo<'a> { | ++++ -error: aborting due to 2 previous errors +error: non-defining use of `impl Sized + '_` in the defining scope + --> $DIR/bad-item-bound-within-rpitit-2.rs:4:5 + | +LL | fn bar<'other: 'a>() -> impl Sized + 'a {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr index 29975bdfcce8c..8fc5b8dc5fc62 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr @@ -1,18 +1,19 @@ -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/bad-item-bound-within-rpitit.rs:15:13 | -LL | type Item<'a> - | ------------- definition of `Item` from trait -... LL | 'b: 'a; - | ^^ impl has extra requirement `'b: 'a` + | ^^ | -help: copy the `where` clause predicates from the trait +note: lifetime parameter instantiated with the lifetime `'b` as defined here + --> $DIR/bad-item-bound-within-rpitit.rs:13:15 | -LL - where -LL - 'b: 'a; -LL + where Self: 'b; +LL | type Item<'b> = I::Item<'a> + | ^^ +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/bad-item-bound-within-rpitit.rs:12:6 | +LL | impl<'a, I: 'a + Iterable> Iterable for &'a I { + | ^^ warning: impl trait in impl method signature does not match trait method signature --> $DIR/bad-item-bound-within-rpitit.rs:18:28 @@ -34,4 +35,4 @@ LL + fn iter(&self) -> impl std::iter::Iterator::I error: aborting due to 1 previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr b/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr index a8f5bfc94c1cd..31e33649d3285 100644 --- a/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr +++ b/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr @@ -1,10 +1,10 @@ error[E0700]: hidden type for `impl Future` captures lifetime that does not appear in bounds - --> $DIR/cannot-capture-intersection.rs:22:9 + --> $DIR/cannot-capture-intersection.rs:21:5 | LL | fn foo<'a, 'b>(&'a self, x: &'b i32) -> impl Future { - | ------------------------- opaque type defined here -LL | self.ptr.foo(x) - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------- + | | + | opaque type defined here | = note: hidden type `Pin>>` captures lifetime `'_` diff --git a/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr b/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr index 155fbdc23c120..21402bc78dea0 100644 --- a/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr +++ b/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr @@ -29,6 +29,23 @@ LL | fn foo(&self) -> impl Marker; = help: consider moving `foo` to another trait = help: only type `Outer` implements `MyTrait`; consider using it directly instead. +error[E0038]: the trait `MyTrait` is not dyn compatible + --> $DIR/cycle-effective-visibilities-during-dyn-compatibility-check.rs:20:22 + | +LL | MyTrait::foo(&self) + | ^^^^^ `MyTrait` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit + --> $DIR/cycle-effective-visibilities-during-dyn-compatibility-check.rs:5:22 + | +LL | trait MyTrait { + | ------- this trait is not dyn compatible... +LL | fn foo(&self) -> impl Marker; + | ^^^^^^^^^^^ ...because method `foo` references an `impl Trait` type in its return type + = help: consider moving `foo` to another trait + = help: only type `Outer` implements `MyTrait`; consider using it directly instead. + error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied --> $DIR/cycle-effective-visibilities-during-dyn-compatibility-check.rs:20:9 | @@ -75,7 +92,7 @@ LL | fn foo(&self) -> impl Marker; = help: consider moving `foo` to another trait = help: only type `Outer` implements `MyTrait`; consider using it directly instead. -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors Some errors have detailed explanations: E0038, E0277. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr index 3c737f095ce1e..b791f97bc7a8b 100644 --- a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr +++ b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr @@ -1,11 +1,11 @@ -error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String` +error[E0271]: type mismatch resolving `impl Deref == &i32` --> $DIR/default-body-type-err.rs:4:22 | LL | fn lol(&self) -> impl Deref { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `i32` -LL | -LL | &1i32 - | ----- return type was inferred to be `&i32` here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&i32`, found associated type + | + = note: expected reference `&i32` + found associated type `impl Deref` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr b/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr index 95d8699e19ff1..084d7119c1c02 100644 --- a/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr +++ b/tests/ui/impl-trait/in-trait/do-not-imply-from-trait-impl.stderr @@ -1,17 +1,15 @@ -error[E0308]: method not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/do-not-imply-from-trait-impl.rs:17:38 | LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static { - | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(&'late _) -> _` - found signature `fn(&'a _) -> _` -note: the lifetime `'late` as defined here... - --> $DIR/do-not-imply-from-trait-impl.rs:13:25 +note: lifetime parameter instantiated with the lifetime `'late` as defined here + --> $DIR/do-not-imply-from-trait-impl.rs:17:5 | -LL | fn foo<'a: 'static, 'late>(&'late self) -> impl MkStatic; - | ^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here +LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/do-not-imply-from-trait-impl.rs:17:12 | LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static { @@ -19,4 +17,4 @@ LL | fn foo<'a: 'static>(&'a self) -> impl MkStatic + 'static { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/impl-trait/in-trait/mismatched-where-clauses.stderr b/tests/ui/impl-trait/in-trait/mismatched-where-clauses.stderr index cc6e027cad775..6559f01f3de59 100644 --- a/tests/ui/impl-trait/in-trait/mismatched-where-clauses.stderr +++ b/tests/ui/impl-trait/in-trait/mismatched-where-clauses.stderr @@ -7,6 +7,31 @@ LL | fn foo(s: S) -> impl Sized; LL | fn foo(s: S) -> impl Sized where S: Bar {} | ^^^ impl has extra requirement `S: Bar` -error: aborting due to 1 previous error +error[E0277]: the trait bound `S: Bar` is not satisfied + --> $DIR/mismatched-where-clauses.rs:8:24 + | +LL | fn foo(s: S) -> impl Sized where S: Bar {} + | ^^^^^^^^^^ the trait `Bar` is not implemented for `S` + | +note: required by a bound in `<() as Foo>::foo` + --> $DIR/mismatched-where-clauses.rs:8:44 + | +LL | impl Foo for () { +LL | fn foo(s: S) -> impl Sized where S: Bar {} + | ^^^ required by this bound in `<() as Foo>::foo` + +error[E0276]: impl has stricter requirements than trait + --> $DIR/mismatched-where-clauses.rs:8:44 + | +LL | fn foo(s: S) -> impl Sized; + | ------------------------------ definition of `foo` from trait +... +LL | fn foo(s: S) -> impl Sized where S: Bar {} + | ^^^ impl has extra requirement `S: Bar` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0276`. +Some errors have detailed explanations: E0276, E0277. +For more information about an error, try `rustc --explain E0276`. diff --git a/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr b/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr index 0c3a0fc91b017..9bcb94430458f 100644 --- a/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr +++ b/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr @@ -5,14 +5,14 @@ LL | ().publish_typed(); | ^^^^^^^^^^^^^ cannot infer type of the type parameter `F` declared on the method `publish_typed` | = note: the type must implement `Clone` - = note: opaque types cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` -note: required by a bound in `TypedClient::publish_typed::{anon_assoc#0}` +note: required by a bound in `TypedClient::publish_typed` --> $DIR/not-inferred-generic.rs:4:12 | LL | trait TypedClient { -... +LL | fn publish_typed(&self) -> impl Sized +LL | where LL | F: Clone; - | ^^^^^ required by this bound in `TypedClient::publish_typed::{anon_assoc#0}` + | ^^^^^ required by this bound in `TypedClient::publish_typed` help: consider specifying a concrete type for the type parameter `F` | LL | ().publish_typed::(); diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr index 471a454a5f522..c55537a7a098c 100644 --- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr @@ -25,14 +25,35 @@ LL | trait Foo { LL | fn foo(self) -> impl Foo; | ^^^^^^ required by this bound in `Foo::foo::{anon_assoc#0}` +error[E0277]: the trait bound `F2: Foo` is not satisfied + --> $DIR/return-dont-satisfy-bounds.rs:8:34 + | +LL | fn foo>(self) -> impl Foo { + | ^^^^^^^^^^^^ the trait `Foo` is not implemented for `F2` + | +note: required by a bound in `>::foo` + --> $DIR/return-dont-satisfy-bounds.rs:8:16 + | +LL | impl Foo for Bar { +LL | fn foo>(self) -> impl Foo { + | ^^^^^^^ required by this bound in `>::foo` + +error[E0276]: impl has stricter requirements than trait + --> $DIR/return-dont-satisfy-bounds.rs:8:16 + | +LL | fn foo(self) -> impl Foo; + | -------------------------------- definition of `foo` from trait +... +LL | fn foo>(self) -> impl Foo { + | ^^^^^^^ impl has extra requirement `F2: Foo` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the trait bound `Bar: Foo` is not satisfied --> $DIR/return-dont-satisfy-bounds.rs:8:34 | LL | fn foo>(self) -> impl Foo { | ^^^^^^^^^^^^ unsatisfied trait bound -... -LL | self - | ---- return type was inferred to be `Bar` here | help: the trait `Foo` is not implemented for `Bar` but trait `Foo` is implemented for it @@ -42,7 +63,7 @@ LL | impl Foo for Bar { | ^^^^^^^^^^^^^^^^^^^^^^ = help: for that trait implementation, expected `char`, found `u8` -error: aborting due to 3 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0276, E0277. For more information about an error, try `rustc --explain E0276`. diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr index dfcf11c57ddc1..3d2cf403f268e 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr @@ -1,19 +1,16 @@ -error[E0276]: impl has stricter requirements than trait +error[E0478]: lifetime bound not satisfied --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:13 | -LL | fn extend<'a: 'a>(_: &'a str) -> (impl Sized + 'a, &'static str); - | ----------------------------------------------------------------- definition of `extend` from trait -... LL | 'a: 'static, - | ^^^^^^^ impl has extra requirement `'a: 'static` + | ^^^^^^^ | -help: copy the `where` clause predicates from the trait - | -LL - where -LL - 'a: 'static, -LL + where 'a: 'a +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:6:15 | +LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str) + | ^^ + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr index 4c10422f985f1..7cdda4aeecefb 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr @@ -1,16 +1,11 @@ -error[E0491]: in type `&'static &()`, reference has a longer lifetime than the data it references +error[E0477]: the type `&()` does not fulfill the required lifetime --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:27 | LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: the pointer is valid for the static lifetime -note: but the referenced data is only valid for the anonymous lifetime defined here - --> $DIR/rpitit-hidden-types-self-implied-wf.rs:2:18 - | -LL | fn extend(_: &str) -> (impl Sized + '_, &'static str); - | ^^^^ + = note: type must satisfy the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/impl-trait/in-trait/rpitit-mismatch-missing-item-name-issue-161915.stderr b/tests/ui/impl-trait/in-trait/rpitit-mismatch-missing-item-name-issue-161915.stderr index 7b8f6e438c456..cc0463b5c584d 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-mismatch-missing-item-name-issue-161915.stderr +++ b/tests/ui/impl-trait/in-trait/rpitit-mismatch-missing-item-name-issue-161915.stderr @@ -18,16 +18,6 @@ LL | | } = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters = note: an associated type was expected, but a different one was found -help: you could change the return type to be a boxed trait object - | -LL - fn forms_at_phase() -> impl Form { -LL + fn forms_at_phase() -> Box { - | -help: if you change the return type to expect trait objects, box the returned expressions - | -LL ~ true => Box::new(T::create()), -LL ~ false => Box::new(U::create()), - | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr index b27d7870955ed..996560de31c89 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.failure.stderr @@ -4,7 +4,7 @@ error[E0477]: the type `impl Future>` does not fulfill the requ LL | ) -> impl Future> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: type must outlive the lifetime `'a` as defined here as required by this binding +note: type must outlive the lifetime `'a` as defined here --> $DIR/signature-mismatch.rs:73:32 | LL | fn async_fn_reduce_outlive<'a, 'b, T>( diff --git a/tests/ui/impl-trait/issues/fuzzer-ice-issue-112201.stderr b/tests/ui/impl-trait/issues/fuzzer-ice-issue-112201.stderr index f507ad385a171..ba6f6ec5d9671 100644 --- a/tests/ui/impl-trait/issues/fuzzer-ice-issue-112201.stderr +++ b/tests/ui/impl-trait/issues/fuzzer-ice-issue-112201.stderr @@ -1,18 +1,38 @@ -error[E0792]: expected generic type parameter, found `impl Sized` +error[E0308]: mismatched types --> $DIR/fuzzer-ice-issue-112201.rs:11:5 | +LL | pub fn wrap(x: T) -> impl Sized { + | ---------- the expected opaque type +... LL | fn repeat_helper(x: T) -> impl Sized { - | - this generic parameter must be used with a generic type parameter + | - found this type parameter LL | return x; LL | repeat_helper(wrap(x)) - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found type parameter `T` + | + = note: expected opaque type `impl Sized` + found type parameter `T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters -error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias +error[E0308]: mismatched types --> $DIR/fuzzer-ice-issue-112201.rs:11:5 | +LL | pub fn wrap(x: T) -> impl Sized { + | ---------- the expected opaque type +... +LL | fn repeat_helper(x: T) -> impl Sized { + | - found this type parameter +LL | return x; LL | repeat_helper(wrap(x)) - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found type parameter `T` + | + = note: expected opaque type `impl Sized` + found type parameter `T` + = help: type parameters must be constrained to match other types + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/issues/issue-100075-2.stderr b/tests/ui/impl-trait/issues/issue-100075-2.stderr index 554c3ea34331e..33cebaed3453a 100644 --- a/tests/ui/impl-trait/issues/issue-100075-2.stderr +++ b/tests/ui/impl-trait/issues/issue-100075-2.stderr @@ -1,21 +1,11 @@ -error[E0720]: cannot resolve opaque type +error[E0282]: type annotations needed --> $DIR/issue-100075-2.rs:1:23 | LL | fn opaque(t: T) -> impl Sized { - | ^^^^^^^^^^ - -warning: function cannot return without recursing - --> $DIR/issue-100075-2.rs:1:1 - | -LL | fn opaque(t: T) -> impl Sized { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -... -LL | opaque(Some(t)) - | --------------- recursive call site + | ^^^^^^^^^^ cannot infer type | - = help: a `loop` may express intention better if this is on purpose - = note: `#[warn(unconditional_recursion)]` on by default + = note: cannot infer type of hidden type of opaque -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/issues/issue-100075.stderr b/tests/ui/impl-trait/issues/issue-100075.stderr index bca2874b2b4b1..6126f87275681 100644 --- a/tests/ui/impl-trait/issues/issue-100075.stderr +++ b/tests/ui/impl-trait/issues/issue-100075.stderr @@ -1,9 +1,11 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/issue-100075.rs:13:37 +error[E0282]: type annotations needed + --> $DIR/issue-100075.rs:13:28 | LL | fn _g(t: &'static T) -> &'static impl Marker { - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/issues/issue-103599.stderr b/tests/ui/impl-trait/issues/issue-103599.stderr index 9878b12044f70..938a7dfe6fa21 100644 --- a/tests/ui/impl-trait/issues/issue-103599.stderr +++ b/tests/ui/impl-trait/issues/issue-103599.stderr @@ -1,21 +1,11 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/issue-103599.rs:3:23 +error[E0282]: type annotations needed + --> $DIR/issue-103599.rs:6:10 | -LL | fn wrap(x: impl T) -> impl T { - | ^^^^^^ - -warning: function cannot return without recursing - --> $DIR/issue-103599.rs:3:1 - | -LL | fn wrap(x: impl T) -> impl T { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -... LL | wrap(wrap(x)) - | ------- recursive call site + | ^^^^^^^ cannot infer type | - = help: a `loop` may express intention better if this is on purpose - = note: `#[warn(unconditional_recursion)]` on by default + = note: cannot infer type of hidden type of opaque -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/issues/issue-55872-1.stderr b/tests/ui/impl-trait/issues/issue-55872-1.stderr index e048bec1b6d22..6333fa6035906 100644 --- a/tests/ui/impl-trait/issues/issue-55872-1.stderr +++ b/tests/ui/impl-trait/issues/issue-55872-1.stderr @@ -7,43 +7,33 @@ LL | fn foo() -> Self::E; LL | fn foo() -> Self::E { | ^^^^^^^ impl has extra requirement `T: Default` -error[E0277]: the trait bound `S: Copy` is not satisfied in `(S, T)` +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias --> $DIR/issue-55872-1.rs:12:29 | LL | fn foo() -> Self::E { - | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `S` -... -LL | (S::default(), T::default()) - | ---------------------------- return type was inferred to be `(S, T)` here - | - = note: required because it appears within the type `(S, T)` -help: consider further restricting type parameter `S` with trait `Copy` - | -LL | impl Bar for S { - | +++++++++++++++++++ + | ^^^^^^^ -error[E0277]: the trait bound `T: Copy` is not satisfied in `(S, T)` +error[E0271]: type mismatch resolving `::E == (S, T)` --> $DIR/issue-55872-1.rs:12:29 | LL | fn foo() -> Self::E { - | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `T` -... -LL | (S::default(), T::default()) - | ---------------------------- return type was inferred to be `(S, T)` here + | ^^^^^^^ type mismatch resolving `::E == (S, T)` | - = note: required because it appears within the type `(S, T)` -help: consider further restricting type parameter `T` with trait `Copy` +note: types differ + --> $DIR/issue-55872-1.rs:10:14 | -LL | fn foo() -> Self::E { - | +++++++++++++++++++ +LL | type E = impl Copy; + | ^^^^^^^^^ error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias --> $DIR/issue-55872-1.rs:12:29 | LL | fn foo() -> Self::E { | ^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 4 previous errors -Some errors have detailed explanations: E0276, E0277. -For more information about an error, try `rustc --explain E0276`. +Some errors have detailed explanations: E0271, E0276. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/issues/issue-55872-3.stderr b/tests/ui/impl-trait/issues/issue-55872-3.stderr index 5124c46baeb97..656298104511e 100644 --- a/tests/ui/impl-trait/issues/issue-55872-3.stderr +++ b/tests/ui/impl-trait/issues/issue-55872-3.stderr @@ -4,12 +4,5 @@ error: type parameter `T` is part of concrete type but not used in parameter lis LL | fn foo() -> Self::E { | ^^^^^^^ -error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:17:9: 17:14}: Copy` is not satisfied - --> $DIR/issue-55872-3.rs:14:20 - | -LL | fn foo() -> Self::E { - | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:17:9: 17:14}` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/issues/issue-67830.stderr b/tests/ui/impl-trait/issues/issue-67830.stderr index 7254955ed0bde..b4cd4ae789585 100644 --- a/tests/ui/impl-trait/issues/issue-67830.stderr +++ b/tests/ui/impl-trait/issues/issue-67830.stderr @@ -12,6 +12,27 @@ note: lifetime declared here LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> { | ^^ -error: aborting due to 1 previous error +error[E0277]: the trait bound `for<'a> Wrap<{closure@$DIR/issue-67830.rs:22:10: 22:13}>: MyFn<&'a A>` is not satisfied + --> $DIR/issue-67830.rs:20:14 + | +LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `MyFn<&'a A>` is not implemented for `Wrap<{closure@$DIR/issue-67830.rs:22:10: 22:13}>` + but trait `MyFn<&A>` is implemented for it + --> $DIR/issue-67830.rs:8:1 + | +LL | / impl MyFn for Wrap +LL | | where +LL | | F: Fn(A) -> B, + | |__________________^ +note: this is a known limitation of the trait solver that will be lifted in the future + --> $DIR/issue-67830.rs:20:14 + | +LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ try adding turbofish arguments to this expression to specify the types manually, even if it's redundant + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0657`. +Some errors have detailed explanations: E0277, E0657. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/issues/issue-70877.stderr b/tests/ui/impl-trait/issues/issue-70877.stderr index b2f37c8af9ebe..9f90e8a05adf3 100644 --- a/tests/ui/impl-trait/issues/issue-70877.stderr +++ b/tests/ui/impl-trait/issues/issue-70877.stderr @@ -1,58 +1,23 @@ -error: item does not constrain `FooRet::{opaque#0}` - --> $DIR/issue-70877.rs:25:8 +error[E0282]: type annotations needed + --> $DIR/issue-70877.rs:25:17 | LL | pub fn ham() -> Foo { - | ^^^ + | ^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/issue-70877.rs:18:19 - | -LL | pub type FooRet = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^ - -error: item does not constrain `FooRet::{opaque#0}` - --> $DIR/issue-70877.rs:30:8 - | -LL | pub fn oof() -> impl std::fmt::Debug { - | ^^^ - | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/issue-70877.rs:18:19 - | -LL | pub type FooRet = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque -error: item does not constrain `Foo::{opaque#0}` - --> $DIR/issue-70877.rs:30:8 - | -LL | pub fn oof() -> impl std::fmt::Debug { - | ^^^ - | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/issue-70877.rs:23:16 - | -LL | pub type Foo = impl Iterator; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: opaque type's hidden type cannot be another opaque type from the same scope - --> $DIR/issue-70877.rs:35:12 - | -LL | return func(&"oof"); - | ^^^^^^^^^^^^ one of the two opaque types used here has to be outside its defining scope +error[E0282]: type annotations needed + --> $DIR/issue-70877.rs:33:9 | -note: opaque type whose hidden type is being assigned - --> $DIR/issue-70877.rs:30:17 +LL | let mut bar = ham(); + | ^^^^^^^ | -LL | pub fn oof() -> impl std::fmt::Debug { - | ^^^^^^^^^^^^^^^^^^^^ -note: opaque type being used as hidden type - --> $DIR/issue-70877.rs:18:19 + = note: cannot infer type of hidden type of opaque +help: consider giving `bar` an explicit type | -LL | pub type FooRet = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^ +LL | let mut bar: /* Type */ = ham(); + | ++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/issues/issue-72911.stderr b/tests/ui/impl-trait/issues/issue-72911.stderr index 1333f608ead17..5cb4ecb115c6b 100644 --- a/tests/ui/impl-trait/issues/issue-72911.stderr +++ b/tests/ui/impl-trait/issues/issue-72911.stderr @@ -1,3 +1,11 @@ +error[E0277]: `!` is not an iterator + --> $DIR/issue-72911.rs:16:20 + | +LL | fn lint_files() -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator + | + = help: the trait `Iterator` is not implemented for `!` + error[E0433]: cannot find module or crate `foo` in this scope --> $DIR/issue-72911.rs:11:33 | @@ -14,6 +22,7 @@ LL | fn lint_files() -> impl Iterator { | = help: you might be missing a crate named `foo` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0433`. +Some errors have detailed explanations: E0277, E0433. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/issues/issue-74282.stderr b/tests/ui/impl-trait/issues/issue-74282.stderr index 7a49041cace7e..e482339d3cd67 100644 --- a/tests/ui/impl-trait/issues/issue-74282.stderr +++ b/tests/ui/impl-trait/issues/issue-74282.stderr @@ -1,9 +1,8 @@ error[E0308]: mismatched types --> $DIR/issue-74282.rs:9:15 | -LL | type Closure = impl Fn() -> u64; - | ---------------- the expected opaque type -... +LL | let y = || -> Closure { || 3 }; + | -- the expected closure LL | Anonymous(|| { | _____---------_^ | | | @@ -11,10 +10,10 @@ LL | Anonymous(|| { LL | | LL | | 3 LL | | }) - | |_____^ expected opaque type, found closure + | |_____^ expected closure, found a different closure | - = note: expected opaque type `Closure` - found closure `{closure@$DIR/issue-74282.rs:9:15: 9:17}` + = note: expected closure `{closure@$DIR/issue-74282.rs:8:29: 8:31}` + found closure `{closure@$DIR/issue-74282.rs:9:15: 9:17}` = note: no two closures, even if identical, have the same type = help: consider boxing your closure and/or using it as a trait object note: tuple struct defined here diff --git a/tests/ui/impl-trait/issues/issue-78722-2.stderr b/tests/ui/impl-trait/issues/issue-78722-2.stderr index c2aeb0ab13664..b68206701dbae 100644 --- a/tests/ui/impl-trait/issues/issue-78722-2.stderr +++ b/tests/ui/impl-trait/issues/issue-78722-2.stderr @@ -12,11 +12,11 @@ LL | let f: F = async { 1 }; = note: expected opaque type `F` found `async` block `{async block@$DIR/issue-78722-2.rs:17:20: 17:25}` -error[E0271]: expected `{async block@issue-78722-2.rs:14:13}` to be a future that resolves to `u8`, but it resolves to `()` +error[E0271]: type mismatch resolving `F == {async block@issue-78722-2.rs:14:13}` --> $DIR/issue-78722-2.rs:12:30 | LL | fn concrete_use() -> F { - | ^ expected `u8`, found `()` + | ^ types differ error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/issues/issue-78722.stderr b/tests/ui/impl-trait/issues/issue-78722.stderr index 9244d18c36b49..c7a751dcfaf0c 100644 --- a/tests/ui/impl-trait/issues/issue-78722.stderr +++ b/tests/ui/impl-trait/issues/issue-78722.stderr @@ -8,11 +8,11 @@ LL | let f: F = async { 1 }; = help: add `#![feature(const_async_blocks)]` 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[E0271]: expected `{async block@issue-78722.rs:11:13}` to be a future that resolves to `u8`, but it resolves to `()` +error[E0271]: type mismatch resolving `F == {async block@issue-78722.rs:11:13}` --> $DIR/issue-78722.rs:9:30 | LL | fn concrete_use() -> F { - | ^ expected `u8`, found `()` + | ^ types differ error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/issues/issue-83919.stderr b/tests/ui/impl-trait/issues/issue-83919.stderr index b0bd6ed116bca..35686c5791e62 100644 --- a/tests/ui/impl-trait/issues/issue-83919.stderr +++ b/tests/ui/impl-trait/issues/issue-83919.stderr @@ -1,11 +1,15 @@ -error[E0277]: `{integer}` is not a future +error[E0271]: type mismatch resolving `::Fut == {async block@issue-83919.rs:23:9}` --> $DIR/issue-83919.rs:21:26 | LL | fn get_fut(&self) -> Self::Fut { - | ^^^^^^^^^ `{integer}` is not a future + | ^^^^^^^^^ type mismatch resolving `::Fut == {async block@issue-83919.rs:23:9}` | - = help: the trait `Future` is not implemented for `{integer}` +note: types differ + --> $DIR/issue-83919.rs:19:16 + | +LL | type Fut = impl Future; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr index 0f4c6e83fbe70..1677e51e82452 100644 --- a/tests/ui/impl-trait/issues/issue-84073.stderr +++ b/tests/ui/impl-trait/issues/issue-84073.stderr @@ -1,8 +1,10 @@ -error[E0275]: overflow assigning `_` to `Option<_>` +error[E0275]: overflow assigning `Option>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `Option>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/issue-84073.rs:32:27 | LL | Race::new(|race| race.when()); | ^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_84073`) error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/issues/issue-86719.stderr b/tests/ui/impl-trait/issues/issue-86719.stderr index 15893df5f9458..bda32eea6a80e 100644 --- a/tests/ui/impl-trait/issues/issue-86719.stderr +++ b/tests/ui/impl-trait/issues/issue-86719.stderr @@ -19,6 +19,7 @@ error[E0282]: type annotations needed LL | |_| true | ^ | + = note: cannot infer type of hidden type of opaque help: consider giving this closure parameter an explicit type | LL | |_: /* Type */| true diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr index e122fc229ccd3..b43f021d11987 100644 --- a/tests/ui/impl-trait/issues/issue-86800.stderr +++ b/tests/ui/impl-trait/issues/issue-86800.stderr @@ -11,18 +11,14 @@ note: this opaque type is supposed to be constrained LL | type TransactionFuture<'__, O> = impl '__ + Future>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: item does not constrain `TransactionFuture::{opaque#0}` - --> $DIR/issue-86800.rs:36:14 +error[E0282]: type annotations needed + --> $DIR/issue-86800.rs:43:9 | -LL | async fn do_transaction( - | ^^^^^^^^^^^^^^ +LL | f(&mut transaction).await + | ^^^^^^^^^^^^^^^^^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/issue-86800.rs:21:34 - | -LL | type TransactionFuture<'__, O> = impl '__ + Future>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/issues/issue-87450.stderr b/tests/ui/impl-trait/issues/issue-87450.stderr index f0f8b5859c031..da0bcfb288f93 100644 --- a/tests/ui/impl-trait/issues/issue-87450.stderr +++ b/tests/ui/impl-trait/issues/issue-87450.stderr @@ -1,21 +1,15 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/issue-87450.rs:5:13 +error[E0308]: mismatched types + --> $DIR/issue-87450.rs:8:40 | -LL | fn foo() -> impl Fn() { - | ^^^^^^^^^ - -warning: function cannot return without recursing - --> $DIR/issue-87450.rs:5:1 - | -LL | fn foo() -> impl Fn() { - | ^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -... LL | wrap(wrap(wrap(wrap(wrap(wrap(wrap(foo()))))))) - | ----- recursive call site + | ^^^^^ expected inferred type, found opaque type +... +LL | fn wrap(f: impl Fn()) -> impl Fn() { + | --------- the found opaque type | - = help: a `loop` may express intention better if this is on purpose - = note: `#[warn(unconditional_recursion)]` on by default + = note: expected type `_` + found opaque type `impl Fn()` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/issues/issue-88236-2.stderr b/tests/ui/impl-trait/issues/issue-88236-2.stderr index 3943c41218454..3e764dd9bb821 100644 --- a/tests/ui/impl-trait/issues/issue-88236-2.stderr +++ b/tests/ui/impl-trait/issues/issue-88236-2.stderr @@ -40,6 +40,37 @@ note: lifetime declared here LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { | ^^ -error: aborting due to 3 previous errors +error[E0277]: the trait bound `for<'a> &(): Hrtb<'a>` is not satisfied + --> $DIR/issue-88236-2.rs:18:38 + | +LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Hrtb<'a>` is not implemented for `&()` + | +help: the following other types implement trait `Hrtb<'a>` + --> $DIR/issue-88236-2.rs:7:1 + | +LL | impl<'a> Hrtb<'a> for () { + | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` +... +LL | impl<'a> Hrtb<'a> for &'a () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&()` + +error[E0277]: the trait bound `for<'a> &(): Hrtb<'a>` is not satisfied + --> $DIR/issue-88236-2.rs:23:36 + | +LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Hrtb<'a>` is not implemented for `&()` + | +help: the following other types implement trait `Hrtb<'a>` + --> $DIR/issue-88236-2.rs:7:1 + | +LL | impl<'a> Hrtb<'a> for () { + | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` +... +LL | impl<'a> Hrtb<'a> for &'a () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&()` + +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0657`. +Some errors have detailed explanations: E0277, E0657. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/issues/issue-99073-2.stderr b/tests/ui/impl-trait/issues/issue-99073-2.stderr index 519530b539625..070ddfdcea812 100644 --- a/tests/ui/impl-trait/issues/issue-99073-2.stderr +++ b/tests/ui/impl-trait/issues/issue-99073-2.stderr @@ -1,12 +1,17 @@ -error[E0792]: expected generic type parameter, found `i32` +error[E0308]: mismatched types --> $DIR/issue-99073-2.rs:9:22 | -LL | fn test(t: T, recurse: bool) -> impl Display { - | - this generic parameter must be used with a generic type parameter -LL | let f = || { LL | let i: u32 = test::(-1, false); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/issue-99073-2.rs:9:22 + | +LL | let i: u32 = test::(-1, false); + | ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/issues/issue-99073.stderr b/tests/ui/impl-trait/issues/issue-99073.stderr index 1917c1bfd6b4f..456fba876678c 100644 --- a/tests/ui/impl-trait/issues/issue-99073.stderr +++ b/tests/ui/impl-trait/issues/issue-99073.stderr @@ -1,11 +1,16 @@ -error[E0792]: expected generic type parameter, found `&F` +error[E0308]: mismatched types --> $DIR/issue-99073.rs:6:13 | LL | fn fix(f: F) -> impl Fn() { - | - this generic parameter must be used with a generic type parameter + | - found this type parameter LL | move || f(fix(&f)) - | ^^^^^^^ + | ------- ^^^^^^^ expected closure, found type parameter `G` + | | + | the expected closure + | + = note: expected closure `{closure@$DIR/issue-99073.rs:6:3: 6:10}` + found type parameter `G` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/issues/return-type-mismatch-diagnostics-issue-162271.stderr b/tests/ui/impl-trait/issues/return-type-mismatch-diagnostics-issue-162271.stderr index df3467b5b9db6..152ae681beada 100644 --- a/tests/ui/impl-trait/issues/return-type-mismatch-diagnostics-issue-162271.stderr +++ b/tests/ui/impl-trait/issues/return-type-mismatch-diagnostics-issue-162271.stderr @@ -20,6 +20,11 @@ LL | async {} | = note: expected unit type `()` found `async` block `{async block@$DIR/return-type-mismatch-diagnostics-issue-162271.rs:10:5: 10:10}` +note: return type inferred to be `()` here + --> $DIR/return-type-mismatch-diagnostics-issue-162271.rs:8:9 + | +LL | return; + | ^^^^^^ error[E0308]: mismatched types --> $DIR/return-type-mismatch-diagnostics-issue-162271.rs:19:5 @@ -40,6 +45,11 @@ LL | async {} found `async` block `{async block@$DIR/return-type-mismatch-diagnostics-issue-162271.rs:19:5: 19:10}` = note: no two async blocks, even if identical, have the same type = help: consider pinning your async block and casting it to a trait object +note: return type inferred to be `{async block@$DIR/return-type-mismatch-diagnostics-issue-162271.rs:17:16: 17:21}` here + --> $DIR/return-type-mismatch-diagnostics-issue-162271.rs:17:16 + | +LL | return async {}; + | ^^^^^^^^ help: you could change the return type to be a boxed trait object | LL - fn multiple_returns_same_future_output() -> impl Future { diff --git a/tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr b/tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr index 7d63c1cfbd6a2..71d4f84a6b1b6 100644 --- a/tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr +++ b/tests/ui/impl-trait/issues/type-error-post-normalization-test.stderr @@ -5,10 +5,10 @@ LL | fn other_define() -> Tait { | ^^^^ expected `&isize`, got `()` | note: previous use here - --> $DIR/type-error-post-normalization-test.rs:16:9 + --> $DIR/type-error-post-normalization-test.rs:15:9 | -LL | set(x); - | ^ +LL | fn d(x: Tait) { + | ^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/member-constraints/min-choice-reject-ambiguous.stderr b/tests/ui/impl-trait/member-constraints/min-choice-reject-ambiguous.stderr index 911ddd3dc805a..59af30722006c 100644 --- a/tests/ui/impl-trait/member-constraints/min-choice-reject-ambiguous.stderr +++ b/tests/ui/impl-trait/member-constraints/min-choice-reject-ambiguous.stderr @@ -27,15 +27,17 @@ LL | T: 'c + 'a, | ++++ error[E0700]: hidden type for `impl Cap<'b> + Cap<'c>` captures lifetime that does not appear in bounds - --> $DIR/min-choice-reject-ambiguous.rs:39:5 - | -LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> - | -- ---------------------- opaque type defined here - | | - | hidden type `&'a u8` captures the lifetime `'a` as defined here -... -LL | s - | ^ + --> $DIR/min-choice-reject-ambiguous.rs:34:1 + | +LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> + | ^ -- ---------------------- opaque type defined here + | | | + | _| hidden type `&'a u8` captures the lifetime `'a` as defined here + | | +LL | | where +LL | | 'a: 'b, +LL | | 'a: 'c, + | |___________^ | help: add a `use<...>` bound to explicitly capture `'a` | diff --git a/tests/ui/impl-trait/member-constraints/nested-impl-trait-fail.stderr b/tests/ui/impl-trait/member-constraints/nested-impl-trait-fail.stderr index 1a0611e715e19..d2c195bb0a9d4 100644 --- a/tests/ui/impl-trait/member-constraints/nested-impl-trait-fail.stderr +++ b/tests/ui/impl-trait/member-constraints/nested-impl-trait-fail.stderr @@ -1,13 +1,15 @@ error[E0700]: hidden type for `impl IntoIterator + Cap<'b>>` captures lifetime that does not appear in bounds - --> $DIR/nested-impl-trait-fail.rs:17:5 + --> $DIR/nested-impl-trait-fail.rs:12:1 | -LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b>> - | -- ------------------------------------------------ opaque type defined here - | | - | hidden type `[&'s u8; 1]` captures the lifetime `'s` as defined here -... -LL | [a] - | ^^^ +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator + Cap<'b>> + | ^ -- ------------------------------------------------ opaque type defined here + | | | + | _| hidden type `[&'s u8; 1]` captures the lifetime `'s` as defined here + | | +LL | | where +LL | | 's: 'a, +LL | | 's: 'b, + | |___________^ | help: add a `use<...>` bound to explicitly capture `'s` | @@ -15,15 +17,17 @@ LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator for &F - where A: std::marker::Tuple, F: Fn, F: ?Sized; - - impl Fn for Box - where Args: std::marker::Tuple, F: Fn, A: Allocator, F: ?Sized; - - impl Fn for SyncView - where F: Sync, F: Fn, Args: std::marker::Tuple; - = note: cannot satisfy `<_ as FnOnce<()>>::Output == impl Debug` + = note: cannot infer type of hidden type of opaque error: unconstrained opaque type --> $DIR/where-allowed.rs:122:16 @@ -415,9 +410,9 @@ LL | impl T {} | = note: either implement a trait on it or create a newtype to wrap it instead -error: aborting due to 48 previous errors +error: aborting due to 49 previous errors -Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0658, E0666. +Some errors have detailed explanations: E0053, E0118, E0282, E0562, E0658, E0666. For more information about an error, try `rustc --explain E0053`. Future incompatibility report: Future breakage diagnostic: warning: defaults for generic parameters are not allowed here diff --git a/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr b/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr index dcb68fbf2cdbe..3d78f2d070cbc 100644 --- a/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr +++ b/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references +error[E0477]: the type `&'b ()` does not fulfill the required lifetime --> $DIR/impl-header-unnormalized-types.rs:15:5 | LL | type Assoc = &'a &'b (); | ^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/impl-header-unnormalized-types.rs:14:6 | LL | impl<'a, 'b> NeedsWf<'a, 'b> for Foo<<&'a &'b () as GoodBye>::Forget> { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/impl-header-unnormalized-types.rs:14:10 - | -LL | impl<'a, 'b> NeedsWf<'a, 'b> for Foo<<&'a &'b () as GoodBye>::Forget> { - | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr b/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr index f8ee6fef82423..60db5227813b0 100644 --- a/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr +++ b/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr @@ -9,15 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'s` as defined here... | LL | fn get<'s>(s: &'s str, _: ()) -> &'static str; | ^^ -note: ...so that the method type is compatible with trait +note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `fn(&'s _, ()) -> &'static _` - found `fn(&_, ()) -> &'static _` = note: but, the lifetime must be valid for the static lifetime... -note: ...so that the reference type `&'static &()` does not outlive the data it points at +note: ...so that the type `&()` will meet its required lifetime bounds --> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { diff --git a/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr b/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr index e0cf15d0d1f33..215a842522e2c 100644 --- a/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr +++ b/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'a MessageListeners<'_>`, reference has a longer lifetime than the data it references +error[E0477]: the type `MessageListeners<'c>` does not fulfill the required lifetime --> $DIR/impl-implied-bounds-compatibility.rs:12:5 | LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/impl-implied-bounds-compatibility.rs:11:6 | LL | impl<'a> MessageListenersInterface for MessageListeners<'a> { | ^^ -note: but the referenced data is only valid for the lifetime `'c` as defined here - --> $DIR/impl-implied-bounds-compatibility.rs:12:5 - | -LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/indexing/indexing-requires-a-uint.stderr b/tests/ui/indexing/indexing-requires-a-uint.stderr index 9e974c8c9bbcc..17ef33171319a 100644 --- a/tests/ui/indexing/indexing-requires-a-uint.stderr +++ b/tests/ui/indexing/indexing-requires-a-uint.stderr @@ -13,6 +13,8 @@ help: `usize` implements trait `SliceIndex` | = note: `SliceIndex` = note: required for `[{integer}]` to implement `Index` + = note: 1 redundant requirement hidden + = note: required for `[{integer}; 1]` to implement `Index` error[E0308]: mismatched types --> $DIR/indexing-requires-a-uint.rs:12:18 diff --git a/tests/ui/indexing/point-at-index-for-obligation-failure.stderr b/tests/ui/indexing/point-at-index-for-obligation-failure.stderr index 22f48d61985f2..ae32ed82dab0d 100644 --- a/tests/ui/indexing/point-at-index-for-obligation-failure.stderr +++ b/tests/ui/indexing/point-at-index-for-obligation-failure.stderr @@ -13,6 +13,18 @@ help: the trait `Borrow<&_>` is not implemented for `String` = help: for that trait implementation, expected `str`, found `&str` = note: required for `HashMap` to implement `Index<&&str>` -error: aborting due to 1 previous error +error[E0277]: the trait bound `String: Borrow<&str>` is not satisfied + --> $DIR/point-at-index-for-obligation-failure.rs:5:9 + | +LL | &s + | ^^ the trait `Borrow<&str>` is not implemented for `String` + | +help: the trait `Borrow<&_>` is not implemented for `String` + but trait `Borrow<_>` is implemented for it + --> $SRC_DIR/alloc/src/str.rs:LL:COL + = help: for that trait implementation, expected `str`, found `&str` + = note: required for `HashMap` to implement `Index<&&str>` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/inference/ambiguous_type_parameter.stderr b/tests/ui/inference/ambiguous_type_parameter.stderr index 835999121d611..2e0831321419a 100644 --- a/tests/ui/inference/ambiguous_type_parameter.stderr +++ b/tests/ui/inference/ambiguous_type_parameter.stderr @@ -7,7 +7,7 @@ LL | InMemoryStore.get_raw(&String::default()); help: try using a fully qualified path to specify the expected types | LL - InMemoryStore.get_raw(&String::default()); -LL + >>::get_raw(&InMemoryStore, &String::default()); +LL + >>::get_raw(&InMemoryStore, &String::default()); | error: aborting due to 1 previous error diff --git a/tests/ui/inference/cannot-infer-closure-circular.stderr b/tests/ui/inference/cannot-infer-closure-circular.stderr index ee17f7737cf30..d1166a39e53de 100644 --- a/tests/ui/inference/cannot-infer-closure-circular.stderr +++ b/tests/ui/inference/cannot-infer-closure-circular.stderr @@ -4,8 +4,7 @@ error[E0282]: type annotations needed for `Result<(), _>` LL | let x = |r| { | ^ LL | let v = r?; -LL | Ok(v) - | ----- type must be known at this point + | - type must be known at this point | help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified | diff --git a/tests/ui/inference/downcast-fn-ptr-placeholder.stderr b/tests/ui/inference/downcast-fn-ptr-placeholder.stderr index 0d1801ac644df..53f24b420cb8b 100644 --- a/tests/ui/inference/downcast-fn-ptr-placeholder.stderr +++ b/tests/ui/inference/downcast-fn-ptr-placeholder.stderr @@ -1,9 +1,15 @@ -error[E0282]: type annotations needed +error[E0284]: type annotations needed: cannot satisfy `fn(_) -> _: 'static` --> $DIR/downcast-fn-ptr-placeholder.rs:9:22 | LL | b.downcast_ref::_>(); - | ^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `downcast_ref` + | ------------ ^^^^^^^^ cannot satisfy `fn(_) -> _: 'static` + | | + | required by a bound introduced by this call + | + = note: required for `fn(_) -> _` to implement `Any` +note: required by a bound in `<(dyn Any + 'static)>::downcast_ref` + --> $SRC_DIR/core/src/any.rs:LL:COL error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/inference/issue-80409.compat.stderr b/tests/ui/inference/issue-80409.compat.stderr index 2f3f6cef20926..69046cad6fbd8 100644 --- a/tests/ui/inference/issue-80409.compat.stderr +++ b/tests/ui/inference/issue-80409.compat.stderr @@ -1,20 +1,8 @@ -error[E0277]: the trait bound `usize: Fsm` is not satisfied +error: the type `&mut StateContext<'_, usize>` is not well-formed --> $DIR/issue-80409.rs:36:31 | LL | builder.state().on_entry(|_| {}); - | ^ the trait `Fsm` is not implemented for `usize` - | -help: this trait has no implementations, consider adding one - --> $DIR/issue-80409.rs:26:1 - | -LL | trait Fsm { - | ^^^^^^^^^ -note: required by a bound in `StateContext` - --> $DIR/issue-80409.rs:30:31 - | -LL | struct StateContext<'a, TFsm: Fsm> { - | ^^^ required by this bound in `StateContext` + | ^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/inference/issue-80409.no-compat.stderr b/tests/ui/inference/issue-80409.no-compat.stderr index 2f3f6cef20926..69046cad6fbd8 100644 --- a/tests/ui/inference/issue-80409.no-compat.stderr +++ b/tests/ui/inference/issue-80409.no-compat.stderr @@ -1,20 +1,8 @@ -error[E0277]: the trait bound `usize: Fsm` is not satisfied +error: the type `&mut StateContext<'_, usize>` is not well-formed --> $DIR/issue-80409.rs:36:31 | LL | builder.state().on_entry(|_| {}); - | ^ the trait `Fsm` is not implemented for `usize` - | -help: this trait has no implementations, consider adding one - --> $DIR/issue-80409.rs:26:1 - | -LL | trait Fsm { - | ^^^^^^^^^ -note: required by a bound in `StateContext` - --> $DIR/issue-80409.rs:30:31 - | -LL | struct StateContext<'a, TFsm: Fsm> { - | ^^^ required by this bound in `StateContext` + | ^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/inference/issue-80816.stderr b/tests/ui/inference/issue-80816.stderr index 7230fd042df0f..1acaa32ffb5f6 100644 --- a/tests/ui/inference/issue-80816.stderr +++ b/tests/ui/inference/issue-80816.stderr @@ -12,14 +12,6 @@ LL | impl Access for ArcSwapAny { ... LL | impl Access for ArcSwapAny> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: cannot satisfy `> as Access<_>>::Guard == Guard>` -note: required for `Arc>>` to implement `Access<_>` - --> $DIR/issue-80816.rs:31:45 - | -LL | impl, P: Deref> Access for P { - | --------- ^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here help: try using a fully qualified path to specify the expected types | LL - let guard: Guard> = s.load(); diff --git a/tests/ui/inference/multiple-impl-apply.stderr b/tests/ui/inference/multiple-impl-apply.stderr index b45ca48e62268..ede6ee3b86291 100644 --- a/tests/ui/inference/multiple-impl-apply.stderr +++ b/tests/ui/inference/multiple-impl-apply.stderr @@ -1,18 +1,9 @@ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/multiple-impl-apply.rs:34:9 | LL | let y = x.into(); - | ^ ---- type must be known at this point + | ^ | -note: multiple `impl`s satisfying `_: From` found - --> $DIR/multiple-impl-apply.rs:14:1 - | -LL | impl From for Bar { - | ^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl From for Foo { - | ^^^^^^^^^^^^^^^^^^^^^^ - = note: required for `Baz` to implement `Into<_>` help: consider giving `y` an explicit type | LL | let y: /* Type */ = x.into(); diff --git a/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr index 14d671f80e095..ff668f88d4d15 100644 --- a/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr +++ b/tests/ui/inference/need_type_info/issue-107745-avoid-expr-from-macro-expansion.stderr @@ -2,12 +2,7 @@ error[E0282]: type annotations needed --> $DIR/issue-107745-avoid-expr-from-macro-expansion.rs:17:22 | LL | println!("{:?}", []); - | ---- ^^ cannot infer type - | | - | required by this formatting parameter - | - = note: the type must also implement `Debug` - = note: required for `[_; 0]` to implement `Debug` + | ^^ cannot infer type error: aborting due to 1 previous error diff --git a/tests/ui/inference/note-and-explain-ReVar-124973.stderr b/tests/ui/inference/note-and-explain-ReVar-124973.stderr index 3ba76eb2ece18..075ec7327e30d 100644 --- a/tests/ui/inference/note-and-explain-ReVar-124973.stderr +++ b/tests/ui/inference/note-and-explain-ReVar-124973.stderr @@ -5,12 +5,11 @@ LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, _: ...) | ^^^^^ `async` because of this ^^^^^^ C-variadic because of this error[E0700]: hidden type for `impl Future` captures lifetime that does not appear in bounds - --> $DIR/note-and-explain-ReVar-124973.rs:3:76 + --> $DIR/note-and-explain-ReVar-124973.rs:3:1 | LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, _: ...) {} - | ---------------------------------------------------------------------------^^ - | | | - | | opaque type defined here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- opaque type defined here + | | | hidden type `{async fn body of multiple_named_lifetimes<'a, 'b>()}` captures the anonymous lifetime as defined here error: aborting due to 2 previous errors diff --git a/tests/ui/inference/question-mark-type-inference-in-chain.stderr b/tests/ui/inference/question-mark-type-inference-in-chain.stderr index 5c0a739f4e6b0..02a911c524756 100644 --- a/tests/ui/inference/question-mark-type-inference-in-chain.stderr +++ b/tests/ui/inference/question-mark-type-inference-in-chain.stderr @@ -37,6 +37,14 @@ LL | let mut tags = lines.iter().map(|e| parse(e)).collect::>()?; | = help: the nightly-only, unstable trait `Try` is not implemented for `Vec>` +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/question-mark-type-inference-in-chain.rs:60:20 + | +LL | pub fn error3(lines: &[&str]) -> Result> { + | ----------------------------------------------------- this function should return `Result` or `Option` to accept `?` +LL | let mut tags = lines.iter().map(|e| parse(e)).collect::>()?; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `Vec>` + warning: method call on a diverging inference variable --> $DIR/question-mark-type-inference-in-chain.rs:66:10 | @@ -65,21 +73,10 @@ help: the trait `FromIterator>` is not implemented for `std::re but trait `FromIterator>` is implemented for it --> $SRC_DIR/core/src/result.rs:LL:COL = help: for that trait implementation, expected `AnotherError`, found `Error` -note: the method call chain might not have had the expected associated types - --> $DIR/question-mark-type-inference-in-chain.rs:82:10 - | -LL | let mut tags = lines - | ----- this expression has type `&[&str]` -LL | -LL | .iter() - | ------ `Iterator::Item` is `&&str` here -LL | -LL | .map(|e| parse(e)) - | ^^^^^^^^^^^^^^^^^ `Iterator::Item` changed to `Result` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error: aborting due to 5 previous errors; 2 warnings emitted +error: aborting due to 6 previous errors; 2 warnings emitted Some errors have detailed explanations: E0277, E0283, E0599. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/infinite/infinite-autoderef.stderr b/tests/ui/infinite/infinite-autoderef.stderr index 7770cc8a72047..bbfc6c669b160 100644 --- a/tests/ui/infinite/infinite-autoderef.stderr +++ b/tests/ui/infinite/infinite-autoderef.stderr @@ -1,8 +1,10 @@ -error[E0275]: overflow assigning `Box<_>` to `_` +error[E0275]: overflow assigning `Box>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `Box>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/infinite-autoderef.rs:16:22 | LL | x = Box::new(x); | ^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_autoderef`) error: aborting due to 1 previous error diff --git a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr index 0167841cce689..537cfddc12a43 100644 --- a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr +++ b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr @@ -1,87 +1,3 @@ -error: reached the recursion limit finding the struct tail for `[u8; 256]` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - -error: reached the recursion limit finding the struct tail for `[u8; 256]` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: reached the recursion limit finding the struct tail for `[u8; 256]` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: reached the recursion limit finding the struct tail for `[u8; 256]` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -note: the above error was encountered while instantiating `fn virtualize_my_trait::>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:38:18 - | -LL | unsafe { virtualize_my_trait(L, self) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the full name for the type has been written to '$TEST_BUILD_DIR/infinite-instantiation-struct-tail-ice-114484.long-type-$LONG_TYPE_HASH.txt' - = note: consider using `--verbose` to print the full type name to the console - -error: reached the recursion limit finding the struct tail for `SomeData<256>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - -error: reached the recursion limit finding the struct tail for `SomeData<256>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: reached the recursion limit finding the struct tail for `SomeData<256>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: reached the recursion limit finding the struct tail for `SomeData<256>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -note: the above error was encountered while instantiating `fn virtualize_my_trait::>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:38:18 - | -LL | unsafe { virtualize_my_trait(L, self) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the full name for the type has been written to '$TEST_BUILD_DIR/infinite-instantiation-struct-tail-ice-114484.long-type-$LONG_TYPE_HASH.txt' - = note: consider using `--verbose` to print the full type name to the console - -error: reached the recursion limit finding the struct tail for `VirtualWrapper, 0>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - -error: reached the recursion limit finding the struct tail for `VirtualWrapper, 0>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: reached the recursion limit finding the struct tail for `VirtualWrapper, 0>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: reached the recursion limit finding the struct tail for `VirtualWrapper, 0>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -note: the above error was encountered while instantiating `fn virtualize_my_trait::>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:38:18 - | -LL | unsafe { virtualize_my_trait(L, self) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: the full name for the type has been written to '$TEST_BUILD_DIR/infinite-instantiation-struct-tail-ice-114484.long-type-$LONG_TYPE_HASH.txt' - = note: consider using `--verbose` to print the full type name to the console - error: reached the recursion limit while instantiating ` as MyTrait>::virtualize` | note: ` as MyTrait>::virtualize` defined here @@ -92,5 +8,5 @@ LL | fn virtualize(&self) -> &dyn MyTrait { = note: the full name for the type has been written to '$TEST_BUILD_DIR/infinite-instantiation-struct-tail-ice-114484.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: aborting due to 13 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr index c7adc3af02fab..8375055929ce8 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr @@ -1,26 +1,20 @@ -error[E0275]: overflow normalizing the type alias `X2` +error[E0275]: overflow evaluating the requirement `X2 == _` --> $DIR/infinite-type-alias-mutual-recursion.rs:12:1 | LL | type X1 = X2; | ^^^^^^^ - | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow normalizing the type alias `X3` +error[E0275]: overflow evaluating the requirement `X3 == _` --> $DIR/infinite-type-alias-mutual-recursion.rs:16:1 | LL | type X2 = X3; | ^^^^^^^ - | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead -error[E0275]: overflow normalizing the type alias `X1` +error[E0275]: overflow evaluating the requirement `X1 == _` --> $DIR/infinite-type-alias-mutual-recursion.rs:19:1 | LL | type X3 = X1; | ^^^^^^^ - | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead error: aborting due to 3 previous errors diff --git a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr index 3e07a46ea2684..af47dbbce2d06 100644 --- a/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr +++ b/tests/ui/infinite/infinite-vec-type-recursion.feature.stderr @@ -1,11 +1,21 @@ -error[E0275]: overflow normalizing the type alias `X` +error[E0275]: overflow evaluating the requirement `X == _` --> $DIR/infinite-vec-type-recursion.rs:6:1 | LL | type X = Vec; | ^^^^^^ + +error[E0275]: overflow evaluating whether `Vec` is well-formed + --> $DIR/infinite-vec-type-recursion.rs:6:1 + | +LL | type X = Vec; + | ^^^^^^ + +error[E0275]: overflow evaluating the requirement `X == _` + --> $DIR/infinite-vec-type-recursion.rs:11:20 | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead +LL | fn main() { let b: X = Vec::new(); } + | ^ -error: aborting due to 1 previous error +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/inline-const/const-expr-generic-err2.stderr b/tests/ui/inline-const/const-expr-generic-err2.stderr index c6d77593c46ff..36f1056886292 100644 --- a/tests/ui/inline-const/const-expr-generic-err2.stderr +++ b/tests/ui/inline-const/const-expr-generic-err2.stderr @@ -1,10 +1,14 @@ -error: constant expression depends on a generic parameter - --> $DIR/const-expr-generic-err2.rs:2:19 +error[E0282]: type annotations needed for `[u8; _]` + --> $DIR/const-expr-generic-err2.rs:2:9 | LL | let _ = [0u8; const { std::mem::size_of::() }]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ --- type must be known at this point | - = note: this may fail depending on what value the parameter takes +help: consider giving this pattern a type, where the placeholders `_` are specified + | +LL | let _: [_; _] = [0u8; const { std::mem::size_of::() }]; + | ++++++++ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr index 7880dfa36a8f4..a371970dc98b9 100644 --- a/tests/ui/intrinsics/const-eval-select-bad.stderr +++ b/tests/ui/intrinsics/const-eval-select-bad.stderr @@ -46,25 +46,19 @@ LL | const_eval_select((1,), foo, bar); note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(bool)` closure, found `fn(i32) -> i32 {foo}` --> $DIR/const-eval-select-bad.rs:34:32 | -LL | const fn foo(n: i32) -> i32 { - | --------------------------- found signature defined here -... LL | const_eval_select((true,), foo, baz); - | ----------------- ^^^ expected due to this + | ----------------- ^^^ expected an `FnOnce(bool)` closure, found `fn(i32) -> i32 {foo}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(bool) -> _` - found function signature `fn(i32) -> _` + = help: the trait `FnOnce(bool)` is not implemented for fn item `fn(i32) -> i32 {foo}` + = note: expected a closure with signature `fn(bool)` + found a closure with signature `fn(i32)` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | const_eval_select((true,), |arg0: bool| foo(/* i32 */), baz); - | ++++++++++++ +++++++++++ error[E0277]: the trait bound `fn(i32) -> bool {bar}: const FnOnce(i32)` is not satisfied --> $DIR/const-eval-select-bad.rs:39:29 @@ -79,5 +73,5 @@ note: required by a bound in `const_eval_select` error: aborting due to 6 previous errors -Some errors have detailed explanations: E0271, E0277, E0631. +Some errors have detailed explanations: E0271, E0277. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/iterators/generator_returned_from_fn.stderr b/tests/ui/iterators/generator_returned_from_fn.stderr index f4620b958f0c6..4822360aea0d2 100644 --- a/tests/ui/iterators/generator_returned_from_fn.stderr +++ b/tests/ui/iterators/generator_returned_from_fn.stderr @@ -1,4 +1,4 @@ -error[E0515]: cannot return reference to function parameter `a` +error[E0597]: `a` does not live long enough --> $DIR/generator_returned_from_fn.rs:25:13 | LL | iter! { || { @@ -8,35 +8,27 @@ LL | | for x in 5..10 { LL | | yield x * 2; LL | | } LL | | } } - | |_____^ returns a reference to data owned by the current function + | |_____^ borrowed value does not live long enough +LL | } + | - + | | + | `a` dropped here while still borrowed + | borrow later used here error: gen closure does not implement `Fn` because it captures state from its environment --> $DIR/generator_returned_from_fn.rs:34:13 | -LL | iter! { move || { - | _____________-^^^^^^ -LL | | yield *a; -LL | | for x in 5..10 { -LL | | yield x * 2; -LL | | } -LL | | } } - | |_____- return type was inferred to be `{gen closure@$DIR/generator_returned_from_fn.rs:34:13: 34:20}` here +LL | iter! { move || { + | ^^^^^^^ error[E0700]: hidden type for `impl FnOnce() -> impl Iterator` captures lifetime that does not appear in bounds - --> $DIR/generator_returned_from_fn.rs:43:13 + --> $DIR/generator_returned_from_fn.rs:42:1 | -LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { - | ---- ------------------------------------------ opaque type defined here - | | - | hidden type `{gen closure@...}` captures the anonymous lifetime defined here -LL | iter! { move || { - | _____________^ -LL | | -LL | | -LL | | yield *a; -... | -LL | | } } - | |_____^ +LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^----^^^^^------------------------------------------ + | | | + | | opaque type defined here + | hidden type `{gen closure@...}` captures the anonymous lifetime defined here | help: add a `use<...>` bound to explicitly capture `'_` | @@ -44,20 +36,13 @@ LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator | +++++++++ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds - --> $DIR/generator_returned_from_fn.rs:43:13 + --> $DIR/generator_returned_from_fn.rs:42:1 | -LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { - | ---- ------------------------- opaque type defined here - | | - | hidden type `{gen closure body@...}` captures the anonymous lifetime defined here -LL | iter! { move || { - | _____________^ -LL | | -LL | | -LL | | yield *a; -... | -LL | | } } - | |_____^ +LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^------------------------- + | | | + | | opaque type defined here + | hidden type `{gen closure body@...}` captures the anonymous lifetime defined here | help: add a `use<...>` bound to explicitly capture `'_` | @@ -66,5 +51,5 @@ LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator error: aborting due to 4 previous errors -Some errors have detailed explanations: E0515, E0700. -For more information about an error, try `rustc --explain E0515`. +Some errors have detailed explanations: E0597, E0700. +For more information about an error, try `rustc --explain E0597`. diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.fixed b/tests/ui/iterators/invalid-iterator-chain-fixable.fixed index 81e532a89235b..06b493d588989 100644 --- a/tests/ui/iterators/invalid-iterator-chain-fixable.fixed +++ b/tests/ui/iterators/invalid-iterator-chain-fixable.fixed @@ -2,7 +2,7 @@ use std::collections::hash_set::Iter; use std::collections::HashSet; -fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec where X: Clone { +fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec { let i = i.map(|x| x.clone()); i.collect() //~ ERROR E0277 } @@ -12,7 +12,7 @@ fn main() { let scores = v .iter() .map(|(a, b)| { - a + b + a + b; }); println!("{}", scores.sum::()); //~ ERROR E0277 println!( @@ -20,17 +20,17 @@ fn main() { vec![0, 1] .iter() .map(|x| x * 2) - .map(|x| { x }) + .map(|x| { x; }) .map(|x| { x }) .sum::(), //~ ERROR E0277 ); - println!("{}", vec![0, 1].iter().map(|x| { x }).sum::()); //~ ERROR E0277 + println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); //~ ERROR E0277 let a = vec![0]; let b = a.into_iter(); let c = b.map(|x| x + 1); let d = c.filter(|x| *x > 10 ); let e = d.map(|x| { - x + 1 + x + 1; }); let f = e.filter(|_| false); let g: Vec = f.collect(); //~ ERROR E0277 diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr index f22fc2143edf2..2eea2505fb288 100644 --- a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr @@ -1,8 +1,6 @@ error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&X` --> $DIR/invalid-iterator-chain-fixable.rs:7:7 | -LL | let i = i.map(|x| x.clone()); - | ------- this method call is cloning the reference `&X`, not `X` which doesn't implement `Clone` LL | i.collect() | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` | @@ -10,19 +8,8 @@ help: the trait `FromIterator<&_>` is not implemented for `Vec` but trait `FromIterator<_>` is implemented for it --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = help: for that trait implementation, expected `X`, found `&X` -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-fixable.rs:5:26 - | -LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec { - | ^^^^^^^^^^^ `Iterator::Item` is `&X` here -LL | let i = i.map(|x| x.clone()); - | ------------------ `Iterator::Item` remains `&X` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -help: consider further restricting type parameter `X` - | -LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec where X: Clone { - | ++++++++++++++ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` --> $DIR/invalid-iterator-chain-fixable.rs:17:33 @@ -43,27 +30,9 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-fixable.rs:14:10 - | -LL | let v = vec![(0, 0)]; - | ------------ this expression has type `Vec<({integer}, {integer})>` -LL | let scores = v -LL | .iter() - | ------ `Iterator::Item` is `&({integer}, {integer})` here -LL | .map(|(a, b)| { - | __________^ -LL | | a + b; -LL | | }); - | |__________^ `Iterator::Item` changed to `()` here note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing this semicolon - | -LL - a + b; -LL + a + b - | error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` --> $DIR/invalid-iterator-chain-fixable.rs:25:20 @@ -84,27 +53,9 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-fixable.rs:23:14 - | -LL | vec![0, 1] - | ---------- this expression has type `Vec<{integer}>` -LL | .iter() - | ------ `Iterator::Item` is `&{integer}` here -LL | .map(|x| x * 2) - | -------------- `Iterator::Item` changed to `{integer}` here -LL | .map(|x| { x; }) - | ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here -LL | .map(|x| { x }) - | -------------- `Iterator::Item` remains `()` here note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing this semicolon - | -LL - .map(|x| { x; }) -LL + .map(|x| { x }) - | error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` --> $DIR/invalid-iterator-chain-fixable.rs:27:60 @@ -125,22 +76,9 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-fixable.rs:27:38 - | -LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); - | ---------- ------ ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here - | | | - | | `Iterator::Item` is `&{integer}` here - | this expression has type `Vec<{integer}>` note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing this semicolon - | -LL - println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); -LL + println!("{}", vec![0, 1].iter().map(|x| { x }).sum::()); - | error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `()` --> $DIR/invalid-iterator-chain-fixable.rs:36:25 @@ -152,31 +90,8 @@ help: the trait `FromIterator<()>` is not implemented for `Vec` but trait `FromIterator` is implemented for it --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = help: for that trait implementation, expected `i32`, found `()` -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-fixable.rs:32:15 - | -LL | let a = vec![0]; - | ------- this expression has type `Vec<{integer}>` -LL | let b = a.into_iter(); - | ----------- `Iterator::Item` is `{integer}` here -LL | let c = b.map(|x| x + 1); - | -------------- `Iterator::Item` remains `{integer}` here -LL | let d = c.filter(|x| *x > 10 ); - | -------------------- `Iterator::Item` remains `{integer}` here -LL | let e = d.map(|x| { - | _______________^ -LL | | x + 1; -LL | | }); - | |______^ `Iterator::Item` changed to `()` here -LL | let f = e.filter(|_| false); - | ----------------- `Iterator::Item` remains `()` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -help: consider removing this semicolon - | -LL - x + 1; -LL + x + 1 - | error: aborting due to 5 previous errors diff --git a/tests/ui/iterators/invalid-iterator-chain-in-return-position.stderr b/tests/ui/iterators/invalid-iterator-chain-in-return-position.stderr index 8686ac9830757..9c45a80be2519 100644 --- a/tests/ui/iterators/invalid-iterator-chain-in-return-position.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-in-return-position.stderr @@ -1,52 +1,16 @@ -error[E0271]: expected `foo` to return `i32`, but it returns `()` +error[E0271]: expected `Map>, fn(&mut Vec) {foo}>` to be an iterator that yields `i32`, but it yields `()` --> $DIR/invalid-iterator-chain-in-return-position.rs:10:13 | LL | fn bar() -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `()` -... -LL | x.iter_mut().map(foo) - | --------------------- return type was inferred to be `Map>, for<'a> fn(&'a mut Vec) {foo}>` here - | - = note: required for `Map>, for<'a> fn(&'a mut Vec) {foo}>` to implement `Iterator` -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-in-return-position.rs:16:18 - | -LL | let mut x: Vec> = vec![ - | _______________________________- -LL | | vec![0, 2, 1], -LL | | vec![5, 4, 3], -LL | | ]; - | |_____- this expression has type `Vec>` -LL | x.iter_mut().map(foo) - | ---------- ^^^^^^^^ `Iterator::Item` changed to `()` here - | | - | `Iterator::Item` is `&mut Vec` here -error[E0271]: expected `foo` to return `i32`, but it returns `()` +error[E0271]: expected `Map>, fn(&mut Vec) {foo}>` to be an iterator that yields `i32`, but it yields `()` --> $DIR/invalid-iterator-chain-in-return-position.rs:19:13 | LL | fn baz() -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `()` -... -LL | it - | -- return type was inferred to be `Map>, for<'a> fn(&'a mut Vec) {foo}>` here - | - = note: required for `Map>, for<'a> fn(&'a mut Vec) {foo}>` to implement `Iterator` -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-in-return-position.rs:25:27 - | -LL | let mut x: Vec> = vec![ - | _______________________________- -LL | | vec![0, 2, 1], -LL | | vec![5, 4, 3], -LL | | ]; - | |_____- this expression has type `Vec>` -LL | let it = x.iter_mut().map(foo); - | ---------- ^^^^^^^^ `Iterator::Item` changed to `()` here - | | - | `Iterator::Item` is `&mut Vec` here -error[E0271]: expected `IntoIter` to be an iterator that yields `i32`, but it yields `u32` +error[E0271]: expected `Flatten, {closure@invalid-iterator-chain-in-return-position.rs:32:26}>, {closure@invalid-iterator-chain-in-return-position.rs:32:42}>>` to be an iterator that yields `i32`, but it yields `u32` --> $DIR/invalid-iterator-chain-in-return-position.rs:29:17 | LL | fn chained() -> impl Iterator { diff --git a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr index 82269f6253a36..ee8a3fd6e4e9c 100644 --- a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr @@ -17,14 +17,6 @@ help: `f32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:29 - | -LL | let x = Some(()).iter().map(|()| 1).sum::(); - | -------- ------ ^^^^^^^^^^^ `Iterator::Item` changed to `{integer}` here - | | | - | | `Iterator::Item` is `&()` here - | this expression has type `Option<()>` note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `float_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr index d58fe438a6271..88efe378eb4eb 100644 --- a/tests/ui/iterators/invalid-iterator-chain.stderr +++ b/tests/ui/iterators/invalid-iterator-chain.stderr @@ -1,8 +1,6 @@ error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&X` --> $DIR/invalid-iterator-chain.rs:6:7 | -LL | let i = i.map(|x| x.clone()); - | ------- this method call is cloning the reference `&X`, not `X` which doesn't implement `Clone` LL | i.collect() | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` | @@ -10,19 +8,8 @@ help: the trait `FromIterator<&_>` is not implemented for `Vec` but trait `FromIterator<_>` is implemented for it --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = help: for that trait implementation, expected `X`, found `&X` -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain.rs:4:26 - | -LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec { - | ^^^^^^^^^^^ `Iterator::Item` is `&X` here -LL | let i = i.map(|x| x.clone()); - | ------------------ `Iterator::Item` remains `&X` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -help: consider further restricting type parameter `X` - | -LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec where X: Clone { - | ++++++++++++++ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` --> $DIR/invalid-iterator-chain.rs:15:33 @@ -43,26 +30,9 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain.rs:12:10 - | -LL | let scores = vec![(0, 0)] - | ------------ this expression has type `Vec<({integer}, {integer})>` -LL | .iter() - | ------ `Iterator::Item` is `&({integer}, {integer})` here -LL | .map(|(a, b)| { - | __________^ -LL | | a + b; -LL | | }); - | |__________^ `Iterator::Item` changed to `()` here note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing this semicolon - | -LL - a + b; -LL + a + b - | error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` --> $DIR/invalid-iterator-chain.rs:26:20 @@ -83,33 +53,9 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain.rs:25:14 - | -LL | vec![0, 1] - | ---------- this expression has type `Vec<{integer}>` -LL | .iter() - | ------ `Iterator::Item` is `&{integer}` here -LL | .map(|x| x * 2) - | -------------- `Iterator::Item` changed to `{integer}` here -LL | .map(|x| x as f64) - | ----------------- `Iterator::Item` changed to `f64` here -LL | .map(|x| x as i64) - | ----------------- `Iterator::Item` changed to `i64` here -LL | .filter(|x| *x > 0) - | ------------------ `Iterator::Item` remains `i64` here -LL | .map(|x| { x + 1 }) - | ------------------ `Iterator::Item` remains `i64` here -LL | .map(|x| { x; }) - | ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing this semicolon - | -LL - .map(|x| { x; }) -LL + .map(|x| { x }) - | error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64` --> $DIR/invalid-iterator-chain.rs:36:20 @@ -130,21 +76,6 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain.rs:33:14 - | -LL | vec![0, 1] - | ---------- this expression has type `Vec<{integer}>` -LL | .iter() - | ------ `Iterator::Item` is `&{integer}` here -LL | .map(|x| x * 2) - | -------------- `Iterator::Item` changed to `{integer}` here -LL | .map(|x| x as f64) - | ^^^^^^^^^^^^^^^^^ `Iterator::Item` changed to `f64` here -LL | .filter(|x| *x > 0.0) - | -------------------- `Iterator::Item` remains `f64` here -LL | .map(|x| { x + 1.0 }) - | -------------------- `Iterator::Item` remains `f64` here note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -168,22 +99,9 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain.rs:38:38 - | -LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); - | ---------- ------ ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here - | | | - | | `Iterator::Item` is `&{integer}` here - | this expression has type `Vec<{integer}>` note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider removing this semicolon - | -LL - println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); -LL + println!("{}", vec![0, 1].iter().map(|x| { x }).sum::()); - | error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()` --> $DIR/invalid-iterator-chain.rs:39:46 @@ -204,13 +122,6 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain.rs:39:33 - | -LL | println!("{}", vec![(), ()].iter().sum::()); - | ------------ ^^^^^^ `Iterator::Item` is `&()` here - | | - | this expression has type `Vec<()>` note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -225,31 +136,8 @@ help: the trait `FromIterator<()>` is not implemented for `Vec` but trait `FromIterator` is implemented for it --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = help: for that trait implementation, expected `i32`, found `()` -note: the method call chain might not have had the expected associated types - --> $DIR/invalid-iterator-chain.rs:44:15 - | -LL | let a = vec![0]; - | ------- this expression has type `Vec<{integer}>` -LL | let b = a.into_iter(); - | ----------- `Iterator::Item` is `{integer}` here -LL | let c = b.map(|x| x + 1); - | -------------- `Iterator::Item` remains `{integer}` here -LL | let d = c.filter(|x| *x > 10 ); - | -------------------- `Iterator::Item` remains `{integer}` here -LL | let e = d.map(|x| { - | _______________^ -LL | | x + 1; -LL | | }); - | |______^ `Iterator::Item` changed to `()` here -LL | let f = e.filter(|_| false); - | ----------------- `Iterator::Item` remains `()` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -help: consider removing this semicolon - | -LL - x + 1; -LL + x + 1 - | error: aborting due to 7 previous errors diff --git a/tests/ui/iterators/issue-28098.stderr b/tests/ui/iterators/issue-28098.stderr index a724f03ad4af1..649fa56cbd553 100644 --- a/tests/ui/iterators/issue-28098.stderr +++ b/tests/ui/iterators/issue-28098.stderr @@ -35,6 +35,14 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:9:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:18:28 | @@ -72,6 +80,14 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` -error: aborting due to 8 previous errors +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:22:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + +error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/iterators/iterator-does-not-need-into-iter.stderr b/tests/ui/iterators/iterator-does-not-need-into-iter.stderr index 3d3861e959f82..ec28980b49516 100644 --- a/tests/ui/iterators/iterator-does-not-need-into-iter.stderr +++ b/tests/ui/iterators/iterator-does-not-need-into-iter.stderr @@ -6,7 +6,6 @@ LL | get_iter().foo(); | note: the following trait bounds were not satisfied: `&impl Iterator: Iterator` - `&impl Iterator: Missing` `&mut impl Iterator: Missing` `impl Iterator: Missing` --> $DIR/iterator-does-not-need-into-iter.rs:7:9 diff --git a/tests/ui/iterators/rpit-method-chain-no-ice.stderr b/tests/ui/iterators/rpit-method-chain-no-ice.stderr index 74e33cecf3523..9fd66d0fd3aa7 100644 --- a/tests/ui/iterators/rpit-method-chain-no-ice.stderr +++ b/tests/ui/iterators/rpit-method-chain-no-ice.stderr @@ -3,19 +3,9 @@ error[E0271]: expected `IterMut<'_, u8>` to be an iterator that yields `&mut str | LL | fn has_lifetime(&self) -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&mut str`, found `&mut u8` -LL | -LL | self.0.iter_mut() - | ----------------- return type was inferred to be `std::slice::IterMut<'_, u8>` here | = note: expected mutable reference `&mut str` found mutable reference `&mut u8` -note: the method call chain might not have had the expected associated types - --> $DIR/rpit-method-chain-no-ice.rs:8:16 - | -LL | self.0.iter_mut() - | ------ ^^^^^^^^^^ `Iterator::Item` is `&mut u8` here - | | - | this expression has type `Box<[u8]>` error: aborting due to 1 previous error diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr index b4225a813bd2e..bf05518e785f6 100644 --- a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr +++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr @@ -11,7 +11,7 @@ LL | std::mem::transmute::, Option<&Other>>(None); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `Option<()>` (8 bits) - = note: target type: `Option<&Other>` (unable to determine layout for `Other` because `<() as Trait>::RefTarget` cannot be normalized) + = note: target type: `Option<&Other>` (64 bits) error: aborting due to 2 previous errors diff --git a/tests/ui/layout/unconstrained-param-ice-137308.stderr b/tests/ui/layout/unconstrained-param-ice-137308.stderr index 82cd1217c4903..1dce1bbd836db 100644 --- a/tests/ui/layout/unconstrained-param-ice-137308.stderr +++ b/tests/ui/layout/unconstrained-param-ice-137308.stderr @@ -8,7 +8,7 @@ error[E0282]: type annotations needed --> $DIR/unconstrained-param-ice-137308.rs:18:16 | LL | struct S([u8; ::B]); - | ^^ cannot infer type for type parameter `C` + | ^^ cannot infer type error: the type has an unknown layout --> $DIR/unconstrained-param-ice-137308.rs:18:1 diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr b/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr index b04bf6b99877a..1b2096acc4c2e 100644 --- a/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr +++ b/tests/ui/lazy-type-alias-impl-trait/recursion4.stderr @@ -1,23 +1,27 @@ -error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:11:28 +error[E0282]: type annotations needed for `Vec<_>` + --> $DIR/recursion4.rs:10:9 | -LL | x = std::iter::empty().collect(); - | ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator` +LL | let mut x = foo(false); + | ^^^^^ | - = help: the trait `FromIterator<_>` is not implemented for `Foo` -note: required by a bound in `collect` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + = note: cannot infer type of hidden type of opaque +help: consider giving `x` an explicit type, where the placeholder `_` is specified + | +LL | let mut x: Vec<_> = foo(false); + | ++++++++ -error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:20:28 +error[E0282]: type annotations needed for `Vec<_>` + --> $DIR/recursion4.rs:19:9 + | +LL | let mut x = bar(false); + | ^^^^^ | -LL | x = std::iter::empty().collect(); - | ^^^^^^^ value of type `impl Debug` cannot be built from `std::iter::Iterator` + = note: cannot infer type of hidden type of opaque +help: consider giving `x` an explicit type, where the placeholder `_` is specified | - = help: the trait `FromIterator<_>` is not implemented for `impl Debug` -note: required by a bound in `collect` - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL +LL | let mut x: Vec<_> = bar(false); + | ++++++++ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/lifetimes/elided-lifetime-mismatch-in-self-type.stderr b/tests/ui/lifetimes/elided-lifetime-mismatch-in-self-type.stderr index 920fe850f0ec7..8bd3c21bde998 100644 --- a/tests/ui/lifetimes/elided-lifetime-mismatch-in-self-type.stderr +++ b/tests/ui/lifetimes/elided-lifetime-mismatch-in-self-type.stderr @@ -1,36 +1,32 @@ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/elided-lifetime-mismatch-in-self-type.rs:10:18 | LL | fn say(self: &Pair<&str, isize>) { - | ^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^ | - = note: expected struct `Pair<&_, _>` - found struct `Pair<&_, _>` -note: the anonymous lifetime defined here... +note: lifetime parameter instantiated with the anonymous lifetime defined here --> $DIR/elided-lifetime-mismatch-in-self-type.rs:10:24 | LL | fn say(self: &Pair<&str, isize>) { | ^^^^ -note: ...does not necessarily outlive the anonymous lifetime as defined here +note: but lifetime parameter must outlive the anonymous lifetime as defined here --> $DIR/elided-lifetime-mismatch-in-self-type.rs:7:5 | LL | &str, | ^ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/elided-lifetime-mismatch-in-self-type.rs:10:18 | LL | fn say(self: &Pair<&str, isize>) { - | ^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^ | - = note: expected struct `Pair<&_, _>` - found struct `Pair<&_, _>` -note: the anonymous lifetime as defined here... +note: lifetime parameter instantiated with the anonymous lifetime as defined here --> $DIR/elided-lifetime-mismatch-in-self-type.rs:7:5 | LL | &str, | ^ -note: ...does not necessarily outlive the anonymous lifetime defined here +note: but lifetime parameter must outlive the anonymous lifetime defined here --> $DIR/elided-lifetime-mismatch-in-self-type.rs:10:24 | LL | fn say(self: &Pair<&str, isize>) { @@ -38,4 +34,4 @@ LL | fn say(self: &Pair<&str, isize>) { error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/lifetimes/explicit-self-lifetime-mismatch.stderr b/tests/ui/lifetimes/explicit-self-lifetime-mismatch.stderr index ebd6383cb4de5..43721dcad66ed 100644 --- a/tests/ui/lifetimes/explicit-self-lifetime-mismatch.stderr +++ b/tests/ui/lifetimes/explicit-self-lifetime-mismatch.stderr @@ -1,74 +1,66 @@ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/explicit-self-lifetime-mismatch.rs:11:15 | LL | self: Foo<'b, 'a>, - | ^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^ | - = note: expected struct `Foo<'a, 'b>` - found struct `Foo<'b, 'a>` -note: the lifetime `'b` as defined here... +note: lifetime parameter instantiated with the lifetime `'b` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:9:10 | LL | impl<'a, 'b> Foo<'a, 'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:9:6 | LL | impl<'a, 'b> Foo<'a, 'b> { | ^^ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/explicit-self-lifetime-mismatch.rs:11:15 | LL | self: Foo<'b, 'a>, - | ^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^ | - = note: expected struct `Foo<'a, 'b>` - found struct `Foo<'b, 'a>` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:9:6 | LL | impl<'a, 'b> Foo<'a, 'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined here +note: but lifetime parameter must outlive the lifetime `'b` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:9:10 | LL | impl<'a, 'b> Foo<'a, 'b> { | ^^ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/explicit-self-lifetime-mismatch.rs:29:18 | LL | fn bar(self: &mut Bar) { - | ^^^^^^^^ lifetime mismatch + | ^^^^^^^^ | - = note: expected struct `Bar<'a>` - found struct `Bar<'_>` -note: the anonymous lifetime defined here... +note: lifetime parameter instantiated with the anonymous lifetime defined here --> $DIR/explicit-self-lifetime-mismatch.rs:29:23 | LL | fn bar(self: &mut Bar) { | ^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:28:6 | LL | impl<'a> Bar<'a> { | ^^ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/explicit-self-lifetime-mismatch.rs:29:18 | LL | fn bar(self: &mut Bar) { - | ^^^^^^^^ lifetime mismatch + | ^^^^^^^^ | - = note: expected struct `Bar<'a>` - found struct `Bar<'_>` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:28:6 | LL | impl<'a> Bar<'a> { | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined here +note: but lifetime parameter must outlive the anonymous lifetime defined here --> $DIR/explicit-self-lifetime-mismatch.rs:29:23 | LL | fn bar(self: &mut Bar) { @@ -76,4 +68,4 @@ LL | fn bar(self: &mut Bar) { error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/lifetimes/implicit-lifetime-in-assoc-type-projection.stderr b/tests/ui/lifetimes/implicit-lifetime-in-assoc-type-projection.stderr index 7c06ffd7c1e48..cbfe31ec14407 100644 --- a/tests/ui/lifetimes/implicit-lifetime-in-assoc-type-projection.stderr +++ b/tests/ui/lifetimes/implicit-lifetime-in-assoc-type-projection.stderr @@ -1,26 +1,36 @@ -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements +error[E0478]: lifetime bound not satisfied --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:33 | LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime as defined here... - --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:67 +note: lifetime parameter instantiated with the anonymous lifetime as defined here + --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:18 | LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { - | ^^^^^^^^^ -note: ...but the lifetime must also be valid for the lifetime `'a` as defined here... + | ^ +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:27:6 | LL | impl<'a> Publisher<'a> for MyStruct<'a> { | ^^ -note: ...so that the types are compatible + +error[E0478]: lifetime bound not satisfied --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:33 | LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected ` as Publisher<'_>>` - found ` as Publisher<'_>>` + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:27:6 + | +LL | impl<'a> Publisher<'a> for MyStruct<'a> { + | ^^ +note: but lifetime parameter must outlive the anonymous lifetime as defined here + --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:18 + | +LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { + | ^ error: lifetime may not live long enough --> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:5 @@ -46,6 +56,6 @@ LL | fn subscribe(&mut self, t : Box as Publisher<'1>>::Output>>` | requires that `'1` must outlive `'a` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0803`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/lifetimes/issue-105227.stderr b/tests/ui/lifetimes/issue-105227.stderr index 35c05f2885479..3740b99a3a24b 100644 --- a/tests/ui/lifetimes/issue-105227.stderr +++ b/tests/ui/lifetimes/issue-105227.stderr @@ -1,13 +1,11 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds - --> $DIR/issue-105227.rs:9:5 + --> $DIR/issue-105227.rs:7:1 | LL | fn chars0(v :(& str, &str)) -> impl Iterator { - | ----- -------------------------- opaque type defined here - | | + | ^^^^^^^^^^^^^^-----^^^^^^^^^^^^-------------------------- + | | | + | | opaque type defined here | hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here -LL | -LL | v.0.chars().chain(v.1.chars()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: add a `use<...>` bound to explicitly capture `'_` | @@ -15,15 +13,13 @@ LL | fn chars0(v :(& str, &str)) -> impl Iterator + use<'_> { | +++++++++ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds - --> $DIR/issue-105227.rs:15:5 + --> $DIR/issue-105227.rs:13:1 | LL | fn chars1(v0 : & str, v1 : &str) -> impl Iterator { - | ----- -------------------------- opaque type defined here - | | + | ^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^-------------------------- + | | | + | | opaque type defined here | hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here -LL | -LL | v0.chars().chain(v1.chars()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: add a `use<...>` bound to explicitly capture `'_` | @@ -31,15 +27,13 @@ LL | fn chars1(v0 : & str, v1 : &str) -> impl Iterator + use<'_> { | +++++++++ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds - --> $DIR/issue-105227.rs:21:5 + --> $DIR/issue-105227.rs:19:1 | LL | fn chars2<'b>(v0 : &str, v1 : &'_ str, v2 : &'b str) -> (impl Iterator, &'b str) { - | ---- -------------------------- opaque type defined here - | | + | ^^^^^^^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------^^^^^^^^^^ + | | | + | | opaque type defined here | hidden type `std::iter::Chain, Chars<'_>>` captures the anonymous lifetime defined here -LL | -LL | (v0.chars().chain(v1.chars()), v2) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: add a `use<...>` bound to explicitly capture `'_` | diff --git a/tests/ui/lifetimes/issue-105675.stderr b/tests/ui/lifetimes/issue-105675.stderr index 0c7c8f97de726..d4319d9e63639 100644 --- a/tests/ui/lifetimes/issue-105675.stderr +++ b/tests/ui/lifetimes/issue-105675.stderr @@ -1,107 +1,45 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-105675.rs:5:5 +error[E0277]: expected an `FnOnce(&u32, &u32, u32)` closure, found `{closure@$DIR/issue-105675.rs:4:13: 4:32}` + --> $DIR/issue-105675.rs:5:11 | LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... - --> $DIR/issue-105675.rs:1:18 - | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` -help: consider adding explicit type annotations to the closure's arguments - | -LL | let f = | _: &u32 , y: &u32 , z: u32 | (); - | ++++++ +++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-105675.rs:5:5 - | -LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... - --> $DIR/issue-105675.rs:1:18 - | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding explicit type annotations to the closure's arguments - | -LL | let f = | _: &u32 , y: &u32 , z: u32 | (); - | ++++++ +++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-105675.rs:9:5 - | -LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... - --> $DIR/issue-105675.rs:1:18 - | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let f = | x: &u32, y: _ , z: u32 | (); - | ++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-105675.rs:9:5 - | -LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u32, &'1 u32, u32)>`, for any lifetime `'1`... - --> $DIR/issue-105675.rs:1:18 - | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&u32, &'2 u32, u32)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let f = | x: &u32, y: _ , z: u32 | (); - | ++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-105675.rs:9:5 - | -LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... + | ----- ^ expected an `FnOnce(&u32, &u32, u32)` closure, found `{closure@$DIR/issue-105675.rs:4:13: 4:32}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a, 'b> FnOnce(&'a u32, &'b u32, u32)` is not implemented for closure `{closure@$DIR/issue-105675.rs:4:13: 4:32}` + --> $DIR/issue-105675.rs:4:13 + | +LL | let f = | _ , y: &u32 , z | (); + | ^^^^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 'b> fn(&'a _, &'b _, _)` + found a closure with signature `fn(&_, &_, _)` +note: required by a bound in `thing` --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let f = | x: &u32, y: _ , z: u32 | (); - | ++++++ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-105675.rs:9:5 +error[E0277]: expected an `FnOnce(&u32, &u32, u32)` closure, found `{closure@$DIR/issue-105675.rs:8:13: 8:34}` + --> $DIR/issue-105675.rs:9:11 | LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u32, &'1 u32, u32)>`, for any lifetime `'1`... + | ----- ^ expected an `FnOnce(&u32, &u32, u32)` closure, found `{closure@$DIR/issue-105675.rs:8:13: 8:34}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a, 'b> FnOnce(&'a u32, &'b u32, u32)` is not implemented for closure `{closure@$DIR/issue-105675.rs:8:13: 8:34}` + --> $DIR/issue-105675.rs:8:13 + | +LL | let f = | x, y: _ , z: u32 | (); + | ^^^^^^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a, 'b> fn(&'a _, &'b _, _)` + found a closure with signature `fn(&_, &_, _)` +note: required by a bound in `thing` --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&u32, &'2 u32, u32)>`, for some specific lifetime `'2` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let f = | x: &u32, y: _ , z: u32 | (); - | ++++++ -error: aborting due to 6 previous errors +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/lifetimes/issue-34979.stderr b/tests/ui/lifetimes/issue-34979.stderr index 0877f1548a842..7247cef0c5a76 100644 --- a/tests/ui/lifetimes/issue-34979.stderr +++ b/tests/ui/lifetimes/issue-34979.stderr @@ -1,10 +1,10 @@ -error[E0283]: type annotations needed: cannot satisfy `&'a (): Foo` - --> $DIR/issue-34979.rs:6:13 +error[E0283]: type annotations needed: cannot satisfy `&'static (): Foo` + --> $DIR/issue-34979.rs:7:18 | -LL | &'a (): Foo, - | ^^^ +LL | &'static (): Foo; + | ^^^ | -note: multiple `impl`s or `where` clauses satisfying `&'a (): Foo` found +note: multiple `impl`s or `where` clauses satisfying `&'static (): Foo` found --> $DIR/issue-34979.rs:2:1 | LL | impl<'a, T> Foo for &'a T {} diff --git a/tests/ui/lifetimes/issue-79187-2.stderr b/tests/ui/lifetimes/issue-79187-2.stderr index adc64984a05e9..c1d58e3974ee8 100644 --- a/tests/ui/lifetimes/issue-79187-2.stderr +++ b/tests/ui/lifetimes/issue-79187-2.stderr @@ -1,83 +1,70 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-79187-2.rs:8:5 +error[E0277]: the trait bound `{closure@$DIR/issue-79187-2.rs:8:14: 8:17}: Foo` is not satisfied + --> $DIR/issue-79187-2.rs:8:14 | LL | take_foo(|a| a); - | ^^^^^^^^^^^^^^^ + | -------- ^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call | -note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`... - --> $DIR/issue-79187-2.rs:5:21 - | -LL | fn take_foo(_: impl Foo) {} - | ^^^ required by this bound in `take_foo` - = note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | take_foo(|a: &i32| a); - | ++++++ - -error: implementation of `Fn` is not general enough - --> $DIR/issue-79187-2.rs:8:5 +help: the trait `for<'a> FnOnce(&'a i32)` is not implemented for closure `{closure@$DIR/issue-79187-2.rs:8:14: 8:17}` + --> $DIR/issue-79187-2.rs:8:14 | LL | take_foo(|a| a); - | ^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 i32) -> &i32` must implement `Fn<(&'1 i32,)>`, for any lifetime `'1`... + | ^^^ + = note: expected a closure with signature `for<'a> fn(&'a _)` + found a closure with signature `fn(&_)` +note: required for `{closure@$DIR/issue-79187-2.rs:8:14: 8:17}` to implement `Foo` + --> $DIR/issue-79187-2.rs:3:9 + | +LL | impl Foo for F where F: Fn(&i32) -> &i32 {} + | ^^^ ^ ---- unsatisfied trait bound introduced here +note: required by a bound in `take_foo` --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} | ^^^ required by this bound in `take_foo` - = note: ...but it actually implements `Fn<(&'2 i32,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | take_foo(|a: &i32| a); - | ++++++ -error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:11:5 +error[E0271]: type mismatch resolving `<{closure@issue-79187-2.rs:11:14} as FnOnce<(&i32,)>>::Output == &i32` + --> $DIR/issue-79187-2.rs:11:24 | LL | take_foo(|a: &i32| a); - | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | -------- --------- ^ types differ + | | | + | | this closure + | required by a bound introduced by this call + | +note: required for `{closure@$DIR/issue-79187-2.rs:11:14: 11:23}` to implement `Foo` + --> $DIR/issue-79187-2.rs:3:9 | - = note: expected reference `&_` - found reference `&_` -note: the lifetime requirement is introduced here +LL | impl Foo for F where F: Fn(&i32) -> &i32 {} + | ^^^ ^ ---- unsatisfied trait bound introduced here +note: required by a bound in `take_foo` --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} - | ^^^ - -error: lifetime may not live long enough - --> $DIR/issue-79187-2.rs:11:24 - | -LL | take_foo(|a: &i32| a); - | - - ^ returning this value requires that `'1` must outlive `'2` - | | | - | | return type of closure is &'2 i32 - | let's call the lifetime of this reference `'1` + | ^^^ required by this bound in `take_foo` -error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:14:5 +error[E0271]: type mismatch resolving `<{closure@issue-79187-2.rs:14:14} as FnOnce<(&i32,)>>::Output == &i32` + --> $DIR/issue-79187-2.rs:14:34 | LL | take_foo(|a: &i32| -> &i32 { a }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | -------- ----------------- ^ types differ + | | | + | | this closure + | required by a bound introduced by this call | - = note: expected reference `&_` - found reference `&_` -note: the lifetime requirement is introduced here +note: required for `{closure@$DIR/issue-79187-2.rs:14:14: 14:31}` to implement `Foo` + --> $DIR/issue-79187-2.rs:3:9 + | +LL | impl Foo for F where F: Fn(&i32) -> &i32 {} + | ^^^ ^ ---- unsatisfied trait bound introduced here +note: required by a bound in `take_foo` --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} - | ^^^ - -error: lifetime may not live long enough - --> $DIR/issue-79187-2.rs:14:34 - | -LL | take_foo(|a: &i32| -> &i32 { a }); - | - - ^ returning this value requires that `'1` must outlive `'2` - | | | - | | let's call the lifetime of this reference `'2` - | let's call the lifetime of this reference `'1` + | ^^^ required by this bound in `take_foo` -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/lifetimes/issue-79187.stderr b/tests/ui/lifetimes/issue-79187.stderr index 5e9602f80baf1..1ec5b006f4ecd 100644 --- a/tests/ui/lifetimes/issue-79187.stderr +++ b/tests/ui/lifetimes/issue-79187.stderr @@ -1,37 +1,24 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-79187.rs:5:5 +error[E0277]: expected an `FnOnce(&u32)` closure, found `{closure@$DIR/issue-79187.rs:4:13: 4:16}` + --> $DIR/issue-79187.rs:5:11 | LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... + | ----- ^ expected an `FnOnce(&u32)` closure, found `{closure@$DIR/issue-79187.rs:4:13: 4:16}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> FnOnce(&'a u32)` is not implemented for closure `{closure@$DIR/issue-79187.rs:4:13: 4:16}` + --> $DIR/issue-79187.rs:4:13 + | +LL | let f = |_| (); + | ^^^ + = note: expected a closure with signature `for<'a> fn(&'a _)` + found a closure with signature `fn(&_)` +note: required by a bound in `thing` --> $DIR/issue-79187.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32)) {} | ^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let f = |_: &u32| (); - | ++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-79187.rs:5:5 - | -LL | thing(f); - | ^^^^^^^^ - | -note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... - --> $DIR/issue-79187.rs:1:18 - | -LL | fn thing(x: impl FnOnce(&u32)) {} - | ^^^^^^^^^^^^ required by this bound in `thing` - = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let f = |_: &u32| (); - | ++++++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index 235092e24634b..cc00e546506f6 100644 --- a/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -5,7 +5,7 @@ LL | foo: &'static T | ^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -16,7 +16,7 @@ error[E0309]: the parameter type `K` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:41:33 | LL | fn generic_in_parent<'a, L: X<&'a Nested>>() { - | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested` does not outlive the data it points at + | -- ^^^^^^^^^^^^^^^^ ...so that the type `Nested` will meet its required lifetime bounds | | | the parameter type `K` must be valid for the lifetime `'a` as defined here... | @@ -29,7 +29,7 @@ error[E0309]: the parameter type `M` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:44:36 | LL | fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { - | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested` does not outlive the data it points at + | -- ^^^^^^^^^^^^^^^^ ...so that the type `Nested` will meet its required lifetime bounds | | | the parameter type `M` must be valid for the lifetime `'a` as defined here... | @@ -42,7 +42,7 @@ error[E0309]: the parameter type `K` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:24:19 | LL | fn foo<'a, L: X<&'a Nested>>(); - | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested` does not outlive the data it points at + | -- ^^^^^^^^^^^^^^^^ ...so that the type `Nested` will meet its required lifetime bounds | | | the parameter type `K` must be valid for the lifetime `'a` as defined here... | @@ -55,7 +55,7 @@ error[E0309]: the parameter type `Self` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:28:19 | LL | fn bar<'a, L: X<&'a Nested>>(); - | -- ^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested` does not outlive the data it points at + | -- ^^^^^^^^^^^^^^^^^^^ ...so that the type `Nested` will meet its required lifetime bounds | | | the parameter type `Self` must be valid for the lifetime `'a` as defined here... | @@ -68,7 +68,7 @@ error[E0309]: the parameter type `L` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:32:22 | LL | fn baz<'a, L, M: X<&'a Nested>>() { - | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested` does not outlive the data it points at + | -- ^^^^^^^^^^^^^^^^ ...so that the type `Nested` will meet its required lifetime bounds | | | the parameter type `L` must be valid for the lifetime `'a` as defined here... | diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr index f26d6b8d0be13..1664466df3cb3 100644 --- a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -3,9 +3,6 @@ error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied | LL | fn foo() -> impl Future> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `Result<(), _>` -LL | -LL | Ok(()) - | ------ return type was inferred to be `Result<(), _>` here | help: this trait has no implementations, consider adding one --> $DIR/lifetime-elision-return-type-trait.rs:1:1 diff --git a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr index d9df584bebf73..93692ea42188a 100644 --- a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr +++ b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr @@ -1,73 +1,22 @@ -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/issue_74400.rs:12:5 +error[E0277]: expected an `Fn(&T)` closure, found `fn(&T) -> &T {identity::<&T>}` + --> $DIR/issue_74400.rs:12:13 | LL | f(data, identity) - | ^^^^^^^^^^^^^^^^^ + | - ^^^^^^^^ the trait `for<'a> Fn(&'a T)` is not implemented for `fn(&T) -> &T {identity::<&T>}` | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds + | required by a bound introduced by this call | -help: consider adding an explicit lifetime bound - | -LL | fn g(data: &[T]) { - | +++++++++ - -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/issue_74400.rs:12:5 - | -LL | f(data, identity) - | ^^^^^^^^^^^^^^^^^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit lifetime bound - | -LL | fn g(data: &[T]) { - | +++++++++ - -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/issue_74400.rs:12:5 - | -LL | f(data, identity) - | ^^^^^^^^^^^^^^^^^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit lifetime bound - | -LL | fn g(data: &[T]) { - | +++++++++ - -error: implementation of `Fn` is not general enough - --> $DIR/issue_74400.rs:12:5 - | -LL | f(data, identity) - | ^^^^^^^^^^^^^^^^^ - | -note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `Fn<(&'1 T,)>`, for any lifetime `'1`... + = note: the trait bound `for<'a> fn(&T) -> &T {identity::<&T>}: Fn(&'a T)` is not satisfied +note: required by a bound in `f` --> $DIR/issue_74400.rs:8:34 | LL | fn f(data: &[T], key: impl Fn(&T) -> S) { | ^^^^^^^^^^^ required by this bound in `f` - = note: ...but it actually implements `Fn<(&'2 T,)>`, for some specific lifetime `'2` - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue_74400.rs:12:5 - | -LL | f(data, identity) - | ^^^^^^^^^^^^^^^^^ +help: consider borrowing here | -note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`... - --> $DIR/issue_74400.rs:8:44 - | -LL | fn f(data: &[T], key: impl Fn(&T) -> S) { - | ^ required by this bound in `f` - = note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2` +LL | f(data, &identity) + | + -error: aborting due to 5 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0310`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/lifetimes/lifetime-errors/iterator-next-extra-named-lifetime.stderr b/tests/ui/lifetimes/lifetime-errors/iterator-next-extra-named-lifetime.stderr index c3e1ed6e2641e..0c4dbe5e4e7af 100644 --- a/tests/ui/lifetimes/lifetime-errors/iterator-next-extra-named-lifetime.stderr +++ b/tests/ui/lifetimes/lifetime-errors/iterator-next-extra-named-lifetime.stderr @@ -1,14 +1,15 @@ -error[E0308]: method not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/iterator-next-extra-named-lifetime.rs:10:5 | LL | fn next(&'a mut self) -> Option - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(&mut RepeatMut<'_, _>) -> Option<_>` - found signature `fn(&'a mut RepeatMut<'_, _>) -> Option<_>` -note: the anonymous lifetime as defined here... - --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -note: ...does not necessarily outlive the lifetime `'a` as defined here +note: lifetime parameter instantiated with the anonymous lifetime as defined here + --> $DIR/iterator-next-extra-named-lifetime.rs:10:5 + | +LL | fn next(&'a mut self) -> Option + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/iterator-next-extra-named-lifetime.rs:7:6 | LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { @@ -16,4 +17,4 @@ LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/lifetimes/lifetime-errors/trait-method-return-lifetime-mismatch.stderr b/tests/ui/lifetimes/lifetime-errors/trait-method-return-lifetime-mismatch.stderr index bab0f4c180958..4d1b545882c52 100644 --- a/tests/ui/lifetimes/lifetime-errors/trait-method-return-lifetime-mismatch.stderr +++ b/tests/ui/lifetimes/lifetime-errors/trait-method-return-lifetime-mismatch.stderr @@ -1,36 +1,32 @@ -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/trait-method-return-lifetime-mismatch.rs:9:25 | LL | fn select(&self) -> BufferViewHandle; - | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^ | - = note: expected trait `Resources<'_>` - found trait `Resources<'a>` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/trait-method-return-lifetime-mismatch.rs:7:18 | LL | pub trait Buffer<'a, R: Resources<'a>> { | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined here +note: but lifetime parameter must outlive the anonymous lifetime defined here --> $DIR/trait-method-return-lifetime-mismatch.rs:9:15 | LL | fn select(&self) -> BufferViewHandle; | ^^^^^ -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/trait-method-return-lifetime-mismatch.rs:9:25 | LL | fn select(&self) -> BufferViewHandle; - | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^ | - = note: expected trait `Resources<'_>` - found trait `Resources<'a>` -note: the anonymous lifetime defined here... +note: lifetime parameter instantiated with the anonymous lifetime defined here --> $DIR/trait-method-return-lifetime-mismatch.rs:9:15 | LL | fn select(&self) -> BufferViewHandle; | ^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/trait-method-return-lifetime-mismatch.rs:7:18 | LL | pub trait Buffer<'a, R: Resources<'a>> { @@ -38,4 +34,4 @@ LL | pub trait Buffer<'a, R: Resources<'a>> { error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr b/tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr index ad3500a6ff61d..22a0f3e763bbf 100644 --- a/tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr +++ b/tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.stderr @@ -1,18 +1,30 @@ -error: `impl` item signature doesn't match `trait` item signature +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements --> $DIR/lifetime-mismatch-between-trait-and-impl.rs:6:5 | -LL | trait Foo { +LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/lifetime-mismatch-between-trait-and-impl.rs:2:19 + | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32; - | ------------------------------------------- expected `fn(&'1 i32, &'a i32) -> &'a i32` -... -LL | impl Foo for () { + | ^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/lifetime-mismatch-between-trait-and-impl.rs:6:5 + | LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 i32, &'1 i32) -> &'1 i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but, the lifetime must be valid for the lifetime `'a` as defined here... + --> $DIR/lifetime-mismatch-between-trait-and-impl.rs:2:12 | - = note: expected signature `fn(&'1 i32, &'a i32) -> &'a i32` - found signature `fn(&'1 i32, &'1 i32) -> &'1 i32` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output +LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32; + | ^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/lifetime-mismatch-between-trait-and-impl.rs:6:5 + | +LL | fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/lifetimes/missing-lifetime-in-alias.stderr b/tests/ui/lifetimes/missing-lifetime-in-alias.stderr index b868d4b15a1aa..eaa0a1f6fbe24 100644 --- a/tests/ui/lifetimes/missing-lifetime-in-alias.stderr +++ b/tests/ui/lifetimes/missing-lifetime-in-alias.stderr @@ -28,9 +28,6 @@ LL | type C<'a, 'b> = as Trait<'lifetime>>::Bar; error[E0477]: the type `Impl<'a>` does not fulfill the required lifetime --> $DIR/missing-lifetime-in-alias.rs:16:20 | -LL | type Bar<'b> - | ------------ definition of `Bar` from trait -... LL | type Bar<'b> = &'b (); | ^^^^^^ | @@ -39,10 +36,6 @@ note: type must outlive the lifetime `'b` as defined here | LL | type Bar<'b> = &'b (); | ^^ -help: copy the `where` clause predicates from the trait - | -LL | type Bar<'b> = &'b () where Self: 'b; - | ++++++++++++++ error[E0107]: missing generics for associated type `Trait::Bar` --> $DIR/missing-lifetime-in-alias.rs:27:36 diff --git a/tests/ui/lifetimes/static-impl-obligation.stderr b/tests/ui/lifetimes/static-impl-obligation.stderr index 27751557ab51d..f64c3b2c113d9 100644 --- a/tests/ui/lifetimes/static-impl-obligation.stderr +++ b/tests/ui/lifetimes/static-impl-obligation.stderr @@ -17,31 +17,6 @@ LL | impl MyTrait for dyn ObjectTrait + '_ {} | ^^ = note: but lifetime parameter must outlive the static lifetime -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'_` due to conflicting requirements - --> $DIR/static-impl-obligation.rs:221:22 - | -LL | impl MyTrait for dyn ObjectTrait + '_ {} - | ^^^^^^^^^^^^^^^^^^^^ - | -note: first, the lifetime cannot outlive the anonymous lifetime as defined here... - --> $DIR/static-impl-obligation.rs:221:40 - | -LL | impl MyTrait for dyn ObjectTrait + '_ {} - | ^^ -note: ...so that the types are compatible - --> $DIR/static-impl-obligation.rs:221:22 - | -LL | impl MyTrait for dyn ObjectTrait + '_ {} - | ^^^^^^^^^^^^^^^^^^^^ - = note: expected `` - found `` - = note: but, the lifetime must be valid for the static lifetime... -note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/static-impl-obligation.rs:221:22 - | -LL | impl MyTrait for dyn ObjectTrait + '_ {} - | ^^^^^^^^^^^^^^^^^^^^ - error[E0478]: lifetime bound not satisfied --> $DIR/static-impl-obligation.rs:270:10 | @@ -55,31 +30,6 @@ LL | impl Trait for dyn Foo + '_ { | ^^ = note: but lifetime parameter must outlive the static lifetime -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'_` due to conflicting requirements - --> $DIR/static-impl-obligation.rs:270:20 - | -LL | impl Trait for dyn Foo + '_ { - | ^^^^^^^^^^^^ - | -note: first, the lifetime cannot outlive the anonymous lifetime as defined here... - --> $DIR/static-impl-obligation.rs:270:30 - | -LL | impl Trait for dyn Foo + '_ { - | ^^ -note: ...so that the types are compatible - --> $DIR/static-impl-obligation.rs:270:20 - | -LL | impl Trait for dyn Foo + '_ { - | ^^^^^^^^^^^^ - = note: expected `` - found `` - = note: but, the lifetime must be valid for the static lifetime... -note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/static-impl-obligation.rs:270:20 - | -LL | impl Trait for dyn Foo + '_ { - | ^^^^^^^^^^^^ - error[E0521]: borrowed data escapes outside of function --> $DIR/static-impl-obligation.rs:225:9 | @@ -608,7 +558,7 @@ LL | y.hello(); | `x` escapes the function body here | argument requires that `'a` must outlive `'static` -error: aborting due to 28 previous errors +error: aborting due to 26 previous errors -Some errors have detailed explanations: E0478, E0521, E0637, E0803. +Some errors have detailed explanations: E0478, E0521, E0637. For more information about an error, try `rustc --explain E0478`. diff --git a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr index cfe1e9353316f..ad27a1f0ca605 100644 --- a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr +++ b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr @@ -1,44 +1,57 @@ -error: `impl` item signature doesn't match `trait` item signature +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 | -LL | trait Bar { -LL | fn bar(&self, r: &mut Re); - | -------------------------- expected `fn(&'1 Foo, &'2 mut Re<'3>)` -... -LL | impl Bar for Foo { LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:11:16 + | +LL | fn bar(&self, r: &mut Re); + | ^^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 | - = note: expected signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` - found signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output -note: `Re` here is elided as `Re<'_>` +LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but, the lifetime must be valid for the anonymous lifetime defined here... --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:11:31 | LL | fn bar(&self, r: &mut Re); | ^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 + | +LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `impl` item signature doesn't match `trait` item signature +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 | -LL | trait Bar { -LL | fn bar(&self, r: &mut Re); - | ------------------------------ expected `fn(&'1 Foo, &'2 mut Re<'3, u8>)` -... -LL | impl Bar for Foo { LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1, u8>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` - found signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output -note: `Re` here is elided as `Re<'_, u8>` +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:34:16 + | +LL | fn bar(&self, r: &mut Re); + | ^^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 + | +LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but, the lifetime must be valid for the anonymous lifetime defined here... --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:34:31 | LL | fn bar(&self, r: &mut Re); - | ^^ + | ^^^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 + | +LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/lint/issue-106991.stderr b/tests/ui/lint/issue-106991.stderr index 5c31c240dfff5..3926215398504 100644 --- a/tests/ui/lint/issue-106991.stderr +++ b/tests/ui/lint/issue-106991.stderr @@ -1,22 +1,8 @@ -error[E0271]: expected `foo` to return `i32`, but it returns `()` +error[E0271]: expected `Map>, fn(&mut Vec) {foo}>` to be an iterator that yields `i32`, but it yields `()` --> $DIR/issue-106991.rs:5:13 | LL | fn bar() -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `()` -... -LL | x.iter_mut().map(foo) - | --------------------- return type was inferred to be `Map>, for<'a> fn(&'a mut Vec) {foo}>` here - | - = note: required for `Map>, for<'a> fn(&'a mut Vec) {foo}>` to implement `Iterator` -note: the method call chain might not have had the expected associated types - --> $DIR/issue-106991.rs:8:18 - | -LL | let mut x: Vec> = vec![vec![0, 2, 1], vec![5, 4, 3]]; - | ---------------------------------- this expression has type `Vec>` -LL | x.iter_mut().map(foo) - | ---------- ^^^^^^^^ `Iterator::Item` changed to `()` here - | | - | `Iterator::Item` is `&mut Vec` here error: aborting due to 1 previous error diff --git a/tests/ui/lub-glb/old-lub-glb-object.stderr b/tests/ui/lub-glb/old-lub-glb-object.stderr index c476d6f692b7b..8d08c0f916c90 100644 --- a/tests/ui/lub-glb/old-lub-glb-object.stderr +++ b/tests/ui/lub-glb/old-lub-glb-object.stderr @@ -1,22 +1,13 @@ -error[E0308]: mismatched types +error[E0277]: the trait bound `&dyn for<'a> Foo<&'a u8, &'a u8>: CoerceUnsized<&dyn for<'a, 'b> Foo<&'a u8, &'b u8>>` is not satisfied --> $DIR/old-lub-glb-object.rs:9:14 | LL | _ => y, - | ^ one type is more general than the other + | ^ the nightly-only, unstable trait `Unsize Foo<&'a u8, &'b u8>>` is not implemented for `dyn for<'a> Foo<&'a u8, &'a u8>` | - = note: expected trait object `dyn for<'a, 'b> Foo<&'a u8, &'b u8>` - found trait object `dyn for<'a> Foo<&'a u8, &'a u8>` + = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information + = note: required for `&dyn for<'a> Foo<&'a u8, &'a u8>` to implement `CoerceUnsized<&dyn for<'a, 'b> Foo<&'a u8, &'b u8>>` + = note: required for the cast from `&dyn for<'a> Foo<&'a u8, &'a u8>` to `&dyn for<'a, 'b> Foo<&'a u8, &'b u8>` -error[E0308]: mismatched types - --> $DIR/old-lub-glb-object.rs:9:14 - | -LL | _ => y, - | ^ one type is more general than the other - | - = note: expected trait object `dyn for<'a, 'b> Foo<&'a u8, &'b u8>` - found trait object `dyn for<'a> Foo<&'a u8, &'a u8>` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/macros/return_from_external_macro.stderr b/tests/ui/macros/return_from_external_macro.stderr index 5e65ac6486d62..89450fee3c88c 100644 --- a/tests/ui/macros/return_from_external_macro.stderr +++ b/tests/ui/macros/return_from_external_macro.stderr @@ -2,14 +2,14 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/return_from_external_macro.rs:10:5 | LL | ret_from_ext::foo!() - | ^^^^^^^^^^^^^^^^^^^^ - | | - | creates a temporary value which is freed while still in use - | opaque type requires that borrow lasts for `'static` + | ^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use LL | LL | } - | - temporary value is freed at the end of this statement + | -- borrow later used here + | | + | temporary value is freed at the end of this statement | + = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `ret_from_ext::foo` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0515]: cannot return reference to temporary value diff --git a/tests/ui/marker_trait_attr/unsound-overlap.stderr b/tests/ui/marker_trait_attr/unsound-overlap.stderr index 13498fa4b2202..e23d4aa2257e8 100644 --- a/tests/ui/marker_trait_attr/unsound-overlap.stderr +++ b/tests/ui/marker_trait_attr/unsound-overlap.stderr @@ -1,16 +1,14 @@ -error[E0283]: type annotations needed: cannot satisfy `&str: A` +error[E0275]: overflow evaluating the requirement `&str: A` --> $DIR/unsound-overlap.rs:10:12 | LL | impl A for &str {} | ^^^^ + +error[E0275]: overflow evaluating the requirement `(T,): A` + --> $DIR/unsound-overlap.rs:12:22 | -note: multiple `impl`s satisfying `&str: A` found - --> $DIR/unsound-overlap.rs:9:1 - | -LL | impl A for T {} - | ^^^^^^^^^^^^^^^^^^ -LL | impl A for &str {} - | ^^^^^^^^^^^^^^^ +LL | impl A for (T,) {} + | ^^^^ error[E0119]: conflicting implementations of trait `TraitWithAssoc` for type `((&str,),)` --> $DIR/unsound-overlap.rs:21:1 @@ -21,7 +19,7 @@ LL | impl TraitWithAssoc for T { LL | impl TraitWithAssoc for ((&str,),) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((&str,),)` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0119, E0283. +Some errors have detailed explanations: E0119, E0275. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/methods/filter-relevant-fn-bounds.stderr b/tests/ui/methods/filter-relevant-fn-bounds.stderr index f1676facdb2d4..17c3342df34ed 100644 --- a/tests/ui/methods/filter-relevant-fn-bounds.stderr +++ b/tests/ui/methods/filter-relevant-fn-bounds.stderr @@ -12,13 +12,11 @@ help: consider further restricting type parameter `F` with trait `Output` LL | F: for<'a> FnOnce(>::Type) + for<'a> Output<'a>, | ++++++++++++++++++++ -error[E0277]: expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` - --> $DIR/filter-relevant-fn-bounds.rs:18:34 +error[E0277]: the trait bound `for<'a> {closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}: Output<'a>` is not satisfied + --> $DIR/filter-relevant-fn-bounds.rs:18:5 | LL | wrapper.do_something_wrapper(|value| ()); - | -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` --> $DIR/filter-relevant-fn-bounds.rs:18:34 @@ -30,6 +28,20 @@ help: this trait has no implementations, consider adding one | LL | trait Output<'a> { | ^^^^^^^^^^^^^^^^ + +error[E0277]: expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` + --> $DIR/filter-relevant-fn-bounds.rs:18:34 + | +LL | wrapper.do_something_wrapper(|value| ()); + | -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` + --> $DIR/filter-relevant-fn-bounds.rs:18:34 + | +LL | wrapper.do_something_wrapper(|value| ()); + | ^^^^^^^ note: required by a bound in `Wrapper::do_something_wrapper` --> $DIR/filter-relevant-fn-bounds.rs:11:12 | @@ -39,6 +51,42 @@ LL | fn do_something_wrapper(self, _: F) LL | F: for<'a> FnOnce(>::Type), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper` -error: aborting due to 2 previous errors +error[E0271]: type mismatch resolving `<{closure@filter-relevant-fn-bounds.rs:18:34} as FnOnce<(<{closure@filter-relevant-fn-bounds.rs:18:34} as Output<'a>>::Type,)>>::Output == ()` + --> $DIR/filter-relevant-fn-bounds.rs:18:42 + | +LL | wrapper.do_something_wrapper(|value| ()); + | -------------------- ------- ^^ types differ + | | | + | | this closure + | required by a bound introduced by this call + | +note: required by a bound in `Wrapper::do_something_wrapper` + --> $DIR/filter-relevant-fn-bounds.rs:11:20 + | +LL | impl Wrapper { +LL | fn do_something_wrapper(self, _: F) +... +LL | F: for<'a> FnOnce(>::Type), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper` + +error[E0277]: the trait bound `for<'a> {closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}: Output<'a>` is not satisfied + --> $DIR/filter-relevant-fn-bounds.rs:18:13 + | +LL | wrapper.do_something_wrapper(|value| ()); + | ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` + --> $DIR/filter-relevant-fn-bounds.rs:18:34 + | +LL | wrapper.do_something_wrapper(|value| ()); + | ^^^^^^^ +help: this trait has no implementations, consider adding one + --> $DIR/filter-relevant-fn-bounds.rs:1:1 + | +LL | trait Output<'a> { + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/methods/generic-method-unsatisfied-bound.stderr b/tests/ui/methods/generic-method-unsatisfied-bound.stderr index 48f5565c3e71c..b044d7265c914 100644 --- a/tests/ui/methods/generic-method-unsatisfied-bound.stderr +++ b/tests/ui/methods/generic-method-unsatisfied-bound.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `Params: Plugin` is not satisfied - --> $DIR/generic-method-unsatisfied-bound.rs:24:9 + --> $DIR/generic-method-unsatisfied-bound.rs:24:19 | LL | req.get_ref::(); - | ^^^^^^^ unsatisfied trait bound + | ------- ^^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call | help: the trait `Plugin` is not implemented for `Params` but trait `Plugin` is implemented for it @@ -11,6 +13,12 @@ help: the trait `Plugin` is not implemented for `Params` LL | impl Plugin for Params { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for that trait implementation, expected `Foo`, found `i32` +note: required by a bound in `Pluggable::get_ref` + --> $DIR/generic-method-unsatisfied-bound.rs:11:19 + | +LL | pub trait Pluggable { +LL | fn get_ref>(&mut self) -> Option { + | ^^^^^^^^^^^^ required by this bound in `Pluggable::get_ref` error: aborting due to 1 previous error diff --git a/tests/ui/methods/inherent-bound-in-probe.stderr b/tests/ui/methods/inherent-bound-in-probe.stderr index 71e8e39692267..a16761bb20b74 100644 --- a/tests/ui/methods/inherent-bound-in-probe.stderr +++ b/tests/ui/methods/inherent-bound-in-probe.stderr @@ -12,34 +12,6 @@ LL | struct Helper<'a, T> note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL -error[E0275]: overflow evaluating the requirement `&HashMap<_, _, _, _>: IntoIterator` - --> $DIR/inherent-bound-in-probe.rs:43:9 - | -LL | Helper::new(&self.0) - | ^^^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_bound_in_probe`) -note: required for `&BitReaderWrapper>` to implement `IntoIterator` - --> $DIR/inherent-bound-in-probe.rs:33:13 - | -LL | impl<'a, T> IntoIterator for &'a BitReaderWrapper - | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ -LL | where -LL | &'a T: IntoIterator, - | ------------- unsatisfied trait bound introduced here - = note: 126 redundant requirements hidden - = note: required for `&BitReaderWrapper>>` to implement `IntoIterator` -note: required by a bound in `Helper` - --> $DIR/inherent-bound-in-probe.rs:17:12 - | -LL | struct Helper<'a, T> -LL | where -LL | &'a T: IntoIterator, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Helper` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/inherent-bound-in-probe.long-type-$LONG_TYPE_HASH.txt' - = note: consider using `--verbose` to print the full type name to the console - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0275, E0277. -For more information about an error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr b/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr index 73f5f441b3fef..ae34642fc3cae 100644 --- a/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr +++ b/tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr @@ -28,28 +28,31 @@ error[E0277]: expected an `Fn(bool)` closure, found `Bar` LL | let foo: Box usize> = Box::new(Bar); | ^^^^^^^^^^^^^ expected an `Fn(bool)` closure, found `Bar` | -help: the trait `Fn(bool)` is not implemented for `Bar` +help: within `Bar`, the trait `Fn(bool)` is not implemented for `Bar` --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:15:1 | LL | struct Bar; | ^^^^^^^^^^ +note: required because it appears within the type `Bar` + --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:15:8 + | +LL | struct Bar; + | ^^^ + = note: required for `Box` to implement `CoerceUnsized usize>>` = note: required for the cast from `Box` to `Box usize>` -error[E0599]: `Box usize>` is not an iterator +error[E0599]: the method `take` exists for struct `Box usize>`, but its trait bounds were not satisfied --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:22:9 | LL | foo.take() - | ^^^^ - | | - | this is an associated function, not a method - | `Box usize>` is not an iterator + | ^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter = note: the candidate is defined in an impl for the type `Box` = note: the following trait bounds were not satisfied: `dyn Fn(bool) -> usize: Iterator` which is required by `Box usize>: Iterator` - `Box usize>: Iterator` + `dyn Fn(bool) -> usize: Iterator` which is required by `&mut Box usize>: Iterator` `dyn Fn(bool) -> usize: Iterator` which is required by `&mut dyn Fn(bool) -> usize: Iterator` diff --git a/tests/ui/mismatched_types/E0631.stderr b/tests/ui/mismatched_types/E0631.stderr index dcd66c28e3cfb..85c3551ba4b94 100644 --- a/tests/ui/mismatched_types/E0631.stderr +++ b/tests/ui/mismatched_types/E0631.stderr @@ -1,83 +1,79 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/E0631.rs:7:5 +error[E0277]: expected an `Fn(usize)` closure, found `{closure@$DIR/E0631.rs:7:9: 7:19}` + --> $DIR/E0631.rs:7:9 | LL | foo(|_: isize| {}); - | ^^^^----------^^^^ - | | | - | | found signature defined here - | expected due to this + | --- ^^^^^^^^^^^^^ expected an `Fn(usize)` closure, found `{closure@$DIR/E0631.rs:7:9: 7:19}` + | | + | required by a bound introduced by this call + | +help: the trait `Fn(usize)` is not implemented for closure `{closure@$DIR/E0631.rs:7:9: 7:19}` + --> $DIR/E0631.rs:7:9 | - = note: expected closure signature `fn(usize) -> _` - found closure signature `fn(isize) -> _` +LL | foo(|_: isize| {}); + | ^^^^^^^^^^ + = note: expected a closure with signature `fn(usize)` + found a closure with signature `fn(isize)` note: required by a bound in `foo` --> $DIR/E0631.rs:3:11 | LL | fn foo(_: F) {} | ^^^^^^^^^ required by this bound in `foo` -error[E0631]: type mismatch in closure arguments - --> $DIR/E0631.rs:8:5 +error[E0277]: expected an `Fn(usize)` closure, found `{closure@$DIR/E0631.rs:8:9: 8:19}` + --> $DIR/E0631.rs:8:9 | LL | bar(|_: isize| {}); - | ^^^^----------^^^^ - | | | - | | found signature defined here - | expected due to this + | --- ^^^^^^^^^^^^^ expected an `Fn(usize)` closure, found `{closure@$DIR/E0631.rs:8:9: 8:19}` + | | + | required by a bound introduced by this call + | +help: the trait `Fn(usize)` is not implemented for closure `{closure@$DIR/E0631.rs:8:9: 8:19}` + --> $DIR/E0631.rs:8:9 | - = note: expected closure signature `fn(usize) -> _` - found closure signature `fn(isize) -> _` +LL | bar(|_: isize| {}); + | ^^^^^^^^^^ + = note: expected a closure with signature `fn(usize)` + found a closure with signature `fn(isize)` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | LL | fn bar>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `bar` -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `Fn(usize)` closure, found `fn(u64) {f}` --> $DIR/E0631.rs:9:9 | -LL | fn f(_: u64) {} - | ------------ found signature defined here -... LL | foo(f); - | --- ^ expected due to this + | --- ^ expected an `Fn(usize)` closure, found `fn(u64) {f}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(usize) -> _` - found function signature `fn(u64) -> _` + = help: the trait `Fn(usize)` is not implemented for fn item `fn(u64) {f}` + = note: expected a closure with signature `fn(usize)` + found a closure with signature `fn(u64)` note: required by a bound in `foo` --> $DIR/E0631.rs:3:11 | LL | fn foo(_: F) {} | ^^^^^^^^^ required by this bound in `foo` -help: consider wrapping the function in a closure - | -LL | foo(|arg0: usize| f(/* u64 */)); - | +++++++++++++ +++++++++++ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `Fn(usize)` closure, found `fn(u64) {f}` --> $DIR/E0631.rs:10:9 | -LL | fn f(_: u64) {} - | ------------ found signature defined here -... LL | bar(f); - | --- ^ expected due to this + | --- ^ expected an `Fn(usize)` closure, found `fn(u64) {f}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(usize) -> _` - found function signature `fn(u64) -> _` + = help: the trait `Fn(usize)` is not implemented for fn item `fn(u64) {f}` + = note: expected a closure with signature `fn(usize)` + found a closure with signature `fn(u64)` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | LL | fn bar>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `bar` -help: consider wrapping the function in a closure - | -LL | bar(|arg0: usize| f(/* u64 */)); - | +++++++++++++ +++++++++++ error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/closure-arg-count.stderr b/tests/ui/mismatched_types/closure-arg-count.stderr index e0fcf9beb3c4c..c40e0cfc70010 100644 --- a/tests/ui/mismatched_types/closure-arg-count.stderr +++ b/tests/ui/mismatched_types/closure-arg-count.stderr @@ -47,43 +47,43 @@ LL - [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); LL + [1, 2, 3].sort_by(|tuple, tuple2| panic!()); | -error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:13:5 +error[E0277]: expected an `Fn(usize)` closure, found `{closure@$DIR/closure-arg-count.rs:13:7: 13:9}` + --> $DIR/closure-arg-count.rs:13:7 | LL | f(|| panic!()); - | ^^--^^^^^^^^^^ - | | | - | | takes 0 arguments - | expected closure that takes 1 argument + | - ^^^^^^^^^^^ expected an `Fn(usize)` closure, found `{closure@$DIR/closure-arg-count.rs:13:7: 13:9}` + | | + | required by a bound introduced by this call | +help: the trait `Fn(usize)` is not implemented for closure `{closure@$DIR/closure-arg-count.rs:13:7: 13:9}` + --> $DIR/closure-arg-count.rs:13:7 + | +LL | f(|| panic!()); + | ^^ note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | LL | fn f>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `f` -help: consider changing the closure to take and ignore the expected argument - | -LL | f(|_| panic!()); - | + -error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:15:5 +error[E0277]: expected an `Fn(usize)` closure, found `{closure@$DIR/closure-arg-count.rs:15:9: 15:19}` + --> $DIR/closure-arg-count.rs:15:9 | LL | f( move || panic!()); - | ^^^^----------^^^^^^^^^^ - | | | - | | takes 0 arguments - | expected closure that takes 1 argument + | - ^^^^^^^^^^^^^^^^^^^ expected an `Fn(usize)` closure, found `{closure@$DIR/closure-arg-count.rs:15:9: 15:19}` + | | + | required by a bound introduced by this call | +help: the trait `Fn(usize)` is not implemented for closure `{closure@$DIR/closure-arg-count.rs:15:9: 15:19}` + --> $DIR/closure-arg-count.rs:15:9 + | +LL | f( move || panic!()); + | ^^^^^^^^^^ note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | LL | fn f>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `f` -help: consider changing the closure to take and ignore the expected argument - | -LL | f( move |_| panic!()); - | + error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:18:53 @@ -121,69 +121,72 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i); | | | expected closure that takes a single 2-tuple as argument -error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments +error[E0277]: expected an `FnMut((usize, {integer}))` closure, found `fn() {foo}` --> $DIR/closure-arg-count.rs:24:57 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); - | --- ^^^ expected function that takes a single 2-tuple as argument + | --- ^^^ expected an `FnMut((usize, {integer}))` closure, found `fn() {foo}` | | | required by a bound introduced by this call -... -LL | fn foo() {} - | -------- takes 0 arguments | + = help: the trait `FnMut((usize, {integer}))` is not implemented for fn item `fn() {foo}` + = note: expected a closure taking 0 arguments, but one taking 1 argument was given note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments +error[E0277]: expected an `FnOnce((usize, {integer}))` closure, found `{closure@$DIR/closure-arg-count.rs:26:15: 26:24}` --> $DIR/closure-arg-count.rs:27:57 | -LL | let bar = |i, x, y| i; - | --------- takes 3 distinct arguments LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); - | --- ^^^ expected closure that takes a single 2-tuple as argument + | --- ^^^ expected an `FnOnce((usize, {integer}))` closure, found `{closure@$DIR/closure-arg-count.rs:26:15: 26:24}` | | | required by a bound introduced by this call | +help: the trait `FnOnce((usize, {integer}))` is not implemented for closure `{closure@$DIR/closure-arg-count.rs:26:15: 26:24}` + --> $DIR/closure-arg-count.rs:26:15 + | +LL | let bar = |i, x, y| i; + | ^^^^^^^^^ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments +error[E0277]: expected an `FnMut((usize, {integer}))` closure, found `fn(usize, usize) {qux}` --> $DIR/closure-arg-count.rs:29:57 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux); - | --- ^^^ expected function that takes a single 2-tuple as argument + | --- ^^^ expected an `FnMut((usize, {integer}))` closure, found `fn(usize, usize) {qux}` | | | required by a bound introduced by this call -... -LL | fn qux(x: usize, y: usize) {} - | -------------------------- takes 2 distinct arguments | + = help: the trait `FnMut((usize, {integer}))` is not implemented for fn item `fn(usize, usize) {qux}` + = note: expected a closure taking 2 arguments, but one taking 1 argument was given note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error[E0593]: function is expected to take 1 argument, but it takes 2 arguments +error[E0277]: expected an `FnMut({integer})` closure, found `fn(usize, usize) -> Option {core::num::::checked_add}` --> $DIR/closure-arg-count.rs:32:45 | LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add); - | --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument + | --- ^^^^^^^^^^^^^^^^^^ expected an `FnMut({integer})` closure, found `fn(usize, usize) -> Option {core::num::::checked_add}` | | | required by a bound introduced by this call | + = help: the trait `FnMut({integer})` is not implemented for fn item `fn(usize, usize) -> Option {core::num::::checked_add}` + = note: expected a closure taking 2 arguments, but one taking 1 argument was given note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error[E0593]: function is expected to take 0 arguments, but it takes 1 argument +error[E0277]: expected an `FnOnce()` closure, found `fn(u8) -> Foo {Foo}` --> $DIR/closure-arg-count.rs:35:10 | LL | call(Foo); - | ---- ^^^ expected function that takes 0 arguments + | ---- ^^^ expected an `FnOnce()` closure, found `fn(u8) -> Foo {Foo}` | | | required by a bound introduced by this call -... -LL | struct Foo(u8); - | ---------- takes 1 argument | + = help: the trait `FnOnce()` is not implemented for fn item `fn(u8) -> Foo {Foo}` + = note: wrap the `fn(u8) -> Foo {Foo}` in a closure with no arguments: `|| { /* code */ }` + = note: expected a closure taking 1 argument, but one taking 0 arguments was given note: required by a bound in `call` --> $DIR/closure-arg-count.rs:42:30 | @@ -192,4 +195,5 @@ LL | fn call(_: F) where F: FnOnce() -> R {} error: aborting due to 14 previous errors -For more information about this error, try `rustc --explain E0593`. +Some errors have detailed explanations: E0277, E0593. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed index 1ff52c9e5a38a..0a0abfafc45a2 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed @@ -3,10 +3,10 @@ //@[next] compile-flags: -Znext-solver //@[current] run-rustfix fn main() { - let _ = (-10..=10).find(|x: &i32| x.signum() == 0); + let _ = (-10..=10).find(|x: i32| x.signum() == 0); //[current]~^ ERROR type mismatch in closure arguments //[next]~^^ ERROR: expected an `FnMut(&{integer})` closure, found - let _ = (-10..=10).find(|x: &i32| x.signum() == 0); + let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); //[current]~^ ERROR type mismatch in closure arguments //[next]~^^ ERROR: expected an `FnMut(&{integer})` closure, found } diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr index 15c37059416af..e93be04b15a9b 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -1,95 +1,76 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:3:14 +error[E0277]: expected an `FnMut(&(u32, u32))` closure, found `{closure@$DIR/closure-arg-type-mismatch.rs:3:18: 3:33}` + --> $DIR/closure-arg-type-mismatch.rs:3:18 | LL | a.iter().map(|_: (u32, u32)| 45); - | ^^^ --------------- found signature defined here + | --- ^^^^^^^^^^^^^^^^^^ expected an `FnMut(&(u32, u32))` closure, found `{closure@$DIR/closure-arg-type-mismatch.rs:3:18: 3:33}` | | - | expected due to this + | required by a bound introduced by this call | - = note: expected closure signature `fn(&(_, _)) -> _` - found closure signature `fn((_, _)) -> _` +help: the trait `FnMut(&(u32, u32))` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch.rs:3:18: 3:33}` + --> $DIR/closure-arg-type-mismatch.rs:3:18 + | +LL | a.iter().map(|_: (u32, u32)| 45); + | ^^^^^^^^^^^^^^^ + = note: expected a closure with signature `fn(&(_, _))` + found a closure with signature `fn((_, _))` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -help: consider adjusting the signature so it borrows its argument - | -LL | a.iter().map(|_: &(u32, u32)| 45); - | + -error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:4:14 +error[E0277]: expected an `FnMut(&(u32, u32))` closure, found `{closure@$DIR/closure-arg-type-mismatch.rs:4:18: 4:34}` + --> $DIR/closure-arg-type-mismatch.rs:4:18 | LL | a.iter().map(|_: &(u16, u16)| 45); - | ^^^ ---------------- found signature defined here + | --- ^^^^^^^^^^^^^^^^^^^ expected an `FnMut(&(u32, u32))` closure, found `{closure@$DIR/closure-arg-type-mismatch.rs:4:18: 4:34}` | | - | expected due to this + | required by a bound introduced by this call | - = note: expected closure signature `fn(&(u32, u32)) -> _` - found closure signature `fn(&(u16, u16)) -> _` +help: the trait `FnMut(&(u32, u32))` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch.rs:4:18: 4:34}` + --> $DIR/closure-arg-type-mismatch.rs:4:18 + | +LL | a.iter().map(|_: &(u16, u16)| 45); + | ^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `fn(&(u32, u32))` + found a closure with signature `fn(&(u16, u16))` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:5:14 +error[E0277]: expected an `FnMut(&(u32, u32))` closure, found `{closure@$DIR/closure-arg-type-mismatch.rs:5:18: 5:33}` + --> $DIR/closure-arg-type-mismatch.rs:5:18 | LL | a.iter().map(|_: (u16, u16)| 45); - | ^^^ --------------- found signature defined here + | --- ^^^^^^^^^^^^^^^^^^ expected an `FnMut(&(u32, u32))` closure, found `{closure@$DIR/closure-arg-type-mismatch.rs:5:18: 5:33}` | | - | expected due to this + | required by a bound introduced by this call + | +help: the trait `FnMut(&(u32, u32))` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch.rs:5:18: 5:33}` + --> $DIR/closure-arg-type-mismatch.rs:5:18 | - = note: expected closure signature `fn(&(u32, u32)) -> _` - found closure signature `fn((u16, u16)) -> _` +LL | a.iter().map(|_: (u16, u16)| 45); + | ^^^^^^^^^^^^^^^ + = note: expected a closure with signature `fn(&(u32, u32))` + found a closure with signature `fn((u16, u16))` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -error[E0521]: borrowed data escapes outside of function - --> $DIR/closure-arg-type-mismatch.rs:10:5 +error[E0277]: expected an `Fn(*mut &u32)` closure, found `fn(*mut &'a u32)` + --> $DIR/closure-arg-type-mismatch.rs:10:9 | -LL | fn _test<'a>(f: fn(*mut &'a u32)) { - | -- - `f` is only valid in the function body - | | - | lifetime `'a` defined here LL | baz(f); - | ^^^^^^ + | --- ^ the trait `for<'b> Fn(*mut &'b u32)` is not implemented for `fn(*mut &'a u32)` | | - | `f` escapes the function body here - | argument requires that `'a` must outlive `'static` + | required by a bound introduced by this call | - = note: requirement occurs because of a mutable pointer to `&u32` - = note: mutable pointers are invariant over their type parameter - = help: see for more information about variance -note: due to a current limitation of the type system, this implies a `'static` lifetime - --> $DIR/closure-arg-type-mismatch.rs:8:11 - | -LL | fn baz(_: F) {} - | ^^^^^^^^^^^^^ - -error: implementation of `Fn` is not general enough - --> $DIR/closure-arg-type-mismatch.rs:10:5 - | -LL | baz(f); - | ^^^^^^ - | -note: `fn(*mut &'2 u32)` must implement `Fn<(*mut &'1 u32,)>`, for any lifetime `'1`... + = note: the trait bound `for<'b> fn(*mut &'a u32): Fn(*mut &'b u32)` is not satisfied +note: required by a bound in `baz` --> $DIR/closure-arg-type-mismatch.rs:8:11 | LL | fn baz(_: F) {} | ^^^^^^^^^^^^^ required by this bound in `baz` - = note: ...but it actually implements `Fn<(*mut &'2 u32,)>`, for some specific lifetime `'2` - -error: implementation of `FnOnce` is not general enough - --> $DIR/closure-arg-type-mismatch.rs:10:5 - | -LL | baz(f); - | ^^^^^^ - | -note: `fn(*mut &'2 u32)` must implement `FnOnce<(*mut &'1 u32,)>`, for any lifetime `'1`... - --> $DIR/closure-arg-type-mismatch.rs:8:11 +help: consider borrowing here | -LL | fn baz(_: F) {} - | ^^^^^^^^^^^^^ required by this bound in `baz` - = note: ...but it actually implements `FnOnce<(*mut &'2 u32,)>`, for some specific lifetime `'2` +LL | baz(&f); + | + -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0521, E0631. -For more information about an error, try `rustc --explain E0521`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/closure-ref-114180.stderr b/tests/ui/mismatched_types/closure-ref-114180.stderr index 27649822e694f..68b0cb8dc93e6 100644 --- a/tests/ui/mismatched_types/closure-ref-114180.stderr +++ b/tests/ui/mismatched_types/closure-ref-114180.stderr @@ -1,26 +1,14 @@ -error[E0631]: type mismatch in closure arguments +error[E0271]: type mismatch resolving `<{closure@closure-ref-114180.rs:5:19} as FnOnce<(&({integer},), &({integer},))>>::Output == Ordering` --> $DIR/closure-ref-114180.rs:6:15 | -LL | let compare = |(a,), (e,)| todo!(); - | ------------ found signature defined here LL | v.sort_by(compare); - | ------- ^^^^^^^ expected due to this + | ------- ^^^^^^^ types differ | | | required by a bound introduced by this call | - = note: expected closure signature `for<'a, 'b> fn(&'a ({integer},), &'b ({integer},)) -> _` - found closure signature `fn((_,), (_,)) -> _` note: required by a bound in `slice::::sort_by` --> $SRC_DIR/alloc/src/slice.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | v.sort_by(|arg0, arg1| compare(*arg0, *arg1)); - | ++++++++++++ ++++++++++++++ -help: consider adjusting the signature so it borrows its arguments - | -LL | let compare = |&(a,), &(e,)| todo!(); - | + + error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/mismatched_types/collect-method-type-mismatch-66923.stderr b/tests/ui/mismatched_types/collect-method-type-mismatch-66923.stderr index a789ae0f5494b..4ba295aaaf992 100644 --- a/tests/ui/mismatched_types/collect-method-type-mismatch-66923.stderr +++ b/tests/ui/mismatched_types/collect-method-type-mismatch-66923.stderr @@ -8,13 +8,6 @@ help: the trait `FromIterator<&_>` is not implemented for `Vec` but trait `FromIterator<_>` is implemented for it --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = help: for that trait implementation, expected `f64`, found `&f64` -note: the method call chain might not have had the expected associated types - --> $DIR/collect-method-type-mismatch-66923.rs:9:27 - | -LL | let x1: &[f64] = &v; - | -- this expression has type `&Vec` -LL | let x2: Vec = x1.into_iter().collect(); - | ^^^^^^^^^^^ `Iterator::Item` is `&f64` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL @@ -30,14 +23,6 @@ help: the trait `FromIterator<&_>` is not implemented for `Vec` but trait `FromIterator<_>` is implemented for it --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = help: for that trait implementation, expected `f64`, found `&f64` -note: the method call chain might not have had the expected associated types - --> $DIR/collect-method-type-mismatch-66923.rs:13:17 - | -LL | let x1: &[f64] = &v; - | -- this expression has type `&Vec` -... -LL | let x3 = x1.into_iter().collect::>(); - | ^^^^^^^^^^^ `Iterator::Item` is `&f64` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL diff --git a/tests/ui/mismatched_types/fn-variance-1.stderr b/tests/ui/mismatched_types/fn-variance-1.stderr index ed450d8d81c86..efbcbe886e989 100644 --- a/tests/ui/mismatched_types/fn-variance-1.stderr +++ b/tests/ui/mismatched_types/fn-variance-1.stderr @@ -1,49 +1,37 @@ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(&{integer})` closure, found `for<'a> fn(&'a mut isize) {takes_mut}` --> $DIR/fn-variance-1.rs:11:15 | -LL | fn takes_mut(x: &mut isize) { } - | --------------------------- found signature defined here -... LL | apply(&3, takes_mut); - | ----- ^^^^^^^^^ expected due to this + | ----- ^^^^^^^^^ expected an `FnOnce(&{integer})` closure, found `for<'a> fn(&'a mut isize) {takes_mut}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(&{integer}) -> _` - found function signature `fn(&mut isize) -> _` + = help: the trait `FnOnce(&{integer})` is not implemented for fn item `for<'a> fn(&'a mut isize) {takes_mut}` + = note: expected a closure with signature `fn(&{integer})` + found a closure with signature `fn(&mut isize)` note: required by a bound in `apply` --> $DIR/fn-variance-1.rs:5:37 | LL | fn apply(t: T, f: F) where F: FnOnce(T) { | ^^^^^^^^^ required by this bound in `apply` -help: consider wrapping the function in a closure - | -LL | apply(&3, |x| takes_mut(&mut *x)); - | +++ +++++++++ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(&mut {integer})` closure, found `for<'a> fn(&'a isize) {takes_imm}` --> $DIR/fn-variance-1.rs:15:19 | -LL | fn takes_imm(x: &isize) { } - | ----------------------- found signature defined here -... LL | apply(&mut 3, takes_imm); - | ----- ^^^^^^^^^ expected due to this + | ----- ^^^^^^^^^ expected an `FnOnce(&mut {integer})` closure, found `for<'a> fn(&'a isize) {takes_imm}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(&mut {integer}) -> _` - found function signature `fn(&isize) -> _` + = help: the trait `FnOnce(&mut {integer})` is not implemented for fn item `for<'a> fn(&'a isize) {takes_imm}` + = note: expected a closure with signature `fn(&mut {integer})` + found a closure with signature `fn(&isize)` note: required by a bound in `apply` --> $DIR/fn-variance-1.rs:5:37 | LL | fn apply(t: T, f: F) where F: FnOnce(T) { | ^^^^^^^^^ required by this bound in `apply` -help: consider wrapping the function in a closure - | -LL | apply(&mut 3, |x| takes_imm(&*x)); - | +++ +++++ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/issue-118510.stderr b/tests/ui/mismatched_types/issue-118510.stderr index e8bf92d90478b..5938fced3a315 100644 --- a/tests/ui/mismatched_types/issue-118510.stderr +++ b/tests/ui/mismatched_types/issue-118510.stderr @@ -1,26 +1,20 @@ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(&_)` closure, found `fn(&mut _) -> Sexpr<'_, _> {Sexpr::<'_, _>::Ident}` --> $DIR/issue-118510.rs:8:9 | -LL | Ident(&'a mut S), - | ----- found signature defined here -... LL | map(Sexpr::Ident); - | --- ^^^^^^^^^^^^ expected due to this + | --- ^^^^^^^^^^^^ expected an `FnOnce(&_)` closure, found `fn(&mut _) -> Sexpr<'_, _> {Sexpr::<'_, _>::Ident}` | | | required by a bound introduced by this call | - = note: expected function signature `for<'a> fn(&'a _) -> _` - found function signature `fn(&mut _) -> _` + = help: the trait `for<'a> FnOnce(&'a _)` is not implemented for fn item `fn(&mut _) -> Sexpr<'_, _> {Sexpr::<'_, _>::Ident}` + = note: expected a closure with signature `for<'a> fn(&'a _)` + found a closure with signature `fn(&mut _)` note: required by a bound in `map` --> $DIR/issue-118510.rs:5:19 | LL | fn map T>(f: F) {} | ^^^^^^^^^^^^^^^^^ required by this bound in `map` -help: consider wrapping the function in a closure - | -LL | map(|arg0| Sexpr::Ident(&mut *arg0)); - | ++++++ ++++++++++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/issue-36053-2.stderr b/tests/ui/mismatched_types/issue-36053-2.stderr index 8827be73a5740..9c821d9172bb2 100644 --- a/tests/ui/mismatched_types/issue-36053-2.stderr +++ b/tests/ui/mismatched_types/issue-36053-2.stderr @@ -1,19 +1,20 @@ -error[E0631]: type mismatch in closure arguments - --> $DIR/issue-36053-2.rs:7:32 +error[E0277]: expected an `FnMut(&&str)` closure, found `{closure@$DIR/issue-36053-2.rs:7:39: 7:48}` + --> $DIR/issue-36053-2.rs:7:39 | LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); - | ^^^^^^ --------- found signature defined here + | ------ ^^^^^^^^^^^^^^ expected an `FnMut(&&str)` closure, found `{closure@$DIR/issue-36053-2.rs:7:39: 7:48}` | | - | expected due to this + | required by a bound introduced by this call | - = note: expected closure signature `for<'a> fn(&'a &_) -> _` - found closure signature `fn(&_) -> _` +help: the trait `for<'a> FnMut(&'a &str)` is not implemented for closure `{closure@$DIR/issue-36053-2.rs:7:39: 7:48}` + --> $DIR/issue-36053-2.rs:7:39 + | +LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); + | ^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a &_)` + found a closure with signature `fn(&_)` note: required by a bound in `filter` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL -help: consider adjusting the signature so it borrows its argument - | -LL | once::<&str>("str").fuse().filter(|a: &&str| true).count(); - | + error[E0599]: the method `count` exists for struct `Filter>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>`, but its trait bounds were not satisfied --> $DIR/issue-36053-2.rs:7:55 @@ -21,17 +22,15 @@ error[E0599]: the method `count` exists for struct `Filter("str").fuse().filter(|a: &str| true).count(); | --------- ^^^^^ method cannot be called due to unsatisfied trait bounds | | - | doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool` or `_: FnMut<(&&str,)>` + | doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool` | = note: the following trait bounds were not satisfied: `<{closure@$DIR/issue-36053-2.rs:7:39: 7:48} as FnOnce<(&&str,)>>::Output = bool` which is required by `Filter>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator` - `{closure@$DIR/issue-36053-2.rs:7:39: 7:48}: FnMut<(&&str,)>` - which is required by `Filter>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator` - `Filter>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator` + `<{closure@$DIR/issue-36053-2.rs:7:39: 7:48} as FnOnce<(&&str,)>>::Output = bool` which is required by `&mut Filter>, {closure@$DIR/issue-36053-2.rs:7:39: 7:48}>: Iterator` error: aborting due to 2 previous errors -Some errors have detailed explanations: E0599, E0631. -For more information about an error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0277, E0599. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/issue-47706-trait.stderr b/tests/ui/mismatched_types/issue-47706-trait.stderr index c54a62c5e6f71..2a691a0a4fc94 100644 --- a/tests/ui/mismatched_types/issue-47706-trait.stderr +++ b/tests/ui/mismatched_types/issue-47706-trait.stderr @@ -1,16 +1,16 @@ -error[E0593]: function is expected to take a single 0-tuple as argument, but it takes 2 distinct arguments +error[E0277]: expected an `FnOnce(())` closure, found `for<'a> fn(&'a Self, ()) {::f}` --> $DIR/issue-47706-trait.rs:3:24 | -LL | fn f(&self, _: ()) { - | ------------------ takes 2 distinct arguments LL | None::<()>.map(Self::f); - | --- ^^^^^^^ expected function that takes a single 0-tuple as argument + | --- ^^^^^^^ expected an `FnOnce(())` closure, found `for<'a> fn(&'a Self, ()) {::f}` | | | required by a bound introduced by this call | + = help: the trait `FnOnce(())` is not implemented for fn item `for<'a> fn(&'a Self, ()) {::f}` + = note: expected a closure taking 2 arguments, but one taking 1 argument was given note: required by a bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0593`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/issue-47706.stderr b/tests/ui/mismatched_types/issue-47706.stderr index 12d553225900c..20e3eefa2e0a6 100644 --- a/tests/ui/mismatched_types/issue-47706.stderr +++ b/tests/ui/mismatched_types/issue-47706.stderr @@ -1,28 +1,27 @@ -error[E0593]: function is expected to take 1 argument, but it takes 2 arguments +error[E0277]: expected an `FnOnce(i32)` closure, found `fn(Option, ()) -> Foo {Foo::new}` --> $DIR/issue-47706.rs:11:22 | -LL | pub fn new(foo: Option, _: ()) -> Foo { - | ------------------------------------------ takes 2 arguments -... LL | self.foo.map(Foo::new) - | --- ^^^^^^^^ expected function that takes 1 argument + | --- ^^^^^^^^ expected an `FnOnce(i32)` closure, found `fn(Option, ()) -> Foo {Foo::new}` | | | required by a bound introduced by this call | + = help: the trait `FnOnce(i32)` is not implemented for fn item `fn(Option, ()) -> Foo {Foo::new}` + = note: expected a closure taking 2 arguments, but one taking 1 argument was given note: required by a bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL -error[E0593]: function is expected to take 0 arguments, but it takes 1 argument +error[E0277]: expected an `Fn()` closure, found `fn(i32) -> Qux {Qux::Bar}` --> $DIR/issue-47706.rs:27:9 | -LL | Bar(i32), - | --- takes 1 argument -... LL | foo(Qux::Bar); - | --- ^^^^^^^^ expected function that takes 0 arguments + | --- ^^^^^^^^ expected an `Fn()` closure, found `fn(i32) -> Qux {Qux::Bar}` | | | required by a bound introduced by this call | + = help: the trait `Fn()` is not implemented for fn item `fn(i32) -> Qux {Qux::Bar}` + = note: wrap the `fn(i32) -> Qux {Qux::Bar}` in a closure with no arguments: `|| { /* code */ }` + = note: expected a closure taking 1 argument, but one taking 0 arguments was given note: required by a bound in `foo` --> $DIR/issue-47706.rs:22:8 | @@ -33,4 +32,4 @@ LL | F: Fn(), error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0593`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/issue-75361-mismatched-impl.stderr b/tests/ui/mismatched_types/issue-75361-mismatched-impl.stderr index 09556076d787a..beb69f5fcaf1c 100644 --- a/tests/ui/mismatched_types/issue-75361-mismatched-impl.stderr +++ b/tests/ui/mismatched_types/issue-75361-mismatched-impl.stderr @@ -1,23 +1,26 @@ -error: `impl` item signature doesn't match `trait` item signature +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements --> $DIR/issue-75361-mismatched-impl.rs:18:3 | -LL | pub trait Graph { -... -LL | fn adjacent_edges(&self) -> Box>; - | --------------------------------------------------------------------- expected `fn(&'1 T) -> Box<(dyn MyTrait + 'static)>` -... -LL | impl Graph for T { -... LL | fn adjacent_edges(&self) -> Box + '_> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 T) -> Box<(dyn MyTrait + '1)>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(&'1 T) -> Box<(dyn MyTrait + 'static)>` - found signature `fn(&'1 T) -> Box<(dyn MyTrait + '1)>` -help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - --> $DIR/issue-75361-mismatched-impl.rs:12:55 +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/issue-75361-mismatched-impl.rs:12:21 | LL | fn adjacent_edges(&self) -> Box>; - | ^^^^ consider borrowing this type parameter in the trait + | ^^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/issue-75361-mismatched-impl.rs:18:3 + | +LL | fn adjacent_edges(&self) -> Box + '_> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: but, the lifetime must be valid for the static lifetime... +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/issue-75361-mismatched-impl.rs:18:3 + | +LL | fn adjacent_edges(&self) -> Box + '_> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed index e157826590973..fb920f3f94439 100644 --- a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed +++ b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed @@ -10,18 +10,18 @@ trait Trait {} impl Trait for S {} impl Trait for Y {} -fn foo() -> Box { +fn foo() -> impl Trait { if true { - Box::new(S) + S } else { - Box::new(Y) //~ ERROR `if` and `else` have incompatible types + Y //~ ERROR `if` and `else` have incompatible types } } -fn bar() -> Box { +fn bar() -> impl Trait { match true { - true => Box::new(S), - false => Box::new(Y), //~ ERROR `match` arms have incompatible types + true => S, + false => Y, //~ ERROR `match` arms have incompatible types } } diff --git a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr index 3f58efe19f5b0..1ff1f030520ad 100644 --- a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr +++ b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr @@ -9,18 +9,6 @@ LL | | Y | | ^ expected `S`, found `Y` LL | | } | |_____- `if` and `else` have incompatible types - | -help: you could change the return type to be a boxed trait object - | -LL - fn foo() -> impl Trait { -LL + fn foo() -> Box { - | -help: if you change the return type to expect trait objects, box the returned expressions - | -LL ~ Box::new(S) -LL | } else { -LL ~ Box::new(Y) - | error[E0308]: `match` arms have incompatible types --> $DIR/suggest-boxed-trait-objects-instead-of-impl-trait.rs:24:18 @@ -32,17 +20,6 @@ LL | | false => Y, | | ^ expected `S`, found `Y` LL | | } | |_____- `match` arms have incompatible types - | -help: you could change the return type to be a boxed trait object - | -LL - fn bar() -> impl Trait { -LL + fn bar() -> Box { - | -help: if you change the return type to expect trait objects, box the returned expressions - | -LL ~ true => Box::new(S), -LL ~ false => Box::new(Y), - | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr b/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr index 0b8943898f50b..656b0e01688d5 100644 --- a/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr +++ b/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr @@ -1,28 +1,17 @@ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce({integer})` closure, found `for<'a> fn(&'a i32) -> i32 {deref_int}` --> $DIR/suggest-option-asderef-inference-var.rs:7:56 | -LL | fn deref_int(a: &i32) -> i32 { - | ---------------------------- found signature defined here -... LL | let _has_inference_vars: Option = Some(0).map(deref_int); - | --- ^^^^^^^^^ expected due to this + | --- ^^^^^^^^^ expected an `FnOnce({integer})` closure, found `for<'a> fn(&'a i32) -> i32 {deref_int}` | | | required by a bound introduced by this call | - = note: expected function signature `fn({integer}) -> _` - found function signature `fn(&i32) -> _` + = help: the trait `FnOnce({integer})` is not implemented for fn item `for<'a> fn(&'a i32) -> i32 {deref_int}` + = note: expected a closure with signature `fn({integer})` + found a closure with signature `fn(&i32)` note: required by a bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | let _has_inference_vars: Option = Some(0).map(|a| deref_int(&a)); - | +++ ++++ -help: consider adjusting the signature so it does not borrow its argument - | -LL - fn deref_int(a: &i32) -> i32 { -LL + fn deref_int(a: i32) -> i32 { - | error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr index 14c821b260299..be784f5076acc 100644 --- a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr +++ b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr @@ -1,22 +1,16 @@ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(String)` closure, found `for<'a, 'b> fn(&'a &'b str) -> Option<()> {takes_str_but_too_many_refs}` --> $DIR/suggest-option-asderef-unfixable.rs:24:40 | -LL | fn takes_str_but_too_many_refs(_: &&str) -> Option<()> { - | ------------------------------------------------------ found signature defined here -... LL | let _ = produces_string().and_then(takes_str_but_too_many_refs); - | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected due to this + | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(String)` closure, found `for<'a, 'b> fn(&'a &'b str) -> Option<()> {takes_str_but_too_many_refs}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(String) -> _` - found function signature `fn(&&str) -> _` + = help: the trait `FnOnce(String)` is not implemented for fn item `for<'a, 'b> fn(&'a &'b str) -> Option<()> {takes_str_but_too_many_refs}` + = note: expected a closure with signature `fn(String)` + found a closure with signature `fn(&&str)` note: required by a bound in `Option::::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | let _ = produces_string().and_then(|arg0: String| takes_str_but_too_many_refs(/* &&str */)); - | ++++++++++++++ +++++++++++++ error[E0277]: expected an `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}` --> $DIR/suggest-option-asderef-unfixable.rs:26:40 @@ -43,41 +37,33 @@ LL | let _ = produces_string().and_then(takes_str_but_unsafe); note: required by a bound in `Option::::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL -error[E0593]: function is expected to take 1 argument, but it takes 0 arguments +error[E0277]: expected an `FnOnce(String)` closure, found `fn() -> Option<()> {no_args}` --> $DIR/suggest-option-asderef-unfixable.rs:30:40 | -LL | fn no_args() -> Option<()> { - | -------------------------- takes 0 arguments -... LL | let _ = produces_string().and_then(no_args); - | -------- ^^^^^^^ expected function that takes 1 argument + | -------- ^^^^^^^ expected an `FnOnce(String)` closure, found `fn() -> Option<()> {no_args}` | | | required by a bound introduced by this call | + = help: the trait `FnOnce(String)` is not implemented for fn item `fn() -> Option<()> {no_args}` + = note: expected a closure taking 0 arguments, but one taking 1 argument was given note: required by a bound in `Option::::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(TypeWithoutDeref)` closure, found `for<'a, 'b> fn(&'a &'b str) -> Option<()> {takes_str_but_too_many_refs}` --> $DIR/suggest-option-asderef-unfixable.rs:32:45 | -LL | fn takes_str_but_too_many_refs(_: &&str) -> Option<()> { - | ------------------------------------------------------ found signature defined here -... LL | let _ = Some(TypeWithoutDeref).and_then(takes_str_but_too_many_refs); - | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected due to this + | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(TypeWithoutDeref)` closure, found `for<'a, 'b> fn(&'a &'b str) -> Option<()> {takes_str_but_too_many_refs}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(TypeWithoutDeref) -> _` - found function signature `fn(&&str) -> _` + = help: the trait `FnOnce(TypeWithoutDeref)` is not implemented for fn item `for<'a, 'b> fn(&'a &'b str) -> Option<()> {takes_str_but_too_many_refs}` + = note: expected a closure with signature `fn(TypeWithoutDeref)` + found a closure with signature `fn(&&str)` note: required by a bound in `Option::::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | let _ = Some(TypeWithoutDeref).and_then(|arg0: TypeWithoutDeref| takes_str_but_too_many_refs(/* &&str */)); - | ++++++++++++++++++++++++ +++++++++++++ error: aborting due to 5 previous errors -Some errors have detailed explanations: E0277, E0593, E0631. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/suggest-option-asderef.stderr b/tests/ui/mismatched_types/suggest-option-asderef.stderr index 306c412e9d24d..54e189f243fb0 100644 --- a/tests/ui/mismatched_types/suggest-option-asderef.stderr +++ b/tests/ui/mismatched_types/suggest-option-asderef.stderr @@ -1,99 +1,70 @@ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(String)` closure, found `for<'a> fn(&'a str) -> Option<()> {takes_str}` --> $DIR/suggest-option-asderef.rs:25:52 | -LL | fn takes_str(_: &str) -> Option<()> { - | ----------------------------------- found signature defined here -... LL | let _: Option<()> = produces_string().and_then(takes_str); - | -------- ^^^^^^^^^ expected due to this + | -------- ^^^^^^^^^ expected an `FnOnce(String)` closure, found `for<'a> fn(&'a str) -> Option<()> {takes_str}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(String) -> _` - found function signature `fn(&str) -> _` + = help: the trait `FnOnce(String)` is not implemented for fn item `for<'a> fn(&'a str) -> Option<()> {takes_str}` + = note: expected a closure with signature `fn(String)` + found a closure with signature `fn(&str)` note: required by a bound in `Option::::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | let _: Option<()> = produces_string().and_then(|arg0: String| takes_str(/* &str */)); - | ++++++++++++++ ++++++++++++ help: call `Option::as_deref()` first | LL | let _: Option<()> = produces_string().as_deref().and_then(takes_str); | +++++++++++ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(String)` closure, found `for<'a> fn(&'a str) -> Option<()> {takes_str}` --> $DIR/suggest-option-asderef.rs:29:55 | -LL | fn takes_str(_: &str) -> Option<()> { - | ----------------------------------- found signature defined here -... LL | let _: Option> = produces_string().map(takes_str); - | --- ^^^^^^^^^ expected due to this + | --- ^^^^^^^^^ expected an `FnOnce(String)` closure, found `for<'a> fn(&'a str) -> Option<()> {takes_str}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(String) -> _` - found function signature `fn(&str) -> _` + = help: the trait `FnOnce(String)` is not implemented for fn item `for<'a> fn(&'a str) -> Option<()> {takes_str}` + = note: expected a closure with signature `fn(String)` + found a closure with signature `fn(&str)` note: required by a bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | let _: Option> = produces_string().map(|arg0: String| takes_str(/* &str */)); - | ++++++++++++++ ++++++++++++ help: call `Option::as_deref()` first | LL | let _: Option> = produces_string().as_deref().map(takes_str); | +++++++++++ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(String)` closure, found `for<'a> fn(&'a mut str) -> Option<()> {takes_str_mut}` --> $DIR/suggest-option-asderef.rs:33:55 | -LL | fn takes_str_mut(_: &mut str) -> Option<()> { - | ------------------------------------------- found signature defined here -... LL | let _: Option> = produces_string().map(takes_str_mut); - | --- ^^^^^^^^^^^^^ expected due to this + | --- ^^^^^^^^^^^^^ expected an `FnOnce(String)` closure, found `for<'a> fn(&'a mut str) -> Option<()> {takes_str_mut}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(String) -> _` - found function signature `fn(&mut str) -> _` + = help: the trait `FnOnce(String)` is not implemented for fn item `for<'a> fn(&'a mut str) -> Option<()> {takes_str_mut}` + = note: expected a closure with signature `fn(String)` + found a closure with signature `fn(&mut str)` note: required by a bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | let _: Option> = produces_string().map(|arg0: String| takes_str_mut(/* &mut str */)); - | ++++++++++++++ ++++++++++++++++ help: call `Option::as_deref_mut()` first | LL | let _: Option> = produces_string().as_deref_mut().map(takes_str_mut); | +++++++++++++++ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(String)` closure, found `for<'a> fn(&'a _) -> Option<()> {generic_ref::<_>}` --> $DIR/suggest-option-asderef.rs:39:40 | -LL | fn generic_ref(_: &T) -> Option<()> { - | -------------------------------------- found signature defined here -... LL | let _ = produces_string().and_then(generic_ref); - | -------- ^^^^^^^^^^^ expected due to this + | -------- ^^^^^^^^^^^ expected an `FnOnce(String)` closure, found `for<'a> fn(&'a _) -> Option<()> {generic_ref::<_>}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(String) -> _` - found function signature `fn(&_) -> _` + = help: the trait `FnOnce(String)` is not implemented for fn item `for<'a> fn(&'a _) -> Option<()> {generic_ref::<_>}` + = note: expected a closure with signature `fn(String)` + found a closure with signature `fn(&_)` note: required by a bound in `Option::::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | let _ = produces_string().and_then(|arg0: String| generic_ref(&arg0)); - | ++++++++++++++ +++++++ -help: consider adjusting the signature so it does not borrow its argument - | -LL - fn generic_ref(_: &T) -> Option<()> { -LL + fn generic_ref(_: T) -> Option<()> { - | help: call `Option::as_deref()` first | LL | let _ = produces_string().as_deref().and_then(generic_ref); @@ -101,4 +72,4 @@ LL | let _ = produces_string().as_deref().and_then(generic_ref); error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index d92d5dbd16fad..3f3115ce6173d 100644 --- a/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -1,26 +1,24 @@ -error[E0631]: type mismatch in closure arguments +error[E0277]: expected an `FnMut(isize, isize)` closure, found `{closure@$DIR/unboxed-closures-vtable-mismatch.rs:14:23: 14:52}` --> $DIR/unboxed-closures-vtable-mismatch.rs:16:24 | -LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); - | ----------------------------- found signature defined here -LL | LL | let z = call_it(3, f); - | ------- ^ expected due to this + | ------- ^ expected an `FnMut(isize, isize)` closure, found `{closure@$DIR/unboxed-closures-vtable-mismatch.rs:14:23: 14:52}` | | | required by a bound introduced by this call | - = note: expected closure signature `fn(isize, _) -> _` - found closure signature `fn(usize, _) -> _` +help: the trait `FnMut(isize, isize)` is not implemented for closure `{closure@$DIR/unboxed-closures-vtable-mismatch.rs:14:23: 14:52}` + --> $DIR/unboxed-closures-vtable-mismatch.rs:14:23 + | +LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `fn(isize, _)` + found a closure with signature `fn(usize, _)` note: required by a bound in `call_it` --> $DIR/unboxed-closures-vtable-mismatch.rs:7:15 | LL | fn call_it isize>(y: isize, mut f: F) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` -help: consider wrapping the function in a closure - | -LL | let z = call_it(3, |arg0: isize, arg1: isize| f(/* usize */, arg1)); - | ++++++++++++++++++++++++++ +++++++++++++++++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/modules/issue-107649.stderr b/tests/ui/modules/issue-107649.stderr index d41fcced9be4a..3806af0ec071b 100644 --- a/tests/ui/modules/issue-107649.stderr +++ b/tests/ui/modules/issue-107649.stderr @@ -1,15 +1,8 @@ -error[E0277]: `Dummy` doesn't implement `Debug` +error[E0277]: `&Dummy` doesn't implement `Debug` --> $DIR/issue-107649.rs:105:5 | 105 | dbg!(lib::Dummy); - | ^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `Dummy` - | -help: consider annotating `Dummy` with `#[derive(Debug)]` - --> $DIR/auxiliary/dummy_lib.rs:2:1 - | - 2 + #[derive(Debug)] - 3 | pub struct Dummy; - | + | ^^^^^^^^^^^^^^^^ within `&Dummy`, the trait `Debug` is not implemented for `&Dummy` error: aborting due to 1 previous error diff --git a/tests/ui/moves/unconstrained-impl-param-clone-suggestion.stderr b/tests/ui/moves/unconstrained-impl-param-clone-suggestion.stderr index 9cf17045b0296..29ac34ed4893a 100644 --- a/tests/ui/moves/unconstrained-impl-param-clone-suggestion.stderr +++ b/tests/ui/moves/unconstrained-impl-param-clone-suggestion.stderr @@ -12,6 +12,12 @@ error[E0507]: cannot move out of `*self` which is behind a shared reference | LL | *self | ^^^^^ move occurs because `*self` has type `S`, which does not implement the `Copy` trait + | +help: consider cloning the value if the performance cost is acceptable + | +LL - *self +LL + self.clone() + | error: aborting due to 2 previous errors diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed index 53d9cb20b3de9..a7c89cc7d3a6a 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed @@ -17,12 +17,12 @@ fn duplicate_tup1(t: (T,)) -> ((T,), (T,)) { (t, t) //~ ERROR use of moved value: `t` } -fn duplicate_tup2(t: (A, B)) -> ((A, B), (A, B)) { +fn duplicate_tup2(t: (A, B)) -> ((A, B), (A, B)) { //~^ HELP consider restricting type parameters (t, t) //~ ERROR use of moved value: `t` } -fn duplicate_custom(t: S) -> (S, S) { +fn duplicate_custom(t: S) -> (S, S) { //~^ HELP consider restricting type parameter `T` (t, t) //~ ERROR use of moved value: `t` } @@ -40,14 +40,14 @@ trait A {} trait B {} // Test where bounds are added with different bound placements -fn duplicate_custom_1(t: S) -> (S, S) where { +fn duplicate_custom_1(t: S) -> (S, S) where { //~^ HELP consider restricting type parameter `T` (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom_2(t: S) -> (S, S) where - T: A + Copy + Trait, + T: A + Trait, //~^ HELP consider further restricting { (t, t) //~ ERROR use of moved value: `t` @@ -55,14 +55,14 @@ where fn duplicate_custom_3(t: S) -> (S, S) where - T: A + Copy + Trait, + T: A + Trait, //~^ HELP consider further restricting T: B, { (t, t) //~ ERROR use of moved value: `t` } -fn duplicate_custom_4(t: S) -> (S, S) +fn duplicate_custom_4(t: S) -> (S, S) //~^ HELP consider further restricting where T: B, diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index d69e83cce9a7f..50a404f30979d 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -65,10 +65,10 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameters +help: consider restricting type parameter `A` with trait `Copy` | -LL | fn duplicate_tup2(t: (A, B)) -> ((A, B), (A, B)) { - | ++++++ ++++++ +LL | fn duplicate_tup2(t: (A, B)) -> ((A, B), (A, B)) { + | ++++++ error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:27:9 @@ -81,10 +81,10 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` with traits `Copy` and `Trait` +help: consider restricting type parameter `T` with trait `Trait` | -LL | fn duplicate_custom(t: S) -> (S, S) { - | ++++++++++++++ +LL | fn duplicate_custom(t: S) -> (S, S) { + | +++++++ error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:45:9 @@ -97,10 +97,10 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` with traits `Copy` and `Trait` +help: consider restricting type parameter `T` with trait `Trait` | -LL | fn duplicate_custom_1(t: S) -> (S, S) where { - | ++++++++++++++ +LL | fn duplicate_custom_1(t: S) -> (S, S) where { + | +++++++ error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:53:9 @@ -113,10 +113,10 @@ LL | (t, t) | | | value moved here | -help: consider further restricting type parameter `T` with traits `Copy` and `Trait` +help: consider further restricting type parameter `T` with trait `Trait` | -LL | T: A + Copy + Trait, - | ++++++++++++++ +LL | T: A + Trait, + | +++++++ error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:62:9 @@ -129,10 +129,10 @@ LL | (t, t) | | | value moved here | -help: consider further restricting type parameter `T` with traits `Copy` and `Trait` +help: consider further restricting type parameter `T` with trait `Trait` | -LL | T: A + Copy + Trait, - | ++++++++++++++ +LL | T: A + Trait, + | +++++++ error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:70:9 @@ -145,10 +145,10 @@ LL | (t, t) | | | value moved here | -help: consider further restricting type parameter `T` with traits `Copy` and `Trait` +help: consider further restricting type parameter `T` with trait `Trait` | -LL | fn duplicate_custom_4(t: S) -> (S, S) - | ++++++++++++++ +LL | fn duplicate_custom_4(t: S) -> (S, S) + | +++++++ error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:77:9 diff --git a/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr b/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr index fd9135aa2bf38..e8c5aebb6a4c8 100644 --- a/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr +++ b/tests/ui/never_type/fallback_change/fallback-closure-wrap.stderr @@ -8,6 +8,12 @@ LL | panic!("Can't connect to server."); | = note: expected unit type `()` found type `!` +note: required because it's used within this closure + --> $DIR/fallback-closure-wrap.rs:12:40 + | +LL | let error = Closure::wrap(Box::new(move || { + | ^^^^^^^ + = note: required for `Box<{closure@$DIR/fallback-closure-wrap.rs:12:40: 12:47}>` to implement `CoerceUnsized>` = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:12:40: 12:47}>` to `Box` error: aborting due to 1 previous error diff --git a/tests/ui/never_type/regress/never-as-spec-default-associated-type.stderr b/tests/ui/never_type/regress/never-as-spec-default-associated-type.stderr index f13d27d35f2b3..b2b2c6bdc2e9a 100644 --- a/tests/ui/never_type/regress/never-as-spec-default-associated-type.stderr +++ b/tests/ui/never_type/regress/never-as-spec-default-associated-type.stderr @@ -6,11 +6,11 @@ LL | default type Out = !; | = help: the trait `Iterator` is not implemented for `!` note: required by a bound in `Trait::Out` - --> $DIR/never-as-spec-default-associated-type.rs:9:15 + --> $DIR/never-as-spec-default-associated-type.rs:9:24 | LL | trait Trait { LL | type Out: Iterator; - | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait::Out` + | ^^^^^^^^^^ required by this bound in `Trait::Out` error: aborting due to 1 previous error diff --git a/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr b/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr index aeb0a1394ccca..44bbc6c416089 100644 --- a/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr +++ b/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr @@ -1,20 +1,15 @@ -error: implementation of `Trait` is not general enough +error: higher-ranked lifetime error --> $DIR/closure-malformed-projection-input-issue-102800.rs:18:12 | LL | let _: for<'a> fn(<&'a () as Trait>::Ty) = |_| {}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Trait` is not general enough - | - = note: `&'0 ()` must implement `Trait`, for any lifetime `'0`... - = note: ...but `Trait` is actually implemented for the type `&'static ()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: implementation of `Trait` is not general enough +error: higher-ranked lifetime error --> $DIR/closure-malformed-projection-input-issue-102800.rs:18:12 | LL | let _: for<'a> fn(<&'a () as Trait>::Ty) = |_| {}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Trait` is not general enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `&'0 ()` must implement `Trait`, for any lifetime `'0`... - = note: ...but `Trait` is actually implemented for the type `&'static ()` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/nll/ice-106874.stderr b/tests/ui/nll/ice-106874.stderr index 0b756a1795f8a..4e682b1425d7d 100644 --- a/tests/ui/nll/ice-106874.stderr +++ b/tests/ui/nll/ice-106874.stderr @@ -1,145 +1,155 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/ice-106874.rs:8:5 +error[E0277]: expected an `Fn(&mut V)` closure, found `{closure@$DIR/ice-106874.rs:8:23: 8:32}` + --> $DIR/ice-106874.rs:8:7 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`... - --> $DIR/ice-106874.rs:28:10 - | -LL | struct B(Rc); - | ^ required by this bound in `B` - = note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1` -help: consider adding an explicit type annotation to the closure's argument + | ^ expected an `Fn(&mut V)` closure, found `{closure@$DIR/ice-106874.rs:8:23: 8:32}` | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/ice-106874.rs:8:5 +help: the trait `for<'a> Fn(&'a mut V)` is not implemented for closure `{closure@$DIR/ice-106874.rs:8:23: 8:32}` + --> $DIR/ice-106874.rs:8:23 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`... - --> $DIR/ice-106874.rs:28:10 - | -LL | struct B(Rc); - | ^ required by this bound in `B` - = note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit type annotation to the closure's argument - | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ + | ^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a mut _)` + found a closure with signature `fn(&mut _)` +note: required for `D` to implement `Y` + --> $DIR/ice-106874.rs:44:24 + | +LL | impl Y for D { + | ---------- ^ ^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `C` + --> $DIR/ice-106874.rs:31:13 + | +LL | struct C(T::V); + | ^ required by this bound in `C` -error: higher-ranked subtype error - --> $DIR/ice-106874.rs:8:5 +error[E0277]: expected an `Fn(&mut V)` closure, found `{closure@$DIR/ice-106874.rs:8:23: 8:32}` + --> $DIR/ice-106874.rs:8:16 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/ice-106874.rs:8:5 + | ------ ^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn(&mut V)` closure, found `{closure@$DIR/ice-106874.rs:8:23: 8:32}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> Fn(&'a mut V)` is not implemented for closure `{closure@$DIR/ice-106874.rs:8:23: 8:32}` + --> $DIR/ice-106874.rs:8:23 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a mut _)` + found a closure with signature `fn(&mut _)` +note: required for `D` to implement `Y` + --> $DIR/ice-106874.rs:44:24 + | +LL | impl Y for D { + | ---------- ^ ^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `C::::new` + --> $DIR/ice-106874.rs:32:9 + | +LL | impl C { + | ^ required by this bound in `C::::new` +LL | fn new(_: T) -> Rc { | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: implementation of `FnOnce` is not general enough - --> $DIR/ice-106874.rs:8:7 - | -LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough +error[E0277]: the size for values of type `C>` cannot be known at compilation time + --> $DIR/ice-106874.rs:7:40 | - = note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument +LL | pub fn func(f: F) -> A { + | ^^^^^^^^^ doesn't have a size known at compile-time | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ - -error: implementation of `Fn` is not general enough - --> $DIR/ice-106874.rs:8:7 +help: the trait `Sized` is not implemented for `C>` + --> $DIR/ice-106874.rs:31:1 | -LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough +LL | struct C(T::V); + | ^^^^^^^^^^^^^^ +note: required by an implicit `Sized` bound in `B` + --> $DIR/ice-106874.rs:28:10 | - = note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... - = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument +LL | struct B(Rc); + | ^ required by the implicit `Sized` requirement on this type parameter in `B` +help: consider relaxing the implicit `Sized` restriction | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ +LL | struct B(Rc); + | ++++++++ -error: implementation of `FnOnce` is not general enough - --> $DIR/ice-106874.rs:8:7 +error[E0277]: the size for values of type `C>` cannot be known at compilation time + --> $DIR/ice-106874.rs:8:5 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ doesn't have a size known at compile-time | -note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... - --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL - ::: $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL +help: the trait `Sized` is not implemented for `C>` + --> $DIR/ice-106874.rs:31:1 | - = note: required by this bound in `Rc` - = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument +LL | struct C(T::V); + | ^^^^^^^^^^^^^^ +note: required by an implicit `Sized` bound in `B` + --> $DIR/ice-106874.rs:28:10 + | +LL | struct B(Rc); + | ^ required by the implicit `Sized` requirement on this type parameter in `B` +help: consider relaxing the implicit `Sized` restriction | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ +LL | struct B(Rc); + | ++++++++ -error: implementation of `Fn` is not general enough - --> $DIR/ice-106874.rs:8:7 +error[E0277]: the size for values of type `C>` cannot be known at compilation time + --> $DIR/ice-106874.rs:8:9 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | -note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... - --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL - ::: $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL +help: the trait `Sized` is not implemented for `C>` + --> $DIR/ice-106874.rs:31:1 | - = note: required by this bound in `Rc` - = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument +LL | struct C(T::V); + | ^^^^^^^^^^^^^^ +note: required by a bound in `B` + --> $DIR/ice-106874.rs:28:10 | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ +LL | struct B(Rc); + | ^ required by this bound in `B` -error: implementation of `FnOnce` is not general enough - --> $DIR/ice-106874.rs:8:7 +error[E0277]: the size for values of type `C>` cannot be known at compilation time + --> $DIR/ice-106874.rs:8:5 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: the trait `Sized` is not implemented for `C>` + --> $DIR/ice-106874.rs:31:1 | -note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... +LL | struct C(T::V); + | ^^^^^^^^^^^^^^ +note: required by an implicit `Sized` bound in `B` --> $DIR/ice-106874.rs:28:10 | LL | struct B(Rc); - | ^ required by this bound in `B` - = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument + | ^ required by the implicit `Sized` requirement on this type parameter in `B` +help: consider relaxing the implicit `Sized` restriction | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ +LL | struct B(Rc); + | ++++++++ -error: implementation of `Fn` is not general enough - --> $DIR/ice-106874.rs:8:7 +error[E0277]: the size for values of type `C>` cannot be known + --> $DIR/ice-106874.rs:8:9 | LL | A(B(C::new(D::new(move |st| f(st))))) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... - --> $DIR/ice-106874.rs:28:10 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a known size | -LL | struct B(Rc); - | ^ required by this bound in `B` - = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument +help: the nightly-only, unstable trait `MetaSized` is not implemented for `C>` + --> $DIR/ice-106874.rs:31:1 | -LL | A(B(C::new(D::new(move |st: &mut V| f(st))))) - | ++++++++ +LL | struct C(T::V); + | ^^^^^^^^^^^^^^ +note: required by a bound in `Rc` + --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL -error: aborting due to 10 previous errors +error: aborting due to 7 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/nll/issue-54302-cases.stderr b/tests/ui/nll/issue-54302-cases.stderr index 78acd3d640eef..1e74564d1c749 100644 --- a/tests/ui/nll/issue-54302-cases.stderr +++ b/tests/ui/nll/issue-54302-cases.stderr @@ -1,58 +1,34 @@ -error: implementation of `Foo` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-54302-cases.rs:63:5 | LL | >::ref_foo(a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... - --> $DIR/issue-54302-cases.rs:51:8 - | -LL | trait RefFoo { -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` - = note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` + = note: could not prove `u32: RefFoo` -error: implementation of `Foo` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-54302-cases.rs:69:5 | LL | >::ref_foo(a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`... - --> $DIR/issue-54302-cases.rs:51:8 - | -LL | trait RefFoo { -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` - = note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` + = note: could not prove `i32: RefFoo` -error: implementation of `Foo` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-54302-cases.rs:75:5 | LL | >::ref_foo(a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`... - --> $DIR/issue-54302-cases.rs:51:8 - | -LL | trait RefFoo { -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` - = note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` + = note: could not prove `u64: RefFoo` -error: implementation of `Foo` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-54302-cases.rs:81:5 | LL | >::ref_foo(a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`... - --> $DIR/issue-54302-cases.rs:51:8 - | -LL | trait RefFoo { -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` - = note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` + = note: could not prove `i64: RefFoo` error: aborting due to 4 previous errors diff --git a/tests/ui/nll/issue-54302.stderr b/tests/ui/nll/issue-54302.stderr index a1e2d40142907..67025829aa7e2 100644 --- a/tests/ui/nll/issue-54302.stderr +++ b/tests/ui/nll/issue-54302.stderr @@ -1,11 +1,8 @@ -error: implementation of `Deserialize` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-54302.rs:13:5 | LL | assert_deserialize_owned::<&'static str>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough - | - = note: `&str` must implement `Deserialize<'0>`, for any lifetime `'0`... - = note: ...but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/nll/issue-57843.stderr b/tests/ui/nll/issue-57843.stderr index 386f952c0541d..31d9149c80f31 100644 --- a/tests/ui/nll/issue-57843.stderr +++ b/tests/ui/nll/issue-57843.stderr @@ -1,15 +1,30 @@ -error: implementation of `FnOnce` is not general enough +error[E0277]: the trait bound `for<'a> {closure@$DIR/issue-57843.rs:25:18: 25:21}: ClonableFn<&'a bool>` is not satisfied in `{closure@$DIR/issue-57843.rs:25:18: 25:21}` --> $DIR/issue-57843.rs:25:9 | LL | Foo(Box::new(|_| ())); - | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | ^^^^^^^^^---^^^^ + | | | + | | within this `{closure@$DIR/issue-57843.rs:25:18: 25:21}` + | unsatisfied trait bound | - = note: closure with signature `fn(&'2 bool)` must implement `FnOnce<(&'1 bool,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 bool,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument +help: within `{closure@$DIR/issue-57843.rs:25:18: 25:21}`, the trait `for<'a> ClonableFn<&'a bool>` is not implemented for closure `{closure@$DIR/issue-57843.rs:25:18: 25:21}` + --> $DIR/issue-57843.rs:25:18 | -LL | Foo(Box::new(|_: &'a bool| ())); - | ++++++++++ +LL | Foo(Box::new(|_| ())); + | ^^^ +note: this is a known limitation of the trait solver that will be lifted in the future + --> $DIR/issue-57843.rs:25:9 + | +LL | Foo(Box::new(|_| ())); + | ^^^^^^^^^^^^^^^^ try adding turbofish arguments to this expression to specify the types manually, even if it's redundant +note: required because it's used within this closure + --> $DIR/issue-57843.rs:25:18 + | +LL | Foo(Box::new(|_| ())); + | ^^^ + = note: required for `Box<{closure@$DIR/issue-57843.rs:25:18: 25:21}>` to implement `CoerceUnsized ClonableFn<&'a bool>>>` + = note: required for the cast from `Box<{closure@$DIR/issue-57843.rs:25:18: 25:21}>` to `Box<(dyn for<'a> ClonableFn<&'a bool> + 'static)>` error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/nll/issue-73159-rpit-static.stderr b/tests/ui/nll/issue-73159-rpit-static.stderr index 7c564b84a566c..507b001c896e8 100644 --- a/tests/ui/nll/issue-73159-rpit-static.stderr +++ b/tests/ui/nll/issue-73159-rpit-static.stderr @@ -1,12 +1,12 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds - --> $DIR/issue-73159-rpit-static.rs:8:9 + --> $DIR/issue-73159-rpit-static.rs:7:5 | LL | impl<'a> Foo<'a> { | -- hidden type `Copied>` captures the lifetime `'a` as defined here LL | fn make_it(&self) -> impl Iterator { - | ------------------------ opaque type defined here -LL | self.0.iter().copied() - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^------------------------ + | | + | opaque type defined here | help: add a `use<...>` bound to explicitly capture `'a` | diff --git a/tests/ui/nll/issue-97997.stderr b/tests/ui/nll/issue-97997.stderr index ff08daaeaac07..6e846cb86cd5f 100644 --- a/tests/ui/nll/issue-97997.stderr +++ b/tests/ui/nll/issue-97997.stderr @@ -1,11 +1,16 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-97997.rs:13:5 +error[E0277]: the trait bound `for<'a> fn(&'a u8): Foo` is not satisfied + --> $DIR/issue-97997.rs:13:6 | LL | ::ASSOC; - | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | ^^^^^^^ the trait `Foo` is not implemented for `for<'a> fn(&'a u8)` | - = note: `Foo` would have to be implemented for the type `for<'a> fn(&'a u8)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` +help: the trait `Foo` is not implemented for `for<'a> fn(&'a _)` + but it is implemented for `fn(&_)` + --> $DIR/issue-97997.rs:4:1 + | +LL | impl Foo for fn(T) {} + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr index c9b5eb8230a0f..ca6e036353c16 100644 --- a/tests/ui/nll/missing-universe-cause-issue-114907.stderr +++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr @@ -1,84 +1,24 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/missing-universe-cause-issue-114907.rs:33:5 +error[E0277]: expected an `FnOnce(&())` closure, found `{closure@$DIR/missing-universe-cause-issue-114907.rs:32:20: 32:23}` + --> $DIR/missing-universe-cause-issue-114907.rs:33:12 | LL | accept(callback); - | ^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + | ------ ^^^^^^^^ expected an `FnOnce(&())` closure, found `{closure@$DIR/missing-universe-cause-issue-114907.rs:32:20: 32:23}` + | | + | required by a bound introduced by this call + | +help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/missing-universe-cause-issue-114907.rs:32:20: 32:23}` + --> $DIR/missing-universe-cause-issue-114907.rs:32:20 + | +LL | let callback = |_| {}; + | ^^^ + = note: expected a closure with signature `for<'a> fn(&'a ())` + found a closure with signature `fn(&())` +note: required by a bound in `accept` --> $DIR/missing-universe-cause-issue-114907.rs:27:14 | LL | fn accept(_: C) -> Handshake> { | ^^^^^^^^^^^ required by this bound in `accept` - = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let callback = |_: &()| {}; - | +++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/missing-universe-cause-issue-114907.rs:33:5 - | -LL | accept(callback); - | ^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... - --> $DIR/missing-universe-cause-issue-114907.rs:27:14 - | -LL | fn accept(_: C) -> Handshake> { - | ^^^^^^^^^^^ required by this bound in `accept` - = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let callback = |_: &()| {}; - | +++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/missing-universe-cause-issue-114907.rs:33:5 - | -LL | accept(callback); - | ^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... - --> $DIR/missing-universe-cause-issue-114907.rs:20:21 - | -LL | struct Handshake { - | ^^^^ required by this bound in `Handshake` - = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let callback = |_: &()| {}; - | +++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/missing-universe-cause-issue-114907.rs:33:5 - | -LL | accept(callback); - | ^^^^^^^^^^^^^^^^ - | -note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... - --> $DIR/missing-universe-cause-issue-114907.rs:20:21 - | -LL | struct Handshake { - | ^^^^ required by this bound in `Handshake` - = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let callback = |_: &()| {}; - | +++++ - -error: higher-ranked subtype error - --> $DIR/missing-universe-cause-issue-114907.rs:33:5 - | -LL | accept(callback); - | ^^^^^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/missing-universe-cause-issue-114907.rs:33:21 - | -LL | accept(callback); - | ^ -error: aborting due to 6 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/nll/normalization-bounds-error.stderr b/tests/ui/nll/normalization-bounds-error.stderr index 47d2663313db6..c862faa1746fe 100644 --- a/tests/ui/nll/normalization-bounds-error.stderr +++ b/tests/ui/nll/normalization-bounds-error.stderr @@ -1,26 +1,19 @@ -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements +error[E0478]: lifetime bound not satisfied --> $DIR/normalization-bounds-error.rs:12:31 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'d` as defined here... +note: lifetime parameter instantiated with the lifetime `'d` as defined here --> $DIR/normalization-bounds-error.rs:12:14 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ -note: ...but the lifetime must also be valid for the lifetime `'a` as defined here... +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/normalization-bounds-error.rs:12:18 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ -note: ...so that the types are compatible - --> $DIR/normalization-bounds-error.rs:12:31 - | -LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `Visitor<'d>` - found `Visitor<'_>` error: lifetime may not live long enough --> $DIR/normalization-bounds-error.rs:12:1 @@ -36,4 +29,4 @@ LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0803`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr index bdab4f12cc276..3a7d63057a9f3 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr @@ -16,14 +16,13 @@ LL | type Output = impl PlusOne; = note: `Output` must be used in combination with a concrete type within the same impl error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds - --> $DIR/location-insensitive-scopes-issue-116657.rs:29:5 + --> $DIR/location-insensitive-scopes-issue-116657.rs:28:1 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { - | -- ------------ opaque type defined here - | | + | ^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^------------ + | | | + | | opaque type defined here | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here -LL | <&mut i32 as Callable>::call(y) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: add a `use<...>` bound to explicitly capture `'a` | diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr index bdab4f12cc276..3a7d63057a9f3 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr @@ -16,14 +16,13 @@ LL | type Output = impl PlusOne; = note: `Output` must be used in combination with a concrete type within the same impl error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds - --> $DIR/location-insensitive-scopes-issue-116657.rs:29:5 + --> $DIR/location-insensitive-scopes-issue-116657.rs:28:1 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { - | -- ------------ opaque type defined here - | | + | ^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^------------ + | | | + | | opaque type defined here | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here -LL | <&mut i32 as Callable>::call(y) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: add a `use<...>` bound to explicitly capture `'a` | diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr index 3c1beb5021af8..8ae1ce1516f8c 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr @@ -1,63 +1,17 @@ -error[E0597]: `a` does not live long enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:11:18 - | -LL | let a = (); - | - binding `a` declared here -LL | let b = |_| &a; - | --- -^ - | | || - | | |borrowed value does not live long enough - | | returning this value requires that `a` is borrowed for `'static` - | value captured here -... -LL | } - | - `a` dropped here while still borrowed - | -note: due to a current limitation of the type system, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 - | -LL | fn bad &()>(_: F) {} - | ^^^^^^^^^^^^^^ -note: requirement that the value outlives `'static` introduced here - --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 - | -LL | fn bad &()>(_: F) {} - | ^^^ - -error: implementation of `Fn` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 +error[E0271]: type mismatch resolving `<&{closure@location-insensitive-scopes-issue-117146.rs:11:13} as FnOnce<(&(),)>>::Output == &()` + --> $DIR/location-insensitive-scopes-issue-117146.rs:14:9 | LL | bad(&b); - | ^^^^^^^ + | --- ^^ types differ + | | + | required by a bound introduced by this call | -note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... - --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 - | -LL | fn bad &()>(_: F) {} - | ^^^^^^^^^^^^^^ required by this bound in `bad` - = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let b = |_: &()| &a; - | +++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 - | -LL | bad(&b); - | ^^^^^^^ - | -note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: required by a bound in `bad` --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 | LL | fn bad &()>(_: F) {} | ^^^ required by this bound in `bad` - = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let b = |_: &()| &a; - | +++++ -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr index 3c1beb5021af8..8ae1ce1516f8c 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr @@ -1,63 +1,17 @@ -error[E0597]: `a` does not live long enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:11:18 - | -LL | let a = (); - | - binding `a` declared here -LL | let b = |_| &a; - | --- -^ - | | || - | | |borrowed value does not live long enough - | | returning this value requires that `a` is borrowed for `'static` - | value captured here -... -LL | } - | - `a` dropped here while still borrowed - | -note: due to a current limitation of the type system, this implies a `'static` lifetime - --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 - | -LL | fn bad &()>(_: F) {} - | ^^^^^^^^^^^^^^ -note: requirement that the value outlives `'static` introduced here - --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 - | -LL | fn bad &()>(_: F) {} - | ^^^ - -error: implementation of `Fn` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 +error[E0271]: type mismatch resolving `<&{closure@location-insensitive-scopes-issue-117146.rs:11:13} as FnOnce<(&(),)>>::Output == &()` + --> $DIR/location-insensitive-scopes-issue-117146.rs:14:9 | LL | bad(&b); - | ^^^^^^^ + | --- ^^ types differ + | | + | required by a bound introduced by this call | -note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... - --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 - | -LL | fn bad &()>(_: F) {} - | ^^^^^^^^^^^^^^ required by this bound in `bad` - = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let b = |_: &()| &a; - | +++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/location-insensitive-scopes-issue-117146.rs:14:5 - | -LL | bad(&b); - | ^^^^^^^ - | -note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: required by a bound in `bad` --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 | LL | fn bad &()>(_: F) {} | ^^^ required by this bound in `bad` - = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | let b = |_: &()| &a; - | +++++ -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.nll.stderr b/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.nll.stderr index 37458833ddfc2..36443de770ebf 100644 --- a/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.nll.stderr +++ b/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.nll.stderr @@ -1,9 +1,6 @@ error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:31:16 | -LL | fn two_uses<'a>(s: &'a String, flag: bool) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -LL | if flag { LL | let local = String::from("dangling"); | ----- binding `local` declared here LL | return &local; @@ -11,14 +8,12 @@ LL | return &local; LL | } | - `local` dropped here while still borrowed LL | s - | - opaque type requires that `local` is borrowed for `'a` +LL | } + | - borrow later used here error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:41:16 | -LL | fn three_uses<'a>(s: &'a String, flag: u8) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -LL | if flag == 0 { LL | let local = String::from("dangling0"); | ----- binding `local` declared here LL | return &local; @@ -26,40 +21,33 @@ LL | return &local; LL | } | - `local` dropped here while still borrowed ... -LL | return &local; - | ------ opaque type requires that `local` is borrowed for `'a` +LL | } + | - borrow later used here error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:45:16 | -LL | fn three_uses<'a>(s: &'a String, flag: u8) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -... LL | let local = String::from("dangling1"); | ----- binding `local` declared here LL | return &local; - | ^^^^^^ - | | - | borrowed value does not live long enough - | opaque type requires that `local` is borrowed for `'a` + | ^^^^^^ borrowed value does not live long enough LL | } | - `local` dropped here while still borrowed +LL | s +LL | } + | - borrow later used here error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:57:5 | -LL | fn reversed_order<'a>(s: &'a String, flag: bool) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -... LL | let local = String::from("dangling"); | ----- binding `local` declared here LL | &local - | ^^^^^^ - | | - | borrowed value does not live long enough - | opaque type requires that `local` is borrowed for `'a` + | ^^^^^^ borrowed value does not live long enough LL | } - | - `local` dropped here while still borrowed + | -- borrow later used here + | | + | `local` dropped here while still borrowed error[E0597]: `short` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:64:16 @@ -69,11 +57,12 @@ LL | fn minimal(short: (), out: &'static ()) -> impl Sized { LL | if true { LL | return &short; | ^^^^^^ borrowed value does not live long enough -LL | } -LL | out - | --- opaque type requires that `short` is borrowed for `'static` +... LL | } - | - `short` dropped here while still borrowed + | - + | | + | `short` dropped here while still borrowed + | borrow later used here error: aborting due to 5 previous errors diff --git a/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.polonius.stderr b/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.polonius.stderr index 37458833ddfc2..36443de770ebf 100644 --- a/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.polonius.stderr +++ b/tests/ui/nll/polonius/opaque-multiple-defining-uses-160669.polonius.stderr @@ -1,9 +1,6 @@ error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:31:16 | -LL | fn two_uses<'a>(s: &'a String, flag: bool) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -LL | if flag { LL | let local = String::from("dangling"); | ----- binding `local` declared here LL | return &local; @@ -11,14 +8,12 @@ LL | return &local; LL | } | - `local` dropped here while still borrowed LL | s - | - opaque type requires that `local` is borrowed for `'a` +LL | } + | - borrow later used here error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:41:16 | -LL | fn three_uses<'a>(s: &'a String, flag: u8) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -LL | if flag == 0 { LL | let local = String::from("dangling0"); | ----- binding `local` declared here LL | return &local; @@ -26,40 +21,33 @@ LL | return &local; LL | } | - `local` dropped here while still borrowed ... -LL | return &local; - | ------ opaque type requires that `local` is borrowed for `'a` +LL | } + | - borrow later used here error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:45:16 | -LL | fn three_uses<'a>(s: &'a String, flag: u8) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -... LL | let local = String::from("dangling1"); | ----- binding `local` declared here LL | return &local; - | ^^^^^^ - | | - | borrowed value does not live long enough - | opaque type requires that `local` is borrowed for `'a` + | ^^^^^^ borrowed value does not live long enough LL | } | - `local` dropped here while still borrowed +LL | s +LL | } + | - borrow later used here error[E0597]: `local` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:57:5 | -LL | fn reversed_order<'a>(s: &'a String, flag: bool) -> impl Display + use<'a> { - | -- lifetime `'a` defined here -... LL | let local = String::from("dangling"); | ----- binding `local` declared here LL | &local - | ^^^^^^ - | | - | borrowed value does not live long enough - | opaque type requires that `local` is borrowed for `'a` + | ^^^^^^ borrowed value does not live long enough LL | } - | - `local` dropped here while still borrowed + | -- borrow later used here + | | + | `local` dropped here while still borrowed error[E0597]: `short` does not live long enough --> $DIR/opaque-multiple-defining-uses-160669.rs:64:16 @@ -69,11 +57,12 @@ LL | fn minimal(short: (), out: &'static ()) -> impl Sized { LL | if true { LL | return &short; | ^^^^^^ borrowed value does not live long enough -LL | } -LL | out - | --- opaque type requires that `short` is borrowed for `'static` +... LL | } - | - `short` dropped here while still borrowed + | - + | | + | `short` dropped here while still borrowed + | borrow later used here error: aborting due to 5 previous errors diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index af896df38aa49..9a1b7857f7b3b 100644 --- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -1,39 +1,26 @@ -error: implementation of `Y` is not general enough +error: higher-ranked lifetime error --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 | LL | let _x = ::make_f(); | ^^^^^^^^^^^^^^^^^^^ | -note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` - --> $DIR/impl-fn-ignore-binder-via-bottom.rs:18:8 - | -LL | trait Y { -LL | type F; -LL | fn make_f() -> Self::F; - | ^^^^^^ required due to a bound in `Y::make_f` - = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` + = note: could not prove `for<'a> fn(&'a ()): Y` -error: implementation of `Y` is not general enough +error: higher-ranked lifetime error --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 | LL | let _x = ::make_f(); | ^^^^^^^^^^^^^^^^^^^ | -note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` - --> $DIR/impl-fn-ignore-binder-via-bottom.rs:16:7 - | -LL | trait Y { - | ^ required due to a bound in `Y` - = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` + = note: could not prove ` fn(&'a ()) as Y>::F well-formed` -error: implementation of `Y` is not general enough +error: higher-ranked lifetime error --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 | LL | let _x = ::make_f(); - | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | ^^^^^^^^^^^^^^^^^^^ | - = note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` - = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` + = note: could not normalize `fn() -> fn(&'a ()) as Y>::F` error: aborting due to 3 previous errors diff --git a/tests/ui/nll/relate_tys/opaque-hrtb.stderr b/tests/ui/nll/relate_tys/opaque-hrtb.stderr index d48745d2d2818..d2b67cb6eb17e 100644 --- a/tests/ui/nll/relate_tys/opaque-hrtb.stderr +++ b/tests/ui/nll/relate_tys/opaque-hrtb.stderr @@ -1,11 +1,15 @@ -error: implementation of `MyTrait` is not general enough - --> $DIR/opaque-hrtb.rs:11:5 +error[E0277]: the trait bound `for<'a> impl MyTrait<&str>: MyTrait<&'a str>` is not satisfied + --> $DIR/opaque-hrtb.rs:10:13 | -LL | bar() - | ^^^^^ implementation of `MyTrait` is not general enough +LL | fn foo() -> impl for<'a> MyTrait<&'a str> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> MyTrait<&'a str>` is not implemented for `impl MyTrait<&str>` | - = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`... - = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2` +help: the trait `MyTrait` is implemented for `Foo` + --> $DIR/opaque-hrtb.rs:4:1 + | +LL | impl MyTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/nll/relate_tys/trait-hrtb.stderr b/tests/ui/nll/relate_tys/trait-hrtb.stderr index 7f7b94c0b3018..7429085ae6aa7 100644 --- a/tests/ui/nll/relate_tys/trait-hrtb.stderr +++ b/tests/ui/nll/relate_tys/trait-hrtb.stderr @@ -1,12 +1,10 @@ -error[E0308]: mismatched types +error: higher-ranked lifetime error --> $DIR/trait-hrtb.rs:13:39 | LL | let y: Box Foo<'a>> = x; - | ^ one type is more general than the other + | ^ | - = note: expected trait object `dyn for<'a> Foo<'a>` - found trait object `dyn Foo<'_>` + = note: could not prove `Box>: CoerceUnsized Foo<'a>>>` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/nll/trait-associated-constant.stderr b/tests/ui/nll/trait-associated-constant.stderr index 371f7860d4da7..755f7752654a3 100644 --- a/tests/ui/nll/trait-associated-constant.stderr +++ b/tests/ui/nll/trait-associated-constant.stderr @@ -1,17 +1,15 @@ -error[E0308]: const not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/trait-associated-constant.rs:21:5 | LL | const AC: Option<&'c str> = None; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected enum `Option<&'b _>` - found enum `Option<&'c _>` -note: the lifetime `'c` as defined here... +note: lifetime parameter instantiated with the lifetime `'c` as defined here --> $DIR/trait-associated-constant.rs:20:18 | LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined here +note: but lifetime parameter must outlive the lifetime `'b` as defined here --> $DIR/trait-associated-constant.rs:20:14 | LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { @@ -19,4 +17,4 @@ LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr index 6bf1e333327f7..960e67acd575a 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,12 +1,11 @@ error[E0700]: hidden type for `Opaque(DefId(0:11 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])` captures lifetime that does not appear in bounds - --> $DIR/impl-trait-captures.rs:11:5 + --> $DIR/impl-trait-captures.rs:10:1 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { - | -- ------------ opaque type defined here - | | + | ^^^^^^^^^^^^^^^^^--^^^^^------------ + | | | + | | opaque type defined here | hidden type `&ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_))) T` captures the anonymous lifetime defined here -LL | x - | ^ | help: add a `use<...>` bound to explicitly capture `ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_)))` | diff --git a/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr b/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr index ff9d750570e59..4d74f85dec4b4 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr @@ -1,11 +1,13 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/impl-trait-outlives.rs:11:5 + --> $DIR/impl-trait-outlives.rs:7:1 | -LL | fn no_region<'a, T>(x: Box) -> impl Debug + 'a - | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... -... -LL | x - | ^ ...so that the type `T` will meet its required lifetime bounds +LL | fn no_region<'a, T>(x: Box) -> impl Debug + 'a + | ^ -- the parameter type `T` must be valid for the lifetime `'a` as defined here... + | _| + | | +LL | | where +LL | | T: Debug, + | |_____________^ ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -13,13 +15,15 @@ LL | T: Debug + 'a, | ++++ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/impl-trait-outlives.rs:26:5 + --> $DIR/impl-trait-outlives.rs:22:1 | -LL | fn wrong_region<'a, 'b, T>(x: Box) -> impl Debug + 'a - | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... -... -LL | x - | ^ ...so that the type `T` will meet its required lifetime bounds +LL | fn wrong_region<'a, 'b, T>(x: Box) -> impl Debug + 'a + | ^ -- the parameter type `T` must be valid for the lifetime `'a` as defined here... + | _| + | | +LL | | where +LL | | T: 'b + Debug, + | |__________________^ ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/not-panic/not-panic-safe-2.stderr b/tests/ui/not-panic/not-panic-safe-2.stderr index 86b829f726295..91336c2a2b96c 100644 --- a/tests/ui/not-panic/not-panic-safe-2.stderr +++ b/tests/ui/not-panic/not-panic-safe-2.stderr @@ -1,19 +1,3 @@ -error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - --> $DIR/not-panic-safe-2.rs:10:14 - | -LL | assert::>>(); - | ^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - | - = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` -note: required because it appears within the type `RefCell` - --> $SRC_DIR/core/src/cell.rs:LL:COL - = note: required for `Rc>` to implement `UnwindSafe` -note: required by a bound in `assert` - --> $DIR/not-panic-safe-2.rs:7:14 - | -LL | fn assert() {} - | ^^^^^^^^^^ required by this bound in `assert` - error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary --> $DIR/not-panic-safe-2.rs:10:14 | @@ -32,6 +16,6 @@ note: required by a bound in `assert` LL | fn assert() {} | ^^^^^^^^^^ required by this bound in `assert` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/not-panic/not-panic-safe-3.stderr b/tests/ui/not-panic/not-panic-safe-3.stderr index 34ad92361a4f9..fcd5622bec819 100644 --- a/tests/ui/not-panic/not-panic-safe-3.stderr +++ b/tests/ui/not-panic/not-panic-safe-3.stderr @@ -1,19 +1,3 @@ -error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - --> $DIR/not-panic-safe-3.rs:10:14 - | -LL | assert::>>(); - | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - | - = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` -note: required because it appears within the type `RefCell` - --> $SRC_DIR/core/src/cell.rs:LL:COL - = note: required for `Arc>` to implement `UnwindSafe` -note: required by a bound in `assert` - --> $DIR/not-panic-safe-3.rs:7:14 - | -LL | fn assert() {} - | ^^^^^^^^^^ required by this bound in `assert` - error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary --> $DIR/not-panic-safe-3.rs:10:14 | @@ -32,6 +16,6 @@ note: required by a bound in `assert` LL | fn assert() {} | ^^^^^^^^^^ required by this bound in `assert` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/not-panic/not-panic-safe-4.stderr b/tests/ui/not-panic/not-panic-safe-4.stderr index 8597bc3c0dd0d..d22388e3d19d2 100644 --- a/tests/ui/not-panic/not-panic-safe-4.stderr +++ b/tests/ui/not-panic/not-panic-safe-4.stderr @@ -1,24 +1,3 @@ -error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - --> $DIR/not-panic-safe-4.rs:9:14 - | -LL | assert::<&RefCell>(); - | ^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - | - = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` -note: required because it appears within the type `RefCell` - --> $SRC_DIR/core/src/cell.rs:LL:COL - = note: required for `&RefCell` to implement `UnwindSafe` -note: required by a bound in `assert` - --> $DIR/not-panic-safe-4.rs:6:14 - | -LL | fn assert() {} - | ^^^^^^^^^^ required by this bound in `assert` -help: consider removing the leading `&`-reference - | -LL - assert::<&RefCell>(); -LL + assert::>(); - | - error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary --> $DIR/not-panic-safe-4.rs:9:14 | @@ -42,6 +21,6 @@ LL - assert::<&RefCell>(); LL + assert::>(); | -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/not-panic/not-panic-safe-6.stderr b/tests/ui/not-panic/not-panic-safe-6.stderr index 720f114f6d936..3b97ce8bbe902 100644 --- a/tests/ui/not-panic/not-panic-safe-6.stderr +++ b/tests/ui/not-panic/not-panic-safe-6.stderr @@ -1,19 +1,3 @@ -error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - --> $DIR/not-panic-safe-6.rs:9:14 - | -LL | assert::<*mut RefCell>(); - | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary - | - = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` -note: required because it appears within the type `RefCell` - --> $SRC_DIR/core/src/cell.rs:LL:COL - = note: required for `*mut RefCell` to implement `UnwindSafe` -note: required by a bound in `assert` - --> $DIR/not-panic-safe-6.rs:6:14 - | -LL | fn assert() {} - | ^^^^^^^^^^ required by this bound in `assert` - error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary --> $DIR/not-panic-safe-6.rs:9:14 | @@ -32,6 +16,6 @@ note: required by a bound in `assert` LL | fn assert() {} | ^^^^^^^^^^ required by this bound in `assert` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/offset-of/offset-of-dst-field.stderr b/tests/ui/offset-of/offset-of-dst-field.stderr index cfc72f62a04b0..cfa3d86537a82 100644 --- a/tests/ui/offset-of/offset-of-dst-field.stderr +++ b/tests/ui/offset-of/offset-of-dst-field.stderr @@ -30,6 +30,21 @@ LL | offset_of!((u8, dyn Trait), 1); | = help: the trait `Sized` is not implemented for `dyn Trait` +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/offset-of-dst-field.rs:45:5 + | +LL | offset_of!(Delta, z); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `Alpha`, the trait `Sized` is not implemented for `[u8]` +note: required because it appears within the type `Alpha` + --> $DIR/offset-of-dst-field.rs:9:5 + | +LL | struct Alpha { +... +LL | z: [u8], + | ^^^^^^^ required by this field + error[E0277]: the size for values of type `Extern` cannot be known at compilation time --> $DIR/offset-of-dst-field.rs:46:5 | @@ -46,21 +61,6 @@ LL | offset_of!(Delta, z); | = help: the trait `Sized` is not implemented for `dyn Trait` -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/offset-of-dst-field.rs:45:5 - | -LL | offset_of!(Delta, z); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: within `Alpha`, the trait `Sized` is not implemented for `[u8]` -note: required because it appears within the type `Alpha` - --> $DIR/offset-of-dst-field.rs:9:5 - | -LL | struct Alpha { -... -LL | z: [u8], - | ^^^^^^^ required by this field - error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/offset-of-dst-field.rs:51:5 | diff --git a/tests/ui/on-unimplemented/sum.stderr b/tests/ui/on-unimplemented/sum.stderr index 56257079bd314..2a19d6878db8c 100644 --- a/tests/ui/on-unimplemented/sum.stderr +++ b/tests/ui/on-unimplemented/sum.stderr @@ -17,13 +17,6 @@ help: `i32` implements trait `Sum` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/sum.rs:4:18 - | -LL | vec![(), ()].iter().sum::(); - | ------------ ^^^^^^ `Iterator::Item` is `&()` here - | | - | this expression has type `Vec<()>` note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -47,13 +40,6 @@ help: `i32` implements trait `Product` ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: in this macro invocation -note: the method call chain might not have had the expected associated types - --> $DIR/sum.rs:7:18 - | -LL | vec![(), ()].iter().product::(); - | ------------ ^^^^^^ `Iterator::Item` is `&()` here - | | - | this expression has type `Vec<()>` note: required by a bound in `std::iter::Iterator::product` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = note: this error originates in the macro `integer_sum_product` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr index 736a4c7094c5d..1891275d135f6 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr +++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr @@ -1,12 +1,11 @@ -error[E0308]: `#[panic_handler]` function has wrong type +error[E0478]: lifetime bound not satisfied --> $DIR/panic-handler-bad-signature-2.rs:9:1 | LL | fn panic(info: &'static PanicInfo) -> ! - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _` - found signature `for<'a> fn(&'static PanicInfo<'a>) -> _` + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr index 3dcd253d3086e..5f5061f7598ca 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr +++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr @@ -1,12 +1,11 @@ -error[E0308]: `#[panic_handler]` function has wrong type +error[E0478]: lifetime bound not satisfied --> $DIR/panic-handler-bad-signature-5.rs:9:1 | LL | fn panic(info: &PanicInfo<'static>) -> ! - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _` - found signature `for<'a> fn(&'a PanicInfo<'static>) -> _` + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/parallel-rustc/trait-solver-global-cache.stderr b/tests/ui/parallel-rustc/trait-solver-global-cache.stderr index 6268341029bb2..0c0ba5644e691 100644 --- a/tests/ui/parallel-rustc/trait-solver-global-cache.stderr +++ b/tests/ui/parallel-rustc/trait-solver-global-cache.stderr @@ -1,24 +1,23 @@ -error[E0277]: the trait bound `T: Clone` is not satisfied +error[E0277]: can't compare `Struct` with `Struct` --> $DIR/trait-solver-global-cache.rs:14:12 | LL | #[derive(Clone, Eq)] | -- in this derive macro expansion LL | pub struct Struct(T); - | ^^^^^^ the trait `Clone` is not implemented for `T` + | ^^^^^^ no implementation for `Struct == Struct` | -note: required for `Struct` to implement `PartialEq` - --> $DIR/trait-solver-global-cache.rs:16:19 - | -LL | impl PartialEq for Struct - | ----- ^^^^^^^^^^^^ ^^^^^^^^^ - | | - | unsatisfied trait bound introduced here + = help: the trait `PartialEq` is not implemented for `Struct` note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL -help: consider restricting type parameter `T` with trait `Clone` +help: consider annotating `Struct` with `#[derive(PartialEq)]` + | +LL + #[derive(PartialEq)] +LL | pub struct Struct(T); + | +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | pub struct Struct(T); - | +++++++++++++++++++ +LL | pub struct Struct(T) where Struct: PartialEq; + | ++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/parser/expr-as-stmt.stderr b/tests/ui/parser/expr-as-stmt.stderr index 4681129babab0..9aab16f31778d 100644 --- a/tests/ui/parser/expr-as-stmt.stderr +++ b/tests/ui/parser/expr-as-stmt.stderr @@ -90,9 +90,16 @@ error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:64:7 | LL | { foo() } || { true } - | ^^^^^- help: consider using a semicolon here: `;` - | | - | expected `()`, found `i32` + | ^^^^^ expected `()`, found `i32` + | +help: consider using a semicolon here + | +LL | { foo(); } || { true } + | + +help: you might have meant to return this value + | +LL | { return foo(); } || { true } + | ++++++ + error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:8:6 diff --git a/tests/ui/parser/issue-12187-1.stderr b/tests/ui/parser/issue-12187-1.stderr index ee5d1c0b2f16b..dd357e5ad0caf 100644 --- a/tests/ui/parser/issue-12187-1.stderr +++ b/tests/ui/parser/issue-12187-1.stderr @@ -1,14 +1,9 @@ -error[E0282]: type annotations needed for `&_` - --> $DIR/issue-12187-1.rs:6:9 +error[E0284]: type annotations needed: cannot satisfy `_: 'static` + --> $DIR/issue-12187-1.rs:6:14 | LL | let &v = new(); - | ^^ ----- type must be known at this point - | -help: consider giving this pattern a type, where the type for type parameter `T` is specified - | -LL | let &v: &_ = new(); - | ++++ + | ^^^^^ cannot satisfy `_: 'static` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/parser/issue-12187-2.stderr b/tests/ui/parser/issue-12187-2.stderr index 67d18cf137be9..ba791a6fab436 100644 --- a/tests/ui/parser/issue-12187-2.stderr +++ b/tests/ui/parser/issue-12187-2.stderr @@ -1,14 +1,9 @@ -error[E0282]: type annotations needed for `&_` - --> $DIR/issue-12187-2.rs:6:9 +error[E0284]: type annotations needed: cannot satisfy `_: '_` + --> $DIR/issue-12187-2.rs:6:14 | LL | let &v = new(); - | ^^ ----- type must be known at this point - | -help: consider giving this pattern a type, where the type for type parameter `T` is specified - | -LL | let &v: &_ = new(); - | ++++ + | ^^^^^ cannot satisfy `_: '_` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr index bd809e77a8f95..e50de9db6cba3 100644 --- a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr +++ b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr @@ -28,17 +28,21 @@ error[E0308]: mismatched types LL | foo(|| ()); | ^^ expected `i32`, found `()` -error[E0631]: type mismatch in closure arguments - --> $DIR/recover-fn-trait-from-fn-kw.rs:10:5 +error[E0277]: expected an `Fn(i32)` closure, found `{closure@$DIR/recover-fn-trait-from-fn-kw.rs:10:10: 10:17}` + --> $DIR/recover-fn-trait-from-fn-kw.rs:10:10 | LL | foo2(|_: ()| {}); - | ^^^^^-------^^^^ - | | | - | | found signature defined here - | expected due to this + | ---- ^^^^^^^^^^ expected an `Fn(i32)` closure, found `{closure@$DIR/recover-fn-trait-from-fn-kw.rs:10:10: 10:17}` + | | + | required by a bound introduced by this call | - = note: expected closure signature `fn(i32) -> _` - found closure signature `fn(()) -> _` +help: the trait `Fn(i32)` is not implemented for closure `{closure@$DIR/recover-fn-trait-from-fn-kw.rs:10:10: 10:17}` + --> $DIR/recover-fn-trait-from-fn-kw.rs:10:10 + | +LL | foo2(|_: ()| {}); + | ^^^^^^^ + = note: expected a closure with signature `fn(i32)` + found a closure with signature `fn(())` note: required by a bound in `foo2` --> $DIR/recover-fn-trait-from-fn-kw.rs:4:12 | @@ -47,5 +51,5 @@ LL | fn foo2(_: T) {} error: aborting due to 4 previous errors -Some errors have detailed explanations: E0308, E0631. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/pattern/rest-pat-semantic-disallowed.stderr b/tests/ui/pattern/rest-pat-semantic-disallowed.stderr index e795ac606ce74..a8c3763dd5c7d 100644 --- a/tests/ui/pattern/rest-pat-semantic-disallowed.stderr +++ b/tests/ui/pattern/rest-pat-semantic-disallowed.stderr @@ -177,17 +177,12 @@ LL | fn foo(..: u8) {} | = note: only allowed in tuple, tuple struct, and slice patterns -error[E0282]: type annotations needed - --> $DIR/rest-pat-semantic-disallowed.rs:28:9 +error[E0284]: type annotations needed: cannot satisfy `_: '_` + --> $DIR/rest-pat-semantic-disallowed.rs:24:9 | -LL | let x @ ..; - | ^^^^^^ - | -help: consider giving this pattern a type - | -LL | let x @ ..: /* Type */; - | ++++++++++++ +LL | let &..; + | ^^^ cannot satisfy `_: '_` error: aborting due to 22 previous errors -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/pattern/slice-patterns-irrefutable.stderr b/tests/ui/pattern/slice-patterns-irrefutable.stderr index 4619a0d798d4b..f9bd24106fb04 100644 --- a/tests/ui/pattern/slice-patterns-irrefutable.stderr +++ b/tests/ui/pattern/slice-patterns-irrefutable.stderr @@ -5,7 +5,7 @@ LL | let b; | ^ LL | LL | [a, b] = Default::default(); - | - type must be known at this point + | ------------------ type must be known at this point | help: consider giving `b` an explicit type, where the placeholder `_` is specified | diff --git a/tests/ui/pin/pin-deref-target-partial-eq-67039.stderr b/tests/ui/pin/pin-deref-target-partial-eq-67039.stderr index 541656dd7437e..b893250dfc8b5 100644 --- a/tests/ui/pin/pin-deref-target-partial-eq-67039.stderr +++ b/tests/ui/pin/pin-deref-target-partial-eq-67039.stderr @@ -1,13 +1,23 @@ -error[E0271]: type mismatch resolving ` as Deref>::Target == Rc` +error[E0277]: can't compare `Apple` with `Apple` --> $DIR/pin-deref-target-partial-eq-67039.rs:26:29 | LL | let _ = Pin::new(Apple) == Rc::pin(Apple); - | ^^ expected `Rc`, found `Apple` + | ^^ no implementation for `Apple == Apple` | - = note: expected struct `Rc` - found struct `Apple` +help: the trait `PartialEq` is not implemented for `Apple` + but trait `PartialEq>` is implemented for it + --> $DIR/pin-deref-target-partial-eq-67039.rs:19:1 + | +LL | impl PartialEq> for Apple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: for that trait implementation, expected `Rc`, found `Apple` = note: required for `Pin` to implement `PartialEq>>` +help: consider annotating `Apple` with `#[derive(PartialEq)]` + | +LL + #[derive(PartialEq)] +LL | struct Apple; + | error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 32525a41f946c..f799275381fb0 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -125,7 +125,7 @@ LL + let _ = Box::new_zeroed(); LL - let _ = Box {}; LL + let _ = Box::new_in(_, _); | - = and 16 other candidates + = and 17 other candidates help: consider using the `Default` trait | LL - let _ = Box {}; @@ -152,7 +152,7 @@ LL + let _ = Box::::into_inner(_); LL - let _ = Box:: {}; LL + let _ = Box::::map(_, _); | - = and 7 other candidates + = and 8 other candidates help: consider using the `Default` trait | LL - let _ = Box:: {}; diff --git a/tests/ui/privacy/suggest-new-projection-ice.stderr b/tests/ui/privacy/suggest-new-projection-ice.stderr index 4700772096b93..5d965e4f3253d 100644 --- a/tests/ui/privacy/suggest-new-projection-ice.stderr +++ b/tests/ui/privacy/suggest-new-projection-ice.stderr @@ -5,6 +5,11 @@ LL | let _ = m::Foo {}; | ^^^^^^ | = note: private field `_priv` that was not provided +help: you might have meant to use the `new` associated function + | +LL - let _ = m::Foo {}; +LL + let _ = m::Foo::new(); + | error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr index 73981b6ec0e92..bc68ed8e3e0e9 100644 --- a/tests/ui/proc-macro/bad-projection.stderr +++ b/tests/ui/proc-macro/bad-projection.stderr @@ -23,16 +23,16 @@ LL | trait Project { | ^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0593]: function is expected to take 1 argument, but it takes 0 arguments +error[E0277]: expected an `Fn(TokenStream)` closure, found `fn() -> <() as Project>::Assoc {uwu}` --> $DIR/bad-projection.rs:14:1 | LL | pub fn uwu() -> <() as Project>::Assoc {} - | --------------------------------------^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | expected function that takes 1 argument - | takes 0 arguments + | expected an `Fn(TokenStream)` closure, found `fn() -> <() as Project>::Assoc {uwu}` | required by a bound introduced by this call | + = help: the trait `Fn(TokenStream)` is not implemented for fn item `fn() -> <() as Project>::Assoc {uwu}` note: required by a bound in `proc_macro::bridge::client::Client::expand1` --> $SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL @@ -62,5 +62,4 @@ LL | trait Project { error: aborting due to 5 previous errors -Some errors have detailed explanations: E0277, E0593. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr index 0390295a66a42..29cb0020c2a05 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr @@ -15,13 +15,13 @@ LL | struct PriorityQueue(BinaryHeap>); note: required by a bound in `PartialOrd` --> $SRC_DIR/core/src/cmp.rs:LL:COL -error[E0277]: the trait bound `PriorityQueue: Eq` is not satisfied +error[E0277]: can't compare `PriorityQueue` with `PriorityQueue` --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 | LL | #[derive(PartialOrd, AddImpl)] - | ^^^^^^^ unsatisfied trait bound + | ^^^^^^^ no implementation for `PriorityQueue < PriorityQueue` and `PriorityQueue > PriorityQueue` | -help: the trait `Eq` is not implemented for `PriorityQueue` +help: the trait `PartialOrd` is not implemented for `PriorityQueue` --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1 | LL | struct PriorityQueue(BinaryHeap>); @@ -30,33 +30,31 @@ note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: can't compare `T` with `T` +error[E0277]: the trait bound `PriorityQueue: Eq` is not satisfied --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 | LL | #[derive(PartialOrd, AddImpl)] - | ^^^^^^^ no implementation for `T < T` and `T > T` + | ^^^^^^^ unsatisfied trait bound | -note: required for `PriorityQueue` to implement `PartialOrd` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:8 +help: the trait `Eq` is not implemented for `PriorityQueue` + --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1 | -LL | #[derive(PartialOrd, AddImpl)] - | ---------- in this derive macro expansion -... LL | struct PriorityQueue(BinaryHeap>); - | ^^^^^^^^^^^^^ - type parameter would need to implement `PartialOrd` + | ^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: can't compare `BinaryHeap>` with `_` +error[E0277]: can't compare `BinaryHeap>` with `BinaryHeap>` --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:25 | LL | #[derive(PartialOrd, AddImpl)] | ---------- in this derive macro expansion ... LL | struct PriorityQueue(BinaryHeap>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `BinaryHeap> < _` and `BinaryHeap> > _` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `BinaryHeap> < BinaryHeap>` and `BinaryHeap> > BinaryHeap>` | - = help: the trait `PartialOrd<_>` is not implemented for `BinaryHeap>` + = help: the trait `PartialOrd` is not implemented for `BinaryHeap>` error[E0599]: no method named `cmp` found for struct `BinaryHeap>` in the current scope --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 diff --git a/tests/ui/proc-macro/quote/not-repeatable.stderr b/tests/ui/proc-macro/quote/not-repeatable.stderr index 611da37f3a1f9..0b10220c82953 100644 --- a/tests/ui/proc-macro/quote/not-repeatable.stderr +++ b/tests/ui/proc-macro/quote/not-repeatable.stderr @@ -14,7 +14,7 @@ LL | let _ = quote! { $($ip)* }; which is required by `&Ipv4Addr: proc_macro::ext::RepIteratorExt` `Ipv4Addr: ToTokens` which is required by `Ipv4Addr: proc_macro::ext::RepToTokensExt` - `&mut Ipv4Addr: Iterator` + `Ipv4Addr: Iterator` which is required by `&mut Ipv4Addr: proc_macro::ext::RepIteratorExt` note: the traits `Iterator` and `ToTokens` must be implemented --> $SRC_DIR/proc_macro/src/to_tokens.rs:LL:COL diff --git a/tests/ui/reborrow/coerce-shared-field-region-obligation.stderr b/tests/ui/reborrow/coerce-shared-field-region-obligation.stderr index 06b89073f49e1..cb49389912199 100644 --- a/tests/ui/reborrow/coerce-shared-field-region-obligation.stderr +++ b/tests/ui/reborrow/coerce-shared-field-region-obligation.stderr @@ -1,18 +1,16 @@ -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/coerce-shared-field-region-obligation.rs:29:1 | LL | impl<'a> CoerceShared> for Source<'a> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected trait `CoerceShared>` - found trait `CoerceShared>` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/coerce-shared-field-region-obligation.rs:29:6 | LL | impl<'a> CoerceShared> for Source<'a> {} | ^^ - = note: ...does not necessarily outlive the static lifetime + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/recursion/issue-23122-1.stderr b/tests/ui/recursion/issue-23122-1.stderr index c432a502c1340..1eb1976876d3a 100644 --- a/tests/ui/recursion/issue-23122-1.stderr +++ b/tests/ui/recursion/issue-23122-1.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement ` as Next>::Next == LL | type Next = as Next>::Next; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement ` as Next>::Next == _` + --> $DIR/issue-23122-1.rs:10:5 + | +LL | type Next = as Next>::Next; + | ^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/recursion/issue-23122-2.stderr b/tests/ui/recursion/issue-23122-2.stderr index 2fda276d03729..4b0be1e8f6f79 100644 --- a/tests/ui/recursion/issue-23122-2.stderr +++ b/tests/ui/recursion/issue-23122-2.stderr @@ -1,20 +1,19 @@ -error[E0275]: overflow evaluating the requirement `<<<<<<<_ as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized` +error[E0275]: overflow evaluating the requirement ` as Next>::Next == _` --> $DIR/issue-23122-2.rs:11:17 | LL | type Next = as Next>::Next; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) -note: required for `GetNext<<<<_ as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` - --> $DIR/issue-23122-2.rs:10:15 + +error[E0275]: overflow evaluating the requirement `::Next> as Next>::Next == _` + --> $DIR/issue-23122-2.rs:11:5 + | +LL | type Next = as Next>::Next; + | ^^^^^^^^^ | -LL | impl Next for GetNext { - | - ^^^^ ^^^^^^^^^^ - | | - | unsatisfied trait bound implicitly introduced here - = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-23122-2.long-type-$LONG_TYPE_HASH.txt' - = note: consider using `--verbose` to print the full type name to the console + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr index a01f14b66794c..5c886220d0ad1 100644 --- a/tests/ui/recursion/issue-83150.stderr +++ b/tests/ui/recursion/issue-83150.stderr @@ -10,15 +10,27 @@ LL | func(&mut iter.map(|x| x + 1)) = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range, {closure@$DIR/issue-83150.rs:12:24: 12:27}>: Iterator` +warning: overflow evaluating the requirement `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut _, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>: Iterator` | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) - = note: required for `&mut Map<&mut Range, {closure@issue-83150.rs:12:24}>` to implement `Iterator` - = note: 65 redundant requirements hidden - = note: required for `&mut Map<&mut Map<&mut _, {closure@...}>, {closure@...}>` to implement `Iterator` + = note: which requires `Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<_, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>: Iterator` + = note: which requires `<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut _, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}>, {closure@...}> as Iterator>::Item == u8` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the type-length limit while instantiating `<&mut Map<_, {closure@...}> as Iterator>::map::` + --> $DIR/issue-83150.rs:12:15 + | +LL | func(&mut iter.map(|x| x + 1)) + | ^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding a `#![type_length_limit="18446744073709551607"]` attribute to your crate = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-83150.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error; 2 warnings emitted -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/recursion/recursive-requirements.stderr b/tests/ui/recursion/recursive-requirements.stderr index 527baa431a95b..8b610aa41b2f6 100644 --- a/tests/ui/recursion/recursive-requirements.stderr +++ b/tests/ui/recursion/recursive-requirements.stderr @@ -17,34 +17,6 @@ note: required by a bound in `AssertSync` LL | struct AssertSync(PhantomData); | ^^^^ required by this bound in `AssertSync` -error[E0277]: `*const Foo` cannot be shared between threads safely - --> $DIR/recursive-requirements.rs:16:12 - | -LL | let _: AssertSync = unimplemented!(); - | ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely - | - = help: within `Foo`, the trait `Sync` is not implemented for `*const Foo` -note: required because it appears within the type `Bar` - --> $DIR/recursive-requirements.rs:11:5 - | -LL | pub struct Bar { -LL | foo: *const Foo, - | ^^^^^^^^^^^^^^^ required by this field -note: required because it appears within the type `PhantomData` - --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `Foo` - --> $DIR/recursive-requirements.rs:7:5 - | -LL | pub struct Foo { -LL | bar: *const Bar, -LL | phantom: PhantomData, - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this field -note: required by a bound in `AssertSync` - --> $DIR/recursive-requirements.rs:3:22 - | -LL | struct AssertSync(PhantomData); - | ^^^^ required by this bound in `AssertSync` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr b/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr index 509863eaf886c..2485a297708ad 100644 --- a/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr +++ b/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr @@ -4,12 +4,11 @@ error[E0597]: `x` does not live long enough LL | let x = (); | - binding `x` declared here LL | S(&x) - | --^^- - | | | - | | borrowed value does not live long enough - | opaque type requires that `x` is borrowed for `'static` + | ^^ borrowed value does not live long enough LL | } - | - `x` dropped here while still borrowed + | -- borrow later used here + | | + | `x` dropped here while still borrowed error: aborting due to 1 previous error diff --git a/tests/ui/regions/explicit-static-bound-on-trait.stderr b/tests/ui/regions/explicit-static-bound-on-trait.stderr index 30d39c6e86e95..04238ecb82bdf 100644 --- a/tests/ui/regions/explicit-static-bound-on-trait.stderr +++ b/tests/ui/regions/explicit-static-bound-on-trait.stderr @@ -9,8 +9,7 @@ note: lifetime parameter instantiated with the lifetime `'a` as defined here | LL | struct Hello<'a> { | ^^ -note: but lifetime parameter must outlive the static lifetime - --> $SRC_DIR/core/src/any.rs:LL:COL + = note: but lifetime parameter must outlive the static lifetime error[E0310]: the parameter type `T` may not live long enough --> $DIR/explicit-static-bound-on-trait.rs:8:23 diff --git a/tests/ui/regions/impl-trait-lifetime-conflict-hashmap-keys.stderr b/tests/ui/regions/impl-trait-lifetime-conflict-hashmap-keys.stderr index 6def28bed193c..713730bb7c540 100644 --- a/tests/ui/regions/impl-trait-lifetime-conflict-hashmap-keys.stderr +++ b/tests/ui/regions/impl-trait-lifetime-conflict-hashmap-keys.stderr @@ -9,22 +9,17 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined here... | LL | impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap, (), R> { | ^^ -note: ...so that the reference type `&Subject<'a, HashMap, (), R>` does not outlive the data it points at +note: ...so that the type `Subject<'a, HashMap, (), R>` will meet its required lifetime bounds --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5 | LL | fn key_set(&self) -> Subject<'static, Keys, (), R> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... -note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds... +note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5 | LL | fn key_set(&self) -> Subject<'static, Keys, (), R> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...that is required by this bound - --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:10:29 - | -LL | struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:26 diff --git a/tests/ui/regions/multiple-sources-for-outlives-requirement.stderr b/tests/ui/regions/multiple-sources-for-outlives-requirement.stderr index 4cdaf950e155c..51359dab41f22 100644 --- a/tests/ui/regions/multiple-sources-for-outlives-requirement.stderr +++ b/tests/ui/regions/multiple-sources-for-outlives-requirement.stderr @@ -8,12 +8,6 @@ LL | outlives_indir::<'_, 'b, _>(&mut 1u32); | | | | | creates a temporary value which is freed while still in use | argument requires that borrow lasts for `'b` - | -note: requirements that the value outlives `'b` introduced here - --> $DIR/multiple-sources-for-outlives-requirement.rs:1:23 - | -LL | fn outlives_indir<'a: 'b, 'b, T: 'a>(_x: T) {} - | ^^ ^^ error: aborting due to 1 previous error diff --git a/tests/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr b/tests/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr index ac6154139e269..c74378795a786 100644 --- a/tests/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr +++ b/tests/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr @@ -4,11 +4,7 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime LL | type Value = &'a i32; | ^^^^^^^ | -note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:5:17 - | -LL | type Value: 'a; - | ^^ + = note: type must satisfy the static lifetime error[E0477]: the type `&'a i32` does not fulfill the required lifetime --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:20:18 @@ -16,7 +12,7 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime LL | type Value = &'a i32; | ^^^^^^^ | -note: type must outlive the lifetime `'b` as defined here as required by this binding +note: type must outlive the lifetime `'b` as defined here --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:10 | LL | impl<'a, 'b> Foo<'b> for &'a i64 { diff --git a/tests/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr b/tests/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr index 6ffe416ca5f10..54ff21d75207d 100644 --- a/tests/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr +++ b/tests/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr @@ -4,11 +4,7 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime LL | type Value = &'a i32; | ^^^^^^^ | -note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:5:17 - | -LL | type Value: 'static; - | ^^^^^^^ + = note: type must satisfy the static lifetime error: aborting due to 1 previous error diff --git a/tests/ui/regions/regions-escape-method.fixed b/tests/ui/regions/regions-escape-method.fixed index f192dca1e25f0..82bf86c79b235 100644 --- a/tests/ui/regions/regions-escape-method.fixed +++ b/tests/ui/regions/regions-escape-method.fixed @@ -13,5 +13,5 @@ impl S { fn main() { let s = S; - s.f(|p| *p) //~ ERROR lifetime may not live long enough + s.f(|p| p) //~ ERROR lifetime may not live long enough } diff --git a/tests/ui/regions/regions-escape-method.stderr b/tests/ui/regions/regions-escape-method.stderr index 687b91bb7b47b..afd36e1015778 100644 --- a/tests/ui/regions/regions-escape-method.stderr +++ b/tests/ui/regions/regions-escape-method.stderr @@ -6,11 +6,6 @@ LL | s.f(|p| p) | || | |return type of closure is &'2 i32 | has type `&'1 i32` - | -help: dereference the return value - | -LL | s.f(|p| *p) - | + error: aborting due to 1 previous error diff --git a/tests/ui/regions/regions-free-region-ordering-callee-4.stderr b/tests/ui/regions/regions-free-region-ordering-callee-4.stderr index e6218079952f7..bc7c0c7064ad3 100644 --- a/tests/ui/regions/regions-free-region-ordering-callee-4.stderr +++ b/tests/ui/regions/regions-free-region-ordering-callee-4.stderr @@ -1,19 +1,10 @@ -error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references +error[E0623]: lifetime mismatch --> $DIR/regions-free-region-ordering-callee-4.rs:5:68 | LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-free-region-ordering-callee-4.rs:5:14 - | -LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { - | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-free-region-ordering-callee-4.rs:5:18 - | -LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { - | ^^ + | --------- --------- ^^^^^^^^^^^^^^^^^^^^^ ...but data from `b` flows into `a` here + | | + | these two types are declared with different lifetimes... error: lifetime may not live long enough --> $DIR/regions-free-region-ordering-callee-4.rs:8:12 @@ -30,4 +21,4 @@ LL | let z: Option<&'a &'b usize> = None; error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0623`. diff --git a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index 643746ed46fcf..937b7bcafbcf4 100644 --- a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -9,6 +9,12 @@ help: consider restricting type parameter `T` with trait `Trait2` LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) | ++++++++++++++++++++++++ +error: the type `&'x (dyn for<'z> Trait1<>::Foo> + 'x)` is not well-formed + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:25 + | +LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:25 | @@ -20,6 +26,28 @@ help: consider restricting type parameter `T` with trait `Trait2` LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) | ++++++++++++++++++++++++ -error: aborting due to 2 previous errors +error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:22 + | +LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) + | ^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` + | +help: consider restricting type parameter `T` with trait `Trait2` + | +LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) + | ++++++++++++++++++++++++ + +error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 + | +LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` + | +help: consider restricting type parameter `T` with trait `Trait2` + | +LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) + | ++++++++++++++++++++++++ + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/regions/regions-normalize-in-where-clause-list.stderr b/tests/ui/regions/regions-normalize-in-where-clause-list.stderr index 1a20055836acd..f4f4663baa766 100644 --- a/tests/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/tests/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -1,52 +1,20 @@ -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements +error[E0478]: lifetime bound not satisfied --> $DIR/regions-normalize-in-where-clause-list.rs:26:36 | LL | <() as Project<'a, 'b>>::Item: Eq, | ^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/regions-normalize-in-where-clause-list.rs:24:8 | LL | fn bar<'a, 'b>() | ^^ -note: ...but the lifetime must also be valid for the lifetime `'b` as defined here... +note: but lifetime parameter must outlive the lifetime `'b` as defined here --> $DIR/regions-normalize-in-where-clause-list.rs:24:12 | LL | fn bar<'a, 'b>() | ^^ -note: ...so that the types are compatible - --> $DIR/regions-normalize-in-where-clause-list.rs:26:36 - | -LL | <() as Project<'a, 'b>>::Item: Eq, - | ^^ - = note: expected `Project<'a, 'b>` - found `Project<'_, '_>` - -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-normalize-in-where-clause-list.rs:26:36 - | -LL | <() as Project<'a, 'b>>::Item: Eq, - | ^^ - | -note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-normalize-in-where-clause-list.rs:24:8 - | -LL | fn bar<'a, 'b>() - | ^^ -note: ...but the lifetime must also be valid for the lifetime `'b` as defined here... - --> $DIR/regions-normalize-in-where-clause-list.rs:24:12 - | -LL | fn bar<'a, 'b>() - | ^^ -note: ...so that the types are compatible - --> $DIR/regions-normalize-in-where-clause-list.rs:26:36 - | -LL | <() as Project<'a, 'b>>::Item: Eq, - | ^^ - = note: expected `Project<'a, 'b>` - found `Project<'_, '_>` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0803`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/regions/resolve-re-error-ice.stderr b/tests/ui/regions/resolve-re-error-ice.stderr index a5bbbd6813869..d1f3aa233e2c0 100644 --- a/tests/ui/regions/resolve-re-error-ice.stderr +++ b/tests/ui/regions/resolve-re-error-ice.stderr @@ -9,28 +9,21 @@ note: first, the lifetime cannot outlive the anonymous lifetime defined here... | LL | fn key_set(&self) -> Subject, (), R>; | ^^^^^ -note: ...so that the method type is compatible with trait +note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/resolve-re-error-ice.rs:12:5 | LL | fn key_set(&self) -> Subject<'a, Keys, (), R> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `fn(&Subject<'_, _, _, _>) -> Subject<'_, Keys<'_, _, _>, _, _>` - found `fn(&Subject<'_, _, _, _>) -> Subject<'a, Keys<'_, _, _>, _, _>` note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/resolve-re-error-ice.rs:10:6 | LL | impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap, (), R> | ^^ -note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds... +note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds --> $DIR/resolve-re-error-ice.rs:12:5 | LL | fn key_set(&self) -> Subject<'a, Keys, (), R> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...that is required by this bound - --> $DIR/resolve-re-error-ice.rs:8:29 - | -LL | struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr index c177c3bbf00be..072f130248972 100644 --- a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr +++ b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr @@ -1,13 +1,9 @@ -error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/higher-ranked-regions-diag.rs:19:5 +error[E0271]: type mismatch resolving ` as Trait<&()>>::Assoc == as Trait<&()>>::Assoc` + --> $DIR/higher-ranked-regions-diag.rs:18:13 | LL | fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> { - | -- ---------- opaque type defined here - | | - | hidden type ` Trait<&'a ()> as Trait<&'a ()>>::Assoc` captures the lifetime `'a` as defined here -LL | foo() - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0700`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr index 5c98a9d4fb4ce..fd7f6b08ea4db 100644 --- a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr +++ b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr @@ -1,38 +1,16 @@ -error: implementation of `Fn` is not general enough +error[E0277]: the trait bound `&fn(_) -> _ {id::<_>}: CoerceUnsized<&dyn for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Foo<'b>>` is not satisfied in `fn(&Foo<'_>) -> &Foo<'_> {id::<&Foo<'_>>}` --> $DIR/rfc1623-2.rs:28:8 | LL | f: &id, - | ^^^ implementation of `Fn` is not general enough - | - = note: `fn(&'2 Foo<'_>) -> &'2 Foo<'_> {id::<&'2 Foo<'_>>}` must implement `Fn<(&'1 Foo<'b>,)>`, for any lifetime `'1`... - = note: ...but it actually implements `Fn<(&'2 Foo<'_>,)>`, for some specific lifetime `'2` - -error: implementation of `Fn` is not general enough - --> $DIR/rfc1623-2.rs:28:8 - | -LL | f: &id, - | ^^^ implementation of `Fn` is not general enough - | - = note: `fn(&Foo<'2>) -> &Foo<'2> {id::<&Foo<'2>>}` must implement `Fn<(&'a Foo<'1>,)>`, for any lifetime `'1`... - = note: ...but it actually implements `Fn<(&Foo<'2>,)>`, for some specific lifetime `'2` - -error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623-2.rs:28:8 - | -LL | f: &id, - | ^^^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'2 Foo<'_>) -> &'2 Foo<'_> {id::<&'2 Foo<'_>>}` must implement `FnOnce<(&'1 Foo<'b>,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 Foo<'_>,)>`, for some specific lifetime `'2` - -error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623-2.rs:28:8 - | -LL | f: &id, - | ^^^ implementation of `FnOnce` is not general enough - | - = note: `fn(&Foo<'2>) -> &Foo<'2> {id::<&Foo<'2>>}` must implement `FnOnce<(&'a Foo<'1>,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&Foo<'2>,)>`, for some specific lifetime `'2` + | ^^^ unsatisfied trait bound + | + = help: within `fn(&Foo<'_>) -> &Foo<'_> {id::<&Foo<'_>>}`, the trait `for<'a, 'b> Fn(&'a Foo<'b>)` is not implemented for fn item `fn(&Foo<'_>) -> &Foo<'_> {id::<&Foo<'_>>}` + = note: expected a closure with signature `for<'a, 'b> fn(&'a Foo<'b>)` + found a closure with signature `fn(&Foo<'_>)` + = note: required because it appears within the type `fn(&Foo<'_>) -> &Foo<'_> {id::<&Foo<'_>>}` + = note: required for `&fn(&Foo<'_>) -> &Foo<'_> {id::<&Foo<'_>>}` to implement `CoerceUnsized<&dyn for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Foo<'b>>` + = note: required for the cast from `&fn(&Foo<'_>) -> &Foo<'_> {id::<&Foo<'_>>}` to `&dyn for<'a, 'b> Fn(&'a Foo<'b>) -> &'a Foo<'b>` -error: aborting due to 4 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr index b0f1d7b33e405..4dca80672960d 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr @@ -5,13 +5,8 @@ LL | bar: Bar | ^^^^^^ | | | the parameter type `U` must be valid for the static lifetime... - | ...so that the type `U` will meet its required lifetime bounds... + | ...so that the type `U` will meet its required lifetime bounds | -note: ...that is required by this bound - --> $DIR/dont-infer-static.rs:8:15 - | -LL | struct Bar { - | ^^^^^^^ help: consider adding an explicit lifetime bound | LL | struct Foo { diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr index 2799164bbda2c..9711b11cd67b7 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr @@ -11,6 +11,20 @@ help: consider adding an explicit lifetime bound LL | enum Ref1<'a, T: 'a> { | ++++ +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/regions-enum-not-wf.rs:17:18 + | +LL | enum Ref1<'a, T> { + | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... +LL | Ref1Variant1(RequireOutlives<'a, T>), + | ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | enum Ref1<'a, T: 'a> { + | ++++ + error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:22:25 | @@ -25,6 +39,21 @@ help: consider adding an explicit lifetime bound LL | enum Ref2<'a, T: 'a> { | ++++ +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/regions-enum-not-wf.rs:22:25 + | +LL | enum Ref2<'a, T> { + | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... +LL | Ref2Variant1, +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), + | ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | enum Ref2<'a, T: 'a> { + | ++++ + error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:35:23 | @@ -52,6 +81,20 @@ help: consider adding an explicit lifetime bound LL | enum RefDouble<'a, 'b, T: 'b> { | ++++ -error: aborting due to 4 previous errors +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/regions-enum-not-wf.rs:35:23 + | +LL | enum RefDouble<'a, 'b, T> { + | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... +LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider adding an explicit lifetime bound + | +LL | enum RefDouble<'a, 'b, T: 'b> { + | ++++ + +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr index 01a3f528359be..eb75c296b08c3 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references +error[E0477]: the type `Foo<'b>` does not fulfill the required lifetime --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9 | LL | type Out = &'a Foo<'b>; | ^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:14 - | -LL | impl<'a, 'b> Trait<'a, 'b> for usize { - | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr index ff4c5f072844c..859a644b96b63 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references +error[E0477]: the type `Foo<'b>` does not fulfill the required lifetime --> $DIR/regions-outlives-nominal-type-region.rs:17:9 | LL | type Out = &'a Foo<'b>; | ^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-region.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-nominal-type-region.rs:16:14 - | -LL | impl<'a, 'b> Trait<'a, 'b> for usize { - | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr index a0ede2aeadafa..07bcb09c5482d 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references +error[E0477]: the type `Foo<&'b i32>` does not fulfill the required lifetime --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9 | LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:14 - | -LL | impl<'a, 'b> Trait<'a, 'b> for usize { - | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr index 23d3f4ac606b7..58557f5147856 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references +error[E0477]: the type `Foo<&'b i32>` does not fulfill the required lifetime --> $DIR/regions-outlives-nominal-type-type.rs:17:9 | LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-type.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-nominal-type-type.rs:16:14 - | -LL | impl<'a, 'b> Trait<'a, 'b> for usize { - | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr index 73c0bbc44fb0d..48f607d2d055d 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr @@ -4,7 +4,7 @@ error[E0309]: the parameter type `T` may not live long enough LL | impl<'a, T> Trait<'a, T> for usize { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... LL | type Out = &'a T; - | ^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at + | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -17,36 +17,26 @@ error[E0309]: the parameter type `T` may not live long enough LL | impl<'a, T> Trait<'a, T> for u32 { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... LL | type Out = RefOk<'a, T>; - | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds | -note: ...that is required by this bound - --> $DIR/regions-struct-not-wf.rs:16:20 - | -LL | struct RefOk<'a, T:'a> { - | ^^ help: consider adding an explicit lifetime bound | LL | impl<'a, T: 'a> Trait<'a, T> for u32 { | ++++ -error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references +error[E0477]: the type `&'b T` does not fulfill the required lifetime --> $DIR/regions-struct-not-wf.rs:25:5 | LL | type Out = &'a &'b T; | ^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined here +note: type must outlive the lifetime `'a` as defined here --> $DIR/regions-struct-not-wf.rs:24:6 | LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-struct-not-wf.rs:24:10 - | -LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - | ^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0309, E0491. +Some errors have detailed explanations: E0309, E0477. For more information about an error, try `rustc --explain E0309`. diff --git a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index f8699f9e55e24..fc34e83362581 100644 --- a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -1,14 +1,8 @@ -error[E0277]: `NotDebug` doesn't implement `Debug` +error[E0277]: `&NotDebug` doesn't implement `Debug` --> $DIR/dbg-macro-requires-debug.rs:9:23 | LL | let _: NotDebug = dbg!(NotDebug); - | ^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `NotDebug` - | -help: consider annotating `NotDebug` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct NotDebug; - | + | ^^^^^^^^^^^^^^ within `&NotDebug`, the trait `Debug` is not implemented for `&NotDebug` error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2021.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2021.stderr index 40a32880f4071..8b5348adec0ae 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2021.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2021.stderr @@ -1139,6 +1139,14 @@ LL | if let 0 = 0? {} | = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}` +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/disallowed-positions.rs:113:20 + | +LL | fn _check_try_binds_tighter() -> Result<(), ()> { + | ----------------------------------------------- this function should return `Result` or `Option` to accept `?` +LL | if let 0 = 0? {} + | ^^ cannot use the `?` operator in a function that returns `{integer}` + error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:224:11 | @@ -1200,6 +1208,14 @@ LL | while let 0 = 0? {} | = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}` +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/disallowed-positions.rs:204:23 + | +LL | fn _check_try_binds_tighter() -> Result<(), ()> { + | ----------------------------------------------- this function should return `Result` or `Option` to accept `?` +LL | while let 0 = 0? {} + | ^^ cannot use the `?` operator in a function that returns `{integer}` + error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:333:10 | @@ -1219,7 +1235,15 @@ LL | let 0 = 0?; | = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}` -error: aborting due to 134 previous errors +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/disallowed-positions.rs:308:17 + | +LL | fn _check_try_binds_tighter() -> Result<(), ()> { + | ----------------------------------------------- this function should return `Result` or `Option` to accept `?` +LL | let 0 = 0?; + | ^^ cannot use the `?` operator in a function that returns `{integer}` + +error: aborting due to 137 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2024.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2024.stderr index 21167cf63d176..ca9c4eb47116f 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2024.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.e2024.stderr @@ -1085,6 +1085,14 @@ LL | if let 0 = 0? {} | = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}` +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/disallowed-positions.rs:113:20 + | +LL | fn _check_try_binds_tighter() -> Result<(), ()> { + | ----------------------------------------------- this function should return `Result` or `Option` to accept `?` +LL | if let 0 = 0? {} + | ^^ cannot use the `?` operator in a function that returns `{integer}` + error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:224:11 | @@ -1146,6 +1154,14 @@ LL | while let 0 = 0? {} | = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}` +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/disallowed-positions.rs:204:23 + | +LL | fn _check_try_binds_tighter() -> Result<(), ()> { + | ----------------------------------------------- this function should return `Result` or `Option` to accept `?` +LL | while let 0 = 0? {} + | ^^ cannot use the `?` operator in a function that returns `{integer}` + error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:333:10 | @@ -1165,7 +1181,15 @@ LL | let 0 = 0?; | = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}` -error: aborting due to 125 previous errors +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/disallowed-positions.rs:308:17 + | +LL | fn _check_try_binds_tighter() -> Result<(), ()> { + | ----------------------------------------------- this function should return `Result` or `Option` to accept `?` +LL | let 0 = 0?; + | ^^ cannot use the `?` operator in a function that returns `{integer}` + +error: aborting due to 128 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr index 8e2c02f15c5d0..b8220ca27c518 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic.stderr @@ -1,114 +1,98 @@ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:16:55 +error[E0275]: overflow evaluating the requirement `basic_pass::test::{opaque#0} == ()` + --> $DIR/higher-ranked-regions-basic.rs:16:18 | -LL | type Opq<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -LL | #[define_opaque(Opq)] LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq<'a>> {} - | ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`higher_ranked_regions_basic`) -error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/higher-ranked-regions-basic.rs:22:58 +error[E0271]: type mismatch resolving `<() as Trait<'a>>::Ty == &()` + --> $DIR/higher-ranked-regions-basic.rs:22:18 | LL | fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {} - | -- ---------- ^^ - | | | - | | opaque type defined here - | hidden type `&'a ()` captures the lifetime `'a` as defined here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Trait<'a>>::Ty == &()` + | +note: types differ + --> $DIR/higher-ranked-regions-basic.rs:9:15 + | +LL | type Ty = &'a (); + | ^^^^^^ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:32:23 +error[E0271]: type mismatch resolving `<() as Trait<'a>>::Ty == Opq1<'a>` + --> $DIR/higher-ranked-regions-basic.rs:32:18 | -LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>; - | -- this generic parameter must be used with a generic lifetime parameter -... LL | fn test() -> Opq2 {} - | ^^ + | ^^^^ type mismatch resolving `<() as Trait<'a>>::Ty == Opq1<'a>` + | +note: types differ + --> $DIR/higher-ranked-regions-basic.rs:9:15 + | +LL | type Ty = &'a (); + | ^^^^^^ -error[E0700]: hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds - --> $DIR/higher-ranked-regions-basic.rs:32:23 - | -LL | type Opq0 = impl Sized; - | ---------- opaque type defined here -LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>; - | -- hidden type `&'b ()` captures the lifetime `'b` as defined here -... -LL | fn test() -> Opq2 {} - | ^^ +error[E0275]: overflow evaluating the requirement `capture_tait::Opq2 == _` -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:43:23 +error: item does not constrain `capture_tait_complex_pass::Opq2::{opaque#0}` + --> $DIR/higher-ranked-regions-basic.rs:43:8 | -LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b - | -- this generic parameter must be used with a generic lifetime parameter -... LL | fn test() -> Opq2 {} - | ^^ - -error[E0792]: expected generic lifetime parameter, found `'b` - --> $DIR/higher-ranked-regions-basic.rs:43:23 + | ^^^^ | -LL | type Opq0<'a> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | fn test() -> Opq2 {} - | ^^ - -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:55:23 + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/higher-ranked-regions-basic.rs:41:17 | -LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | fn test() -> Opq2 {} - | ^^ +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:55:23 +error[E0275]: overflow evaluating the requirement `capture_tait_complex_pass::Opq2 == _` + +error[E0271]: type mismatch resolving `<() as Trait<'a>>::Ty == Opq1<'a>` + --> $DIR/higher-ranked-regions-basic.rs:55:18 | -LL | type Opq0<'a> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -... LL | fn test() -> Opq2 {} - | ^^ + | ^^^^ type mismatch resolving `<() as Trait<'a>>::Ty == Opq1<'a>` + | +note: types differ + --> $DIR/higher-ranked-regions-basic.rs:9:15 + | +LL | type Ty = &'a (); + | ^^^^^^ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:65:65 +error[E0275]: overflow evaluating the requirement `capture_tait_complex_fail::Opq2 == _` + +error[E0275]: overflow evaluating the requirement `constrain_fail0::test::{opaque#0} == ()` + --> $DIR/higher-ranked-regions-basic.rs:65:18 | -LL | type Opq0<'a, 'b> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -LL | #[define_opaque(Opq0)] LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {} - | ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`higher_ranked_regions_basic`) -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:74:60 +error[E0275]: overflow evaluating the requirement `constrain_fail::test::{opaque#0} == ()` + --> $DIR/higher-ranked-regions-basic.rs:74:18 | -LL | type Opq0<'a, 'b> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -LL | #[define_opaque(Opq0)] LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {} - | ^^ - -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:84:23 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | fn test() -> Opq2 {} - | ^^ + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`higher_ranked_regions_basic`) -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-basic.rs:84:23 +error: item does not constrain `constrain_pass::Opq2::{opaque#0}` + --> $DIR/higher-ranked-regions-basic.rs:84:8 | -LL | type Opq0<'a, 'b> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -... LL | fn test() -> Opq2 {} - | ^^ + | ^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/higher-ranked-regions-basic.rs:82:17 + | +LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `constrain_pass::Opq2 == _` error: aborting due to 12 previous errors -Some errors have detailed explanations: E0700, E0792. -For more information about an error, try `rustc --explain E0700`. +Some errors have detailed explanations: E0271, E0275. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr index b3edc9427327e..aee571705f85d 100644 --- a/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr +++ b/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-gat.stderr @@ -1,12 +1,15 @@ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/higher-ranked-regions-gat.rs:19:5 +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/higher-ranked-regions-gat.rs:18:4 | -LL | pub type FooAssoc<'a> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | Struct - | ^^^^^^ +LL | fn foo() -> Foo { + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/higher-ranked-regions-gat.rs:9:16 + | +LL | pub type Foo = impl for<'a> Trait = FooAssoc<'a>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. 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 7cf9c9a3afd4d..d8d867289915a 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr @@ -106,7 +106,7 @@ error[E0599]: the method `get` exists for struct `Rc>`, but its trait bou --> $DIR/arbitrary-self-from-method-substs.rs:100:7 | LL | struct Bar(std::marker::PhantomData); - | ------------- doesn't satisfy `Bar<_>: Deref` + | ------------- doesn't satisfy ` as Deref>::Target = Bar>` or `Bar<_>: Deref` ... LL | t.get(); | ^^^ method cannot be called on `Rc>` due to unsatisfied trait bounds @@ -135,7 +135,7 @@ error[E0599]: the method `get` exists for reference `&Rc>`, but its trait --> $DIR/arbitrary-self-from-method-substs.rs:108:7 | LL | struct Bar(std::marker::PhantomData); - | ------------- doesn't satisfy `Bar<_>: Deref` + | ------------- doesn't satisfy ` as Deref>::Target = Bar>` or `Bar<_>: Deref` ... LL | t.get(); | ^^^ method cannot be called on `&Rc>` due to unsatisfied trait bounds diff --git a/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr index f67918a2577ac..76074e3309fb3 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr @@ -117,7 +117,7 @@ error[E0599]: the method `get` exists for struct `Rc>`, but its trait bou --> $DIR/arbitrary-self-from-method-substs.rs:100:7 | LL | struct Bar(std::marker::PhantomData); - | ------------- doesn't satisfy `Bar<_>: Deref` + | ------------- doesn't satisfy ` as Deref>::Target = Bar>` or `Bar<_>: Deref` ... LL | t.get(); | ^^^ method cannot be called on `Rc>` due to unsatisfied trait bounds @@ -146,7 +146,7 @@ error[E0599]: the method `get` exists for reference `&Rc>`, but its trait --> $DIR/arbitrary-self-from-method-substs.rs:108:7 | LL | struct Bar(std::marker::PhantomData); - | ------------- doesn't satisfy `Bar<_>: Deref` + | ------------- doesn't satisfy ` as Deref>::Target = Bar>` or `Bar<_>: Deref` ... LL | t.get(); | ^^^ method cannot be called on `&Rc>` due to unsatisfied trait bounds diff --git a/tests/ui/self/arbitrary-self-opaque.stderr b/tests/ui/self/arbitrary-self-opaque.stderr index 36ae3d6fd02bb..72249230c072f 100644 --- a/tests/ui/self/arbitrary-self-opaque.stderr +++ b/tests/ui/self/arbitrary-self-opaque.stderr @@ -7,19 +7,15 @@ LL | fn foo(self: Bar) {} = note: type of `self` must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) -error: item does not constrain `Bar::{opaque#0}` - --> $DIR/arbitrary-self-opaque.rs:8:8 +error[E0282]: type annotations needed + --> $DIR/arbitrary-self-opaque.rs:8:18 | LL | fn foo(self: Bar) {} - | ^^^ - | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/arbitrary-self-opaque.rs:4:12 + | ^^^ cannot infer type | -LL | type Bar = impl Sized; - | ^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0307`. +Some errors have detailed explanations: E0282, E0307. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/self/arbitrary-self-types-dyn-receiver.stderr b/tests/ui/self/arbitrary-self-types-dyn-receiver.stderr index 24acb56ffb1b3..009f5d6850552 100644 --- a/tests/ui/self/arbitrary-self-types-dyn-receiver.stderr +++ b/tests/ui/self/arbitrary-self-types-dyn-receiver.stderr @@ -10,63 +10,23 @@ note: for a trait to be dyn compatible it needs to allow building a vtable | = note: the trait is not dyn compatible because it opted out of dyn-compatibility -error[E0038]: the trait `std::ops::Receiver` is not dyn compatible +error[E0307]: invalid `self` parameter type: `&dyn std::ops::Receiver` --> $DIR/arbitrary-self-types-dyn-receiver.rs:14:18 | LL | fn foo(self: &dyn Receiver) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::ops::Receiver` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $SRC_DIR/core/src/ops/deref.rs:LL:COL - | - = note: the trait is not dyn compatible because it opted out of dyn-compatibility - -error[E0038]: the trait `std::ops::Receiver` is not dyn compatible - --> $DIR/arbitrary-self-types-dyn-receiver.rs:14:19 - | -LL | fn foo(self: &dyn Receiver) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `std::ops::Receiver` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $SRC_DIR/core/src/ops/deref.rs:LL:COL - | - = note: the trait is not dyn compatible because it opted out of dyn-compatibility -help: you might have meant to use `Self` to refer to the implementing type - | -LL - fn foo(self: &dyn Receiver) { -LL + fn foo(self: &Self) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box`, `self: Rc`, or `self: Arc` -error[E0038]: the trait `std::ops::Receiver` is not dyn compatible +error[E0307]: invalid `self` parameter type: `&dyn std::ops::Receiver` --> $DIR/arbitrary-self-types-dyn-receiver.rs:7:18 | LL | fn foo(self: &dyn Receiver); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::ops::Receiver` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $SRC_DIR/core/src/ops/deref.rs:LL:COL - | - = note: the trait is not dyn compatible because it opted out of dyn-compatibility - -error[E0038]: the trait `std::ops::Receiver` is not dyn compatible - --> $DIR/arbitrary-self-types-dyn-receiver.rs:7:19 - | -LL | fn foo(self: &dyn Receiver); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `std::ops::Receiver` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $SRC_DIR/core/src/ops/deref.rs:LL:COL - | - = note: the trait is not dyn compatible because it opted out of dyn-compatibility -help: you might have meant to use `Self` to refer to the implementing type - | -LL - fn foo(self: &dyn Receiver); -LL + fn foo(self: &Self); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box`, `self: Rc`, or `self: Arc` error[E0038]: the trait `std::ops::Receiver` is not dyn compatible --> $DIR/arbitrary-self-types-dyn-receiver.rs:24:17 @@ -80,6 +40,7 @@ note: for a trait to be dyn compatible it needs to allow building a vtable | = note: the trait is not dyn compatible because it opted out of dyn-compatibility -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0307. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed index 8064ff2f20b95..1a613d130a5c9 100644 --- a/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed +++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed @@ -8,6 +8,5 @@ impl S { } fn main() { - let mut pinned = std::pin::pin!(S); - pinned.as_mut().x(); //~ ERROR no method named `x` found + Pin::new(&mut S).x(); //~ ERROR no method named `x` found } diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr index f33b9ec68b978..7c436ffb2fb23 100644 --- a/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr +++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr @@ -4,14 +4,16 @@ error[E0599]: no method named `x` found for struct `S` in the current scope LL | struct S; | -------- method `x` not found for this struct ... +LL | fn x(self: Pin<&mut Self>) { + | - the method is available for `Pin<&mut S>` here +... LL | S.x(); | ^ method not found in `S` | -help: consider pinning the expression - | -LL ~ let mut pinned = std::pin::pin!(S); -LL ~ pinned.as_mut().x(); +help: consider wrapping the receiver expression with the appropriate type | +LL | Pin::new(&mut S).x(); + | +++++++++++++ + error: aborting due to 1 previous error diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr index 216b705348899..193fa6b255695 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr @@ -1,8 +1,8 @@ error[E0700]: hidden type for `impl Clone` captures lifetime that does not appear in bounds - --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:48 + --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:5 | LL | async fn f(self: Pin<&Self>) -> impl Clone { self } - | ----- ---------- ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^-----^^^^^^---------- | | | | | opaque type defined here | hidden type `Pin<&Foo>` captures the anonymous lifetime defined here diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr index 7a2ce110a3897..653db893f6285 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr @@ -1,8 +1,8 @@ error[E0700]: hidden type for `impl Clone` captures lifetime that does not appear in bounds - --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait.rs:6:44 + --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait.rs:6:5 | LL | fn f(self: Pin<&Self>) -> impl Clone { self } - | ----- ---------- ^^^^ + | ^^^^^^^^^^^^^^^-----^^^^^^---------- | | | | | opaque type defined here | hidden type `Pin<&Foo>` captures the anonymous lifetime defined here diff --git a/tests/ui/self/dispatch-dyn-incompatible-that-does-not-deref.stderr b/tests/ui/self/dispatch-dyn-incompatible-that-does-not-deref.stderr index 276da3ebaf9bc..ecf7f79e0dca6 100644 --- a/tests/ui/self/dispatch-dyn-incompatible-that-does-not-deref.stderr +++ b/tests/ui/self/dispatch-dyn-incompatible-that-does-not-deref.stderr @@ -27,7 +27,16 @@ LL | fn method(self: &W) {} = note: type of `self` must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) -error: aborting due to 2 previous errors +error[E0599]: no method named `method` found for reference `&dyn Foo` in the current scope + --> $DIR/dispatch-dyn-incompatible-that-does-not-deref.rs:14:7 + | +LL | fn method(self: &W) {} + | -- the method might not be found because of this arbitrary self type +... +LL | x.method(); + | ^^^^^^ method not found in `&dyn Foo` + +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0038, E0307. +Some errors have detailed explanations: E0038, E0307, E0599. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/self/elision/no-shadow-pin-self.stderr b/tests/ui/self/elision/no-shadow-pin-self.stderr index 2b2559d5a4274..edadc7d3c7ba3 100644 --- a/tests/ui/self/elision/no-shadow-pin-self.stderr +++ b/tests/ui/self/elision/no-shadow-pin-self.stderr @@ -1,19 +1,29 @@ -error: `impl` item signature doesn't match `trait` item signature +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements --> $DIR/no-shadow-pin-self.rs:10:5 | -LL | trait Trait { +LL | fn method(self: Pin<&Self>, f: &u32) -> &u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/no-shadow-pin-self.rs:3:29 + | LL | fn method<'a>(self: Pin<&Self>, f: &'a u32) -> &'a u32 { - | ------------------------------------------------------ expected `fn(Pin<&'1 Pin

>, &'a u32) -> &'a u32` -... -LL | impl

Trait for Pin

{ -LL | // This should not hide `&Self`, which would cause this to compile. + | ^^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/no-shadow-pin-self.rs:10:5 + | LL | fn method(self: Pin<&Self>, f: &u32) -> &u32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(Pin<&'1 Pin

>, &'2 u32) -> &'1 u32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but, the lifetime must be valid for the lifetime `'a` as defined here... + --> $DIR/no-shadow-pin-self.rs:3:15 | - = note: expected signature `fn(Pin<&'1 Pin

>, &'a u32) -> &'a u32` - found signature `fn(Pin<&'1 Pin

>, &'2 u32) -> &'1 u32` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output +LL | fn method<'a>(self: Pin<&Self>, f: &'a u32) -> &'a u32 { + | ^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/no-shadow-pin-self.rs:10:5 + | +LL | fn method(self: Pin<&Self>, f: &u32) -> &u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: lifetime may not live long enough --> $DIR/no-shadow-pin-self.rs:12:9 @@ -33,3 +43,4 @@ LL | fn method<'a>(self: Pin<&Self>, f: &'a u32) -> &'a u32 { error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/sized-hierarchy/impls.stderr b/tests/ui/sized-hierarchy/impls.stderr index dc30a3ea998f8..4199ca110dc15 100644 --- a/tests/ui/sized-hierarchy/impls.stderr +++ b/tests/ui/sized-hierarchy/impls.stderr @@ -52,6 +52,24 @@ help: the `Box` type always has a statically known size and allocates its conten LL | enum EnumAllFieldsMetaSized { Qux { x: Box<[u8]>, y: [u8] } } | ++++ + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/impls.rs:279:53 + | +LL | enum EnumAllFieldsMetaSized { Qux { x: [u8], y: [u8] } } + | ^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: no field of an enum variant may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | enum EnumAllFieldsMetaSized { Qux { x: [u8], y: &[u8] } } + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | enum EnumAllFieldsMetaSized { Qux { x: [u8], y: Box<[u8]> } } + | ++++ + + error[E0277]: the size for values of type `main::Foo` cannot be known at compilation time --> $DIR/impls.rs:286:42 | @@ -70,6 +88,24 @@ help: the `Box` type always has a statically known size and allocates its conten LL | enum EnumAllFieldsUnsized { Qux { x: Box, y: Foo } } | ++++ + +error[E0277]: the size for values of type `main::Foo` cannot be known at compilation time + --> $DIR/impls.rs:286:50 + | +LL | enum EnumAllFieldsUnsized { Qux { x: Foo, y: Foo } } + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `main::Foo` + = note: no field of an enum variant may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | enum EnumAllFieldsUnsized { Qux { x: Foo, y: &Foo } } + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | enum EnumAllFieldsUnsized { Qux { x: Foo, y: Box } } + | ++++ + + error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/impls.rs:293:52 | @@ -177,8 +213,13 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | needs_sized::<([u8], [u8])>(); | ^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `Sized` is not implemented for `[u8]` - = note: only the last element of a tuple may have a dynamically sized type + = help: within `([u8], [u8])`, the trait `Sized` is not implemented for `[u8]` + = note: required because it appears within the type `([u8], [u8])` +note: required by a bound in `needs_sized` + --> $DIR/impls.rs:13:19 + | +LL | fn needs_sized() { } + | ^^^^^ required by this bound in `needs_sized` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/impls.rs:195:23 @@ -204,8 +245,13 @@ error[E0277]: the size for values of type `main::Foo` cannot be known at compila LL | needs_sized::<(Foo, Foo)>(); | ^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `Sized` is not implemented for `main::Foo` - = note: only the last element of a tuple may have a dynamically sized type + = help: within `(main::Foo, main::Foo)`, the trait `Sized` is not implemented for `main::Foo` + = note: required because it appears within the type `(main::Foo, main::Foo)` +note: required by a bound in `needs_sized` + --> $DIR/impls.rs:13:19 + | +LL | fn needs_sized() { } + | ^^^^^ required by this bound in `needs_sized` error[E0277]: the size for values of type `main::Foo` cannot be known at compilation time --> $DIR/impls.rs:203:23 @@ -395,6 +441,6 @@ note: required by a bound in `needs_metasized` LL | fn needs_metasized() { } | ^^^^^^^^^ required by this bound in `needs_metasized` -error: aborting due to 27 previous errors +error: aborting due to 29 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr b/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr index 532d133b78580..5c5d60232f642 100644 --- a/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr +++ b/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr @@ -1,10 +1,19 @@ error[E0277]: the size for values of type `impl Tr + ?Sized` cannot be known at compilation time --> $DIR/pretty-print-opaque-no-feat.rs:9:26 | +LL | pub fn foo() -> Box { + | ---------------- within this `impl Tr + ?Sized` +... LL | let _: Box = foo(); | ^^^^^ doesn't have a size known at compile-time | - = help: the trait `Sized` is not implemented for `impl Tr + ?Sized` + = help: within `impl Tr + ?Sized`, the trait `Sized` is not implemented for `impl Tr + ?Sized` +note: required because it appears within the type `impl Tr + ?Sized` + --> $DIR/pretty-print-opaque-no-feat.rs:4:21 + | +LL | pub fn foo() -> Box { + | ^^^^^^^^^^^^^^^^ + = note: required for `Box` to implement `CoerceUnsized>` = note: required for the cast from `Box` to `Box` error: aborting due to 1 previous error diff --git a/tests/ui/sized-hierarchy/pretty-print-opaque.stderr b/tests/ui/sized-hierarchy/pretty-print-opaque.stderr index 9f9289d0f3918..ff91d36239809 100644 --- a/tests/ui/sized-hierarchy/pretty-print-opaque.stderr +++ b/tests/ui/sized-hierarchy/pretty-print-opaque.stderr @@ -8,52 +8,6 @@ LL | pub fn pointeesized() -> Box { note: required by a bound in `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL -error[E0277]: the size for values of type `impl Tr + MetaSized` cannot be known at compilation time - --> $DIR/pretty-print-opaque.rs:20:30 - | -LL | let y: Box = x; - | ^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `impl Tr + MetaSized` - = note: required for the cast from `Box` to `Box` - -error[E0277]: the size for values of type `impl Tr + MetaSized` cannot be known at compilation time - --> $DIR/pretty-print-opaque.rs:29:30 - | -LL | let y: Box = x; - | ^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `impl Tr + MetaSized` - = note: required for the cast from `Box` to `Box` - -error[E0277]: the size for values of type `impl Tr + PointeeSized` cannot be known - --> $DIR/pretty-print-opaque.rs:38:17 - | -LL | let x = pointeesized(); - | ^^^^^^^^^^^^^^ doesn't have a known size - | - = help: the nightly-only, unstable trait `MetaSized` is not implemented for `impl Tr + PointeeSized` -note: required by a bound in `Box` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - -error[E0277]: the size for values of type `impl Tr + PointeeSized` cannot be known at compilation time - --> $DIR/pretty-print-opaque.rs:40:30 - | -LL | let y: Box = x; - | ^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `impl Tr + PointeeSized` - = note: required for the cast from `Box` to `Box` - -error[E0277]: the size for values of type `impl Tr + PointeeSized` cannot be known - --> $DIR/pretty-print-opaque.rs:40:30 - | -LL | let y: Box = x; - | ^ doesn't have a known size - | - = help: the nightly-only, unstable trait `MetaSized` is not implemented for `impl Tr + PointeeSized` - = note: required for the cast from `Box` to `Box` - -error: aborting due to 6 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/sized/unsized-inference.stderr b/tests/ui/sized/unsized-inference.stderr index dd8873430cee3..5615e000914e8 100644 --- a/tests/ui/sized/unsized-inference.stderr +++ b/tests/ui/sized/unsized-inference.stderr @@ -17,13 +17,6 @@ LL | let y: Vec = x.into_iter().collect(); = help: the trait `FromIterator<{integer}>` is not implemented for `Vec` help: the trait `FromIterator` is implemented for `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -note: the method call chain might not have had the expected associated types - --> $DIR/unsized-inference.rs:6:33 - | -LL | let x = vec![1, 2, 3]; - | ------------- this expression has type `Vec<{integer}>` -LL | let y: Vec = x.into_iter().collect(); - | ^^^^^^^^^^^ `Iterator::Item` is `{integer}` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL diff --git a/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.stderr b/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.stderr index cf7c748ae0b5f..a04ab9c3fb783 100644 --- a/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.stderr +++ b/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.stderr @@ -3,16 +3,8 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t | LL | fn foo() -> impl Sized { | ^^^^^^^^^^ doesn't have a size known at compile-time -... -LL | *"" - | --- return type was inferred to be `str` here | = help: the trait `Sized` is not implemented for `str` -help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression - | -LL - *"" -LL + "" - | error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:15:9 diff --git a/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr b/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr index 8ccf0c23dbd95..cab27c1db7eb1 100644 --- a/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr +++ b/tests/ui/specialization/coherence/default-impl-normalization-ambig-2.stderr @@ -10,6 +10,19 @@ help: the trait `Assoc` is implemented for `u8` LL | impl Assoc for u8 {} | ^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0277]: the trait bound `u16: Assoc` is not satisfied + --> $DIR/default-impl-normalization-ambig-2.rs:17:14 + | +LL | impl Foo for ::Output {} + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Assoc` is not implemented for `u16` + | +help: the trait `Assoc` is implemented for `u8` + --> $DIR/default-impl-normalization-ambig-2.rs:12:1 + | +LL | impl Assoc for u8 {} + | ^^^^^^^^^^^^^^^^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/specialization/default-generic-associated-type-bound.stderr b/tests/ui/specialization/default-generic-associated-type-bound.stderr index df5ccb00779ee..de70b62ef9e32 100644 --- a/tests/ui/specialization/default-generic-associated-type-bound.stderr +++ b/tests/ui/specialization/default-generic-associated-type-bound.stderr @@ -1,20 +1,20 @@ -error[E0277]: can't compare `T` with `T` +error[E0277]: can't compare `&'a T` with `&'a T` --> $DIR/default-generic-associated-type-bound.rs:16:26 | LL | default type U<'a> = &'a T; - | ^^^^^ no implementation for `T == T` + | ^^^^^ no implementation for `&'a T == &'a T` | - = note: required for `&'a T` to implement `PartialEq` + = help: the trait `PartialEq` is not implemented for `&'a T` note: required by a bound in `X::U` --> $DIR/default-generic-associated-type-bound.rs:6:17 | LL | trait X { LL | type U<'a>: PartialEq<&'a Self> where Self: 'a; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `X::U` -help: consider further restricting type parameter `T` with trait `PartialEq` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | impl X for T { - | +++++++++++++++++++++ +LL | impl X for T where &'a T: PartialEq { + | ++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/specialization/default-impl-not-an-impl.stderr b/tests/ui/specialization/default-impl-not-an-impl.stderr index cde757b3f98a7..869af9b5d6b17 100644 --- a/tests/ui/specialization/default-impl-not-an-impl.stderr +++ b/tests/ui/specialization/default-impl-not-an-impl.stderr @@ -34,12 +34,14 @@ note: `Foo` defines an item `f`, perhaps you need to implement it LL | trait Foo { | ^^^^^^^^^ -error[E0277]: the trait bound `u32: Foo` is not satisfied +error[E0277]: the trait bound `&u32: CoerceUnsized<&dyn Foo>` is not satisfied in `u32` --> $DIR/default-impl-not-an-impl.rs:65:23 | LL | let _: &dyn Foo = &0u32; - | ^^^^^ the trait `Foo` is not implemented for `u32` + | ^^^^^ within `u32`, the trait `Foo` is not implemented for `u32` | + = note: required because it appears within the type `u32` + = note: required for `&u32` to implement `CoerceUnsized<&dyn Foo>` = note: required for the cast from `&u32` to `&dyn Foo` error[E0277]: the trait bound `i64: Bar` is not satisfied 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 index 8df76b296acd6..d80a5e5cb7385 100644 --- 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 @@ -6,19 +6,22 @@ LL | struct Wrapper::Type> {} | = note: the only supported types are integers, `bool`, and `char` -error: the constant `C` is not of type `::Type` +error[E0271]: type mismatch resolving `::Type == usize` --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:15:22 | LL | impl Wrapper {} - | ^^^^^^^^^^ expected associated type, found `usize` + | ^^^^^^^^^^ expected `usize`, found associated type | + = note: expected type `usize` + found associated type `::Type` = help: consider constraining the associated type `::Type` to `usize` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html -note: required by a const generic parameter in `Wrapper` +note: required by a bound in `Wrapper` --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:12:16 | LL | struct Wrapper::Type> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Wrapper` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper` error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr index aaf020450d397..98bea31c8e54a 100644 --- a/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -14,6 +14,22 @@ help: consider restricting type parameter `U` with trait `Eq` LL | default impl Foo<'static, U> for () {} | ++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `U: Eq` is not satisfied + --> $DIR/specialization-wfcheck.rs:7:1 + | +LL | default impl Foo<'static, U> for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `U` + | +note: required by a bound in `Foo` + --> $DIR/specialization-wfcheck.rs:5:18 + | +LL | trait Foo<'a, T: Eq + 'a> { } + | ^^ required by this bound in `Foo` +help: consider restricting type parameter `U` with trait `Eq` + | +LL | default impl Foo<'static, U> for () {} + | ++++++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr index bc1e57ff00b7c..2ad652810e7d7 100644 --- a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr @@ -16,6 +16,25 @@ LL | trait Iterate<'a> { LL | type Ty: Valid; | ^^^^^ required by this bound in `Iterate::Ty` +error[E0277]: the trait bound `T: Check` is not satisfied + --> $DIR/fuzzing-ice-134905.rs:17:1 + | +LL | impl<'a, T> Eq for T where >::Ty: Valid {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Check` is not implemented for `T` + | +note: required for `T` to implement `Iterate<'a>` + --> $DIR/fuzzing-ice-134905.rs:8:13 + | +LL | impl<'a, T> Iterate<'a> for T + | ^^^^^^^^^^^ ^ +LL | where +LL | T: Check, + | ----- unsatisfied trait bound introduced here +help: consider further restricting type parameter `T` with trait `Check` + | +LL | impl<'a, T> Eq for T where >::Ty: Valid, T: Check {} + | ++++++++++ + error[E0210]: type parameter `T` must be used as an argument to some local type (e.g., `MyStruct`) --> $DIR/fuzzing-ice-134905.rs:17:10 | @@ -25,7 +44,7 @@ LL | impl<'a, T> Eq for T where >::Ty: Valid {} = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0210, E0277. For more information about an error, try `rustc --explain E0210`. diff --git a/tests/ui/specialization/issue-38091.stderr b/tests/ui/specialization/issue-38091.stderr index 68a5947e77067..eff3d633dbb78 100644 --- a/tests/ui/specialization/issue-38091.stderr +++ b/tests/ui/specialization/issue-38091.stderr @@ -16,6 +16,21 @@ LL | trait Iterate<'a> { LL | type Ty: Valid; | ^^^^^ required by this bound in `Iterate::Ty` -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `>::Ty == _` + --> $DIR/issue-38091.rs:17:1 + | +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `i32: Iterate<'_>` + --> $DIR/issue-38091.rs:22:22 + | +LL | Iterate::iterate(0); + | ---------------- ^ + | | + | required by a bound introduced by this call + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0275, E0277. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/specialization/issue-39448.stderr b/tests/ui/specialization/issue-39448.stderr index df1a40b6b605d..f6ab746b308b6 100644 --- a/tests/ui/specialization/issue-39448.stderr +++ b/tests/ui/specialization/issue-39448.stderr @@ -4,8 +4,7 @@ error[E0391]: cycle detected when computing whether impls specialize one another LL | impl> FromA for U { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...which requires evaluating trait selection obligation `u16: FromA`... - = note: ...which again requires computing whether impls specialize one another, completing the cycle + = note: ...which immediately requires computing whether impls specialize one another again note: cycle used when building specialization graph of trait `FromA` --> $DIR/issue-39448.rs:20:1 | diff --git a/tests/ui/specialization/issue-39618.stderr b/tests/ui/specialization/issue-39618.stderr index 5517ed36e1a88..fcd6f1efe78d7 100644 --- a/tests/ui/specialization/issue-39618.stderr +++ b/tests/ui/specialization/issue-39618.stderr @@ -4,8 +4,7 @@ error[E0391]: cycle detected when computing whether impls specialize one another LL | impl Foo for T where T: Bar { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...which requires evaluating trait selection obligation `u64: Bar`... - = note: ...which again requires computing whether impls specialize one another, completing the cycle + = note: ...which immediately requires computing whether impls specialize one another again note: cycle used when building specialization graph of trait `Foo` --> $DIR/issue-39618.rs:7:1 | diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr index 9b6c931f90949..07cfbc5730bb6 100644 --- a/tests/ui/specialization/min_specialization/issue-79224.stderr +++ b/tests/ui/specialization/min_specialization/issue-79224.stderr @@ -1,51 +1,102 @@ -error[E0277]: the trait bound `B: Clone` is not satisfied +error[E0277]: the size for values of type `B` cannot be known at compilation time --> $DIR/issue-79224.rs:30:5 | +LL | impl Display for Cow<'_, B> { + | - this type parameter needs to be `Sized` +LL | LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = note: required for `B` to implement `ToOwned` -help: consider further restricting type parameter `B` with trait `Clone` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Display for Cow<'_, B> { +LL + impl Display for Cow<'_, B> { | -LL | impl Display for Cow<'_, B> { - | +++++++++++++++++++ -error[E0277]: the trait bound `B: Clone` is not satisfied - --> $DIR/issue-79224.rs:28:29 +error[E0276]: impl has stricter requirements than trait + --> $DIR/issue-79224.rs:30:5 + | +LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `&Cow<'_, B> well-formed` + +error[E0277]: the size for values of type `B` cannot be known at compilation time + --> $DIR/issue-79224.rs:28:17 | LL | impl Display for Cow<'_, B> { - | ^^^^^^^^^^ the trait `Clone` is not implemented for `B` + | - ^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` | = note: required for `B` to implement `ToOwned` -help: consider further restricting type parameter `B` with trait `Clone` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Display for Cow<'_, B> { +LL + impl Display for Cow<'_, B> { + | + +error[E0277]: `Cow<'_, B>` doesn't implement `std::fmt::Display` + --> $DIR/issue-79224.rs:28:29 + | +LL | impl Display for Cow<'_, B> { + | ^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `std::fmt::Display` is not implemented for `Cow<'_, B>` + --> $DIR/issue-79224.rs:14:1 | -LL | impl Display for Cow<'_, B> { - | +++++++++++++++++++ +LL | pub enum Cow<'a, B: ?Sized + 'a, O = ::Owned> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl Display for Cow<'_, B> where Cow<'_, B>: std::fmt::Display { + | +++++++++++++++++++++++++++++++++++ -error[E0277]: the trait bound `B: Clone` is not satisfied - --> $DIR/issue-79224.rs:30:13 +error: the type `Cow<'_, B>` is not well-formed + --> $DIR/issue-79224.rs:28:29 | +LL | impl Display for Cow<'_, B> { + | ^^^^^^^^^^ + +error[E0277]: the size for values of type `B` cannot be known at compilation time + --> $DIR/issue-79224.rs:30:12 + | +LL | impl Display for Cow<'_, B> { + | - this type parameter needs to be `Sized` +LL | LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - | ^^^^ the trait `Clone` is not implemented for `B` + | ^^^^^ doesn't have a size known at compile-time | = note: required for `B` to implement `ToOwned` -help: consider further restricting type parameter `B` with trait `Clone` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Display for Cow<'_, B> { +LL + impl Display for Cow<'_, B> { | -LL | impl Display for Cow<'_, B> { - | +++++++++++++++++++ -error[E0277]: the trait bound `B: Clone` is not satisfied +error: the type `&Cow<'_, B>` is not well-formed --> $DIR/issue-79224.rs:30:12 | LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - | ^^^^^ the trait `Clone` is not implemented for `B` + | ^^^^^ + +error[E0277]: the size for values of type `B` cannot be known at compilation time + --> $DIR/issue-79224.rs:30:12 + | +LL | impl Display for Cow<'_, B> { + | - this type parameter needs to be `Sized` +LL | +LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + | ^^^^^ doesn't have a size known at compile-time | = note: required for `B` to implement `ToOwned` -help: consider further restricting type parameter `B` with trait `Clone` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Display for Cow<'_, B> { +LL + impl Display for Cow<'_, B> { | -LL | impl Display for Cow<'_, B> { - | +++++++++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0276, E0277. +For more information about an error, try `rustc --explain E0276`. diff --git a/tests/ui/splat/splat-cannot-resolve.stderr b/tests/ui/splat/splat-cannot-resolve.stderr index 4910c565cbeb7..a759c819934f7 100644 --- a/tests/ui/splat/splat-cannot-resolve.stderr +++ b/tests/ui/splat/splat-cannot-resolve.stderr @@ -22,17 +22,21 @@ LL - fn ambig_tup(#[rustc_splat] t: Trait::Tup) {} LL + fn ambig_tup(#[rustc_splat] t: ::Tup) {} | -error[E0720]: cannot resolve opaque type +error[E0282]: type annotations needed --> $DIR/splat-cannot-resolve.rs:8:43 | LL | fn tuple(#[rustc_splat] t: impl Sized) -> impl Sized { - | ^^^^^^^^^^ + | ^^^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque -error[E0720]: cannot resolve opaque type +error[E0282]: type annotations needed --> $DIR/splat-cannot-resolve.rs:13:62 | LL | fn tuple_trait(#[rustc_splat] t: impl std::marker::Tuple) -> impl std::marker::Tuple { - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque error[E0277]: cannot use `rustc_splat` attribute; the splatted argument type must be a tuple or unit, not a {type error} ({type error}) --> $DIR/splat-cannot-resolve.rs:23:28 @@ -90,5 +94,5 @@ LL | ambig_tup(1, 2.0); error: aborting due to 10 previous errors -Some errors have detailed explanations: E0223, E0277, E0720. +Some errors have detailed explanations: E0223, E0277, E0282. For more information about an error, try `rustc --explain E0223`. diff --git a/tests/ui/static/extern-static-normalization-failure-issue-148161.stderr b/tests/ui/static/extern-static-normalization-failure-issue-148161.stderr index e2c7d30e2e434..8c0d2095c3391 100644 --- a/tests/ui/static/extern-static-normalization-failure-issue-148161.stderr +++ b/tests/ui/static/extern-static-normalization-failure-issue-148161.stderr @@ -15,6 +15,19 @@ note: required by a bound in `Struct` LL | struct Struct { | ^^^^^ required by this bound in `Struct` -error: aborting due to 1 previous error +error[E0277]: the size for values of type `Struct` cannot be known at compilation time + --> $DIR/extern-static-normalization-failure-issue-148161.rs:17:5 + | +LL | static VAR: Struct; + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: the trait `Sized` is not implemented for `Struct` + --> $DIR/extern-static-normalization-failure-issue-148161.rs:10:1 + | +LL | struct Struct { + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: statics and constants must have a statically known size + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/static/static-lifetime.stderr b/tests/ui/static/static-lifetime.stderr index 9b5869fd0dc46..8c9434ce3cb0b 100644 --- a/tests/ui/static/static-lifetime.stderr +++ b/tests/ui/static/static-lifetime.stderr @@ -11,32 +11,6 @@ LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} | ^^ = note: but lifetime parameter must outlive the static lifetime -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/static-lifetime.rs:3:34 - | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/static-lifetime.rs:3:6 - | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} - | ^^ -note: ...so that the types are compatible - --> $DIR/static-lifetime.rs:3:34 - | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected ` as Arbitrary>` - found ` as Arbitrary>` - = note: but, the lifetime must be valid for the static lifetime... -note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/static-lifetime.rs:3:34 - | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0478, E0803. -For more information about an error, try `rustc --explain E0478`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr index 09dcff7827545..0ff833151cb87 100644 --- a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr +++ b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr @@ -38,6 +38,15 @@ LL | pub desc: &'static dyn Qux, = note: required because it appears within the type `&'static Lint` = note: shared static variables must have a type that implements `Sync` +error[E0308]: mismatched types + --> $DIR/unsizing-wfcheck-issue-127299.rs:12:35 + | +LL | static FOO: &Lint = &Lint { desc: "desc" }; + | ^^^^^^ expected `&dyn Qux`, found `&str` + | + = note: expected reference `&'static (dyn Qux + 'static)` + found reference `&'static str` + error[E0038]: the trait `Qux` is not dyn compatible --> $DIR/unsizing-wfcheck-issue-127299.rs:12:35 | @@ -61,7 +70,7 @@ help: alternatively, consider constraining `bar` so it is explicitly marked as n LL | fn bar() -> i32 where Self: Sized; | +++++++++++++++++ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0038, E0277. +Some errors have detailed explanations: E0038, E0277, E0308. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/structs/ice-struct-tail-normalization-113272.stderr b/tests/ui/structs/ice-struct-tail-normalization-113272.stderr index 9663f93c169b4..617fbb1dd128f 100644 --- a/tests/ui/structs/ice-struct-tail-normalization-113272.stderr +++ b/tests/ui/structs/ice-struct-tail-normalization-113272.stderr @@ -20,7 +20,7 @@ LL | std::mem::transmute::, Option<&Other>>(None); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `Option<()>` (8 bits) - = note: target type: `Option<&Other>` (unable to determine layout for `Other` because `<() as Trait>::RefTarget` cannot be normalized) + = note: target type: `Option<&Other>` (64 bits) error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/derive-clone-for-eq.fixed b/tests/ui/suggestions/derive-clone-for-eq.fixed index 17259dd687c6c..bcc4bcdfa535e 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.fixed +++ b/tests/ui/suggestions/derive-clone-for-eq.fixed @@ -2,7 +2,8 @@ // https://github.com/rust-lang/rust/issues/79076 #[derive(Clone, Eq)] -pub struct Struct(T); //~ ERROR [E0277] +#[derive(PartialEq)] +pub struct Struct(T) where Struct: PartialEq; //~ ERROR [E0277] impl PartialEq for Struct where diff --git a/tests/ui/suggestions/derive-clone-for-eq.stderr b/tests/ui/suggestions/derive-clone-for-eq.stderr index bed5ff90c1949..5fc8b153d4a7e 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.stderr +++ b/tests/ui/suggestions/derive-clone-for-eq.stderr @@ -1,24 +1,23 @@ -error[E0277]: the trait bound `T: Clone` is not satisfied +error[E0277]: can't compare `Struct` with `Struct` --> $DIR/derive-clone-for-eq.rs:5:12 | LL | #[derive(Clone, Eq)] | -- in this derive macro expansion LL | pub struct Struct(T); - | ^^^^^^ the trait `Clone` is not implemented for `T` + | ^^^^^^ no implementation for `Struct == Struct` | -note: required for `Struct` to implement `PartialEq` - --> $DIR/derive-clone-for-eq.rs:7:19 - | -LL | impl PartialEq for Struct - | ----- ^^^^^^^^^^^^ ^^^^^^^^^ - | | - | unsatisfied trait bound introduced here + = help: the trait `PartialEq` is not implemented for `Struct` note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL -help: consider restricting type parameter `T` with trait `Clone` +help: consider annotating `Struct` with `#[derive(PartialEq)]` + | +LL + #[derive(PartialEq)] +LL | pub struct Struct(T); + | +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | pub struct Struct(T); - | +++++++++++++++++++ +LL | pub struct Struct(T) where Struct: PartialEq; + | ++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr index 0d05bd9d91bbf..555eda933b44b 100644 --- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr @@ -1,106 +1,67 @@ -error[E0277]: `a::Inner` doesn't implement `Debug` +error[E0277]: `&a::Inner` doesn't implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:12:21 | LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer(Inner); - | ^^^^^^^^ the trait `Debug` is not implemented for `a::Inner` - | -help: consider annotating `a::Inner` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct Inner(T); + | ^^^^^^^^ within `&a::Inner`, the trait `Debug` is not implemented for `&a::Inner` | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | struct Outer(Inner) where a::Inner: Debug; - | ++++++++++++++++++++++++ +LL | struct Outer(Inner) where &a::Inner: Debug; + | +++++++++++++++++++++++++ -error[E0277]: the trait bound `T: c::Trait` is not satisfied +error[E0277]: `&c::Inner` doesn't implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:41:21 | LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer(Inner); - | ^^^^^^^^ the trait `c::Trait` is not implemented for `T` - | -note: required for `c::Inner` to implement `Debug` - --> $DIR/derive-macro-missing-bounds.rs:34:28 + | ^^^^^^^^ within `&c::Inner`, the trait `Debug` is not implemented for `&c::Inner` | -LL | impl Debug for Inner { - | ----- ^^^^^ ^^^^^^^^ - | | - | unsatisfied trait bound introduced here - = note: 1 redundant requirement hidden - = note: required for `&c::Inner` to implement `Debug` - = note: required for the cast from `&&c::Inner` to `&dyn Debug` -help: consider restricting type parameter `T` with trait `Trait` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | struct Outer(Inner); - | ++++++++++ +LL | struct Outer(Inner) where &c::Inner: Debug; + | +++++++++++++++++++++++++ -error[E0277]: the trait bound `T: d::Trait` is not satisfied +error[E0277]: `&d::Inner` doesn't implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:56:21 | LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer(Inner); - | ^^^^^^^^ the trait `d::Trait` is not implemented for `T` - | -note: required for `d::Inner` to implement `Debug` - --> $DIR/derive-macro-missing-bounds.rs:49:13 + | ^^^^^^^^ within `&d::Inner`, the trait `Debug` is not implemented for `&d::Inner` | -LL | impl Debug for Inner where T: Debug, T: Trait { - | ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here - = note: 1 redundant requirement hidden - = note: required for `&d::Inner` to implement `Debug` - = note: required for the cast from `&&d::Inner` to `&dyn Debug` -help: consider restricting type parameter `T` with trait `Trait` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | struct Outer(Inner); - | ++++++++++ +LL | struct Outer(Inner) where &d::Inner: Debug; + | +++++++++++++++++++++++++ -error[E0277]: the trait bound `T: e::Trait` is not satisfied +error[E0277]: `&e::Inner` doesn't implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:71:21 | LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer(Inner); - | ^^^^^^^^ the trait `e::Trait` is not implemented for `T` - | -note: required for `e::Inner` to implement `Debug` - --> $DIR/derive-macro-missing-bounds.rs:64:13 + | ^^^^^^^^ within `&e::Inner`, the trait `Debug` is not implemented for `&e::Inner` | -LL | impl Debug for Inner where T: Debug + Trait { - | ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here - = note: 1 redundant requirement hidden - = note: required for `&e::Inner` to implement `Debug` - = note: required for the cast from `&&e::Inner` to `&dyn Debug` -help: consider restricting type parameter `T` with trait `Trait` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | struct Outer(Inner); - | ++++++++++ +LL | struct Outer(Inner) where &e::Inner: Debug; + | +++++++++++++++++++++++++ -error[E0277]: the trait bound `T: f::Trait` is not satisfied +error[E0277]: `&f::Inner` doesn't implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:86:21 | LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer(Inner); - | ^^^^^^^^ the trait `f::Trait` is not implemented for `T` + | ^^^^^^^^ within `&f::Inner`, the trait `Debug` is not implemented for `&f::Inner` | -note: required for `f::Inner` to implement `Debug` - --> $DIR/derive-macro-missing-bounds.rs:79:20 - | -LL | impl Debug for Inner where T: Trait { - | ^^^^^ ^^^^^^^^ ----- unsatisfied trait bound introduced here - = note: 1 redundant requirement hidden - = note: required for `&f::Inner` to implement `Debug` - = note: required for the cast from `&&f::Inner` to `&dyn Debug` -help: consider restricting type parameter `T` with trait `Trait` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | struct Outer(Inner); - | ++++++++++ +LL | struct Outer(Inner) where &f::Inner: Debug; + | +++++++++++++++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/suggestions/enum-variant-arg-mismatch.stderr b/tests/ui/suggestions/enum-variant-arg-mismatch.stderr index 16f03d16d8c02..8ab921cd8a586 100644 --- a/tests/ui/suggestions/enum-variant-arg-mismatch.stderr +++ b/tests/ui/suggestions/enum-variant-arg-mismatch.stderr @@ -1,26 +1,20 @@ -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `Fn(String)` closure, found `fn(&str) -> Sexpr<'_> {Sexpr::<'_>::Ident}` --> $DIR/enum-variant-arg-mismatch.rs:8:9 | -LL | Ident(&'a str), - | ----- found signature defined here -... LL | map(Sexpr::Ident); - | --- ^^^^^^^^^^^^ expected due to this + | --- ^^^^^^^^^^^^ expected an `Fn(String)` closure, found `fn(&str) -> Sexpr<'_> {Sexpr::<'_>::Ident}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(String) -> _` - found function signature `fn(&str) -> _` + = help: the trait `Fn(String)` is not implemented for fn item `fn(&str) -> Sexpr<'_> {Sexpr::<'_>::Ident}` + = note: expected a closure with signature `fn(String)` + found a closure with signature `fn(&str)` note: required by a bound in `map` --> $DIR/enum-variant-arg-mismatch.rs:5:15 | LL | fn map<'a, F: Fn(String) -> Sexpr<'a>>(f: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` -help: consider wrapping the function in a closure - | -LL | map(|arg0: String| Sexpr::Ident(/* &str */)); - | ++++++++++++++ ++++++++++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/fn-trait-notation.stderr b/tests/ui/suggestions/fn-trait-notation.stderr index b9698435083dc..9ea809b6f2c63 100644 --- a/tests/ui/suggestions/fn-trait-notation.stderr +++ b/tests/ui/suggestions/fn-trait-notation.stderr @@ -52,6 +52,15 @@ LL | F: Fn, note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL +error[E0059]: type parameter to bare `FnOnce` trait must be a tuple + --> $DIR/fn-trait-notation.rs:4:16 + | +LL | F: Fn, + | ^^^^^^^^^^^^ the nightly-only, unstable trait `std::marker::Tuple` is not implemented for `i32` + | +note: required by a bound in `FnOnce` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL + error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit --> $DIR/fn-trait-notation.rs:9:5 | @@ -64,18 +73,19 @@ error[E0277]: `i32` is not a tuple LL | f(3); | ^^^^ the nightly-only, unstable trait `std::marker::Tuple` is not implemented for `i32` -error[E0308]: mismatched types - --> $DIR/fn-trait-notation.rs:17:5 - | -LL | / e0658( -LL | | |a| a, -LL | | |a, b| (b, a), -LL | | |a| a, -LL | | ); - | |_____^ types differ - | - = note: expected trait `Fn` - found trait `Fn(_)` +error[E0277]: expected an `Fn` closure, found `{closure@$DIR/fn-trait-notation.rs:18:9: 18:12}` + --> $DIR/fn-trait-notation.rs:18:9 + | +LL | e0658( + | ----- required by a bound introduced by this call +LL | |a| a, + | ^^^^^ expected an `Fn` closure, found `{closure@$DIR/fn-trait-notation.rs:18:9: 18:12}` + | +help: the trait `Fn` is not implemented for closure `{closure@$DIR/fn-trait-notation.rs:18:9: 18:12}` + --> $DIR/fn-trait-notation.rs:18:9 + | +LL | |a| a, + | ^^^ note: required by a bound in `e0658` --> $DIR/fn-trait-notation.rs:4:8 | @@ -84,7 +94,7 @@ LL | where LL | F: Fn, | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `e0658` -error: aborting due to 7 previous errors +error: aborting due to 8 previous errors -Some errors have detailed explanations: E0059, E0277, E0308, E0658. +Some errors have detailed explanations: E0059, E0277, E0658. For more information about an error, try `rustc --explain E0059`. diff --git a/tests/ui/suggestions/if-then-neeing-semi.stderr b/tests/ui/suggestions/if-then-neeing-semi.stderr index 0556d6c50b1ce..4895023d3ab93 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.stderr +++ b/tests/ui/suggestions/if-then-neeing-semi.stderr @@ -70,11 +70,13 @@ LL | | async_dummy() | | ------------- expected because of this ... | LL | | async_dummy2() - | | ^^^^^^^^^^^^^^ expected future, found a different future + | | ^^^^^^^^^^^^^^ expected `async_dummy::{opaque#0}`, found `async_dummy2::{opaque#0}` ... | LL | | }; | |_____- `if` and `else` have incompatible types | + = note: expected opaque type `impl Future` + found opaque type `impl Future` = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/issue-101465.stderr b/tests/ui/suggestions/issue-101465.stderr index ff612a908cb6e..8d2f2ce3fedc7 100644 --- a/tests/ui/suggestions/issue-101465.stderr +++ b/tests/ui/suggestions/issue-101465.stderr @@ -9,17 +9,6 @@ LL | | false => C, LL | | LL | | } | |_____- `match` arms have incompatible types - | -help: you could change the return type to be a boxed trait object - | -LL - fn foo() -> impl Tr { -LL + fn foo() -> Box { - | -help: if you change the return type to expect trait objects, box the returned expressions - | -LL ~ true => Box::new(B), -LL ~ false => Box::new(C), - | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-109436.stderr b/tests/ui/suggestions/issue-109436.stderr index 4425ce84b6d38..10f13f51f4726 100644 --- a/tests/ui/suggestions/issue-109436.stderr +++ b/tests/ui/suggestions/issue-109436.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `Foo: Into<_>` is not satisfied +error[E0277]: the trait bound `Foo: Into` is not satisfied --> $DIR/issue-109436.rs:12:22 | LL | let b: Bar = foo.into(); - | ^^^^ the trait `Into<_>` is not implemented for `Foo` + | ^^^^ the trait `Into` is not implemented for `Foo` | = note: required for `Foo` to implement `Into` help: consider borrowing here diff --git a/tests/ui/suggestions/issue-72766.stderr b/tests/ui/suggestions/issue-72766.stderr index 03aad995b9666..817c0f655ad4b 100644 --- a/tests/ui/suggestions/issue-72766.stderr +++ b/tests/ui/suggestions/issue-72766.stderr @@ -10,6 +10,18 @@ help: consider `await`ing on the `Future` LL | SadGirl {}.call().await?; | ++++++ -error: aborting due to 1 previous error +error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/issue-72766.rs:14:5 + | +LL | async fn async_main() -> Result<(), ()> { + | _________________________________________- +LL | | // should be `.call().await?` +LL | | SadGirl {}.call()?; + | | ^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in an async function that returns `impl Future>` +LL | | Ok(()) +LL | | } + | |_- this function should return `Result` or `Option` to accept `?` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/issue-96223.stderr b/tests/ui/suggestions/issue-96223.stderr index e064866079132..9e53066ad716e 100644 --- a/tests/ui/suggestions/issue-96223.stderr +++ b/tests/ui/suggestions/issue-96223.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `for<'de> EmptyBis<'de>: Foo<'_>` is not satisfied +error[E0277]: the trait bound `for<'de> EmptyBis<'de>: Foo<'de>` is not satisfied --> $DIR/issue-96223.rs:49:17 | LL | icey_bounds(&p); @@ -6,7 +6,7 @@ LL | icey_bounds(&p); | | | required by a bound introduced by this call | -help: the trait `for<'de> Foo<'_>` is not implemented for `EmptyBis<'de>` +help: the trait `for<'de> Foo<'de>` is not implemented for `EmptyBis<'de>` --> $DIR/issue-96223.rs:33:1 | LL | pub struct EmptyBis<'a>(&'a [u8]); diff --git a/tests/ui/suggestions/issue-97704.stderr b/tests/ui/suggestions/issue-97704.stderr index e20c68057eb7e..c5bddff09ca66 100644 --- a/tests/ui/suggestions/issue-97704.stderr +++ b/tests/ui/suggestions/issue-97704.stderr @@ -10,6 +10,17 @@ help: consider `await`ing on the `Future` LL | func(async { Ok::<_, i32>(()) }).await?; | ++++++ -error: aborting due to 1 previous error +error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/issue-97704.rs:9:5 + | +LL | async fn foo() -> Result<(), i32> { + | ___________________________________- +LL | | func(async { Ok::<_, i32>(()) })?; + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in an async function that returns `impl Future>` +... | +LL | | } + | |_- this function should return `Result` or `Option` to accept `?` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr index 6afc6267dbdca..69c836deadada 100644 --- a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr +++ b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr @@ -1,16 +1,11 @@ -error[E0631]: type mismatch in closure arguments +error[E0271]: type mismatch resolving `<{closure@late-bound-in-borrow-closure-sugg.rs:21:19} as FnOnce<(&mut Trader<'b>,)>>::Output == ()` --> $DIR/late-bound-in-borrow-closure-sugg.rs:26:24 | -LL | let closure = |trader : Trader| { - | ----------------- found signature defined here -... LL | trader.set_closure(closure); - | ----------- ^^^^^^^ expected due to this + | ----------- ^^^^^^^ types differ | | | required by a bound introduced by this call | - = note: expected closure signature `for<'a, 'b> fn(&'a mut Trader<'b>) -> _` - found closure signature `fn(Trader<'_>) -> _` note: required by a bound in `Trader::<'a>::set_closure` --> $DIR/late-bound-in-borrow-closure-sugg.rs:15:50 | @@ -18,15 +13,7 @@ LL | impl<'a> Trader<'a> { ... LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) { | ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure` -help: consider wrapping the function in a closure - | -LL | trader.set_closure(|arg0: &mut Trader<'_>| closure(*arg0)); - | +++++++++++++++++++++++ +++++++ -help: consider adjusting the signature so it borrows its argument - | -LL | let closure = |trader : &mut Trader| { - | ++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0631`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index 441adf4856b5d..870669be8e4b0 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -1,12 +1,10 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds - --> $DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:8:5 + --> $DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:7:1 | -LL | fn bar(src: &crate::Foo) -> impl Iterator { - | ------------------------- opaque type defined here -LL | / [0].into_iter() -LL | | -LL | | .filter_map(|_| foo(src)) - | |_________________________________^ +LL | fn bar(src: &crate::Foo) -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------- + | | + | opaque type defined here | = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` @@ -22,7 +20,10 @@ LL | .filter_map(|_| foo(src)) | value captured here LL | LL | } - | - `src` dropped here while still borrowed + | - + | | + | `src` dropped here while still borrowed + | borrow later used here error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/lifetimes/issue-105544.stderr b/tests/ui/suggestions/lifetimes/issue-105544.stderr index 526f7e36163be..e8a4b9a075f18 100644 --- a/tests/ui/suggestions/lifetimes/issue-105544.stderr +++ b/tests/ui/suggestions/lifetimes/issue-105544.stderr @@ -1,11 +1,11 @@ error[E0311]: the parameter type `impl Sized` may not live long enough - --> $DIR/issue-105544.rs:7:5 + --> $DIR/issue-105544.rs:5:1 | LL | fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ { - | ------- the parameter type `impl Sized` must be valid for the anonymous lifetime defined here... -LL | -LL | (d, p) - | ^^^^^^ ...so that the type `impl Sized` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^^^^^^^^^^^^^^^^^^^^ + | | | + | | the parameter type `impl Sized` must be valid for the anonymous lifetime defined here... + | ...so that the type `impl Sized` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -14,13 +14,13 @@ LL + fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a { | error[E0309]: the parameter type `impl Sized` may not live long enough - --> $DIR/issue-105544.rs:15:5 + --> $DIR/issue-105544.rs:12:1 | LL | fn foo1<'b>(d: impl Sized, p: &'b mut ()) -> impl Sized + '_ { - | -- the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here... -... -LL | (d, p) - | ^^^^^^ ...so that the type `impl Sized` will meet its required lifetime bounds + | ^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here... + | ...so that the type `impl Sized` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -28,13 +28,13 @@ LL | fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ { | ++++ error[E0311]: the parameter type `impl Sized + 'a` may not live long enough - --> $DIR/issue-105544.rs:21:5 + --> $DIR/issue-105544.rs:19:1 | LL | fn foo2<'a>(d: impl Sized + 'a, p: &mut ()) -> impl Sized + '_ { - | ------- the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here... -LL | -LL | (d, p) - | ^^^^^^ ...so that the type `impl Sized + 'a` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^^^^^^^^^^^^^^^^^^^ + | | | + | | the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here... + | ...so that the type `impl Sized + 'a` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -43,13 +43,13 @@ LL + fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b | error[E0311]: the parameter type `T` may not live long enough - --> $DIR/issue-105544.rs:28:5 + --> $DIR/issue-105544.rs:26:1 | LL | fn bar(d: T, p: & mut ()) -> impl Sized + '_ { - | -------- the parameter type `T` must be valid for the anonymous lifetime defined here... -LL | -LL | (d, p) - | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^--------^^^^^^^^^^^^^^^^^^^^ + | | | + | | the parameter type `T` must be valid for the anonymous lifetime defined here... + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -58,13 +58,13 @@ LL + fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a { | error[E0309]: the parameter type `T` may not live long enough - --> $DIR/issue-105544.rs:36:5 + --> $DIR/issue-105544.rs:33:1 | LL | fn bar1<'b, T : Sized>(d: T, p: &'b mut ()) -> impl Sized + '_ { - | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... -... -LL | (d, p) - | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | the parameter type `T` must be valid for the lifetime `'b` as defined here... + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -72,13 +72,13 @@ LL | fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { | ++++ error[E0311]: the parameter type `T` may not live long enough - --> $DIR/issue-105544.rs:42:5 + --> $DIR/issue-105544.rs:40:1 | LL | fn bar2<'a, T : Sized + 'a>(d: T, p: &mut ()) -> impl Sized + '_ { - | ------- the parameter type `T` must be valid for the anonymous lifetime defined here... -LL | -LL | (d, p) - | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^^^^^^^^^^^^^^^^^^^ + | | | + | | the parameter type `T` must be valid for the anonymous lifetime defined here... + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index ab067f2439c67..88dccd7b7ead5 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -10,18 +10,16 @@ LL | fn baz<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ | +++ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not appear in bounds - --> $DIR/missing-lifetimes-in-signature.rs:19:5 + --> $DIR/missing-lifetimes-in-signature.rs:15:1 | LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() - | ------ ------------- opaque type defined here - | | - | hidden type `{closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12}` captures the anonymous lifetime defined here -... -LL | / move || { -LL | | -LL | | *dest = g.get(); -LL | | } - | |_____^ + | ^ ------ ------------- opaque type defined here + | | | + | _| hidden type `{closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12}` captures the anonymous lifetime defined here + | | +LL | | where +LL | | G: Get, + | |______________^ | help: add a `use<...>` bound to explicitly capture `'_` | @@ -29,16 +27,15 @@ LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() + use<'_, G, T> | +++++++++++++++ error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:30:5 + --> $DIR/missing-lifetimes-in-signature.rs:26:1 | LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ------ the parameter type `G` must be valid for the anonymous lifetime defined here... -... -LL | / move || { -LL | | -LL | | *dest = g.get(); -LL | | } - | |_____^ ...so that the type `G` will meet its required lifetime bounds + | ^ ------ the parameter type `G` must be valid for the anonymous lifetime defined here... + | _| + | | +LL | | where +LL | | G: Get, + | |______________^ ...so that the type `G` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -48,16 +45,15 @@ LL ~ G: Get + 'a, | error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:52:5 + --> $DIR/missing-lifetimes-in-signature.rs:48:1 | LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ------ the parameter type `G` must be valid for the anonymous lifetime defined here... -... -LL | / move || { -LL | | -LL | | *dest = g.get(); -LL | | } - | |_____^ ...so that the type `G` will meet its required lifetime bounds + | ^ ------ the parameter type `G` must be valid for the anonymous lifetime defined here... + | _| + | | +LL | | where +LL | | G: Get, + | |______________^ ...so that the type `G` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -66,15 +62,13 @@ LL + fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b | error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:61:9 + --> $DIR/missing-lifetimes-in-signature.rs:60:5 | -LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { - | ------ the parameter type `G` must be valid for the anonymous lifetime defined here... -LL | / move || { -LL | | -LL | | *dest = g.get(); -LL | | } - | |_________^ ...so that the type `G` will meet its required lifetime bounds +LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | the parameter type `G` must be valid for the anonymous lifetime defined here... + | ...so that the type `G` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -83,17 +77,15 @@ LL + fn qux<'c, 'b, G: Get + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl F | error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:73:5 + --> $DIR/missing-lifetimes-in-signature.rs:69:1 | LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a - | ------ the parameter type `G` must be valid for the anonymous lifetime defined here... -... -LL | / move || { -LL | | -LL | | -LL | | *dest = g.get(); -LL | | } - | |_____^ ...so that the type `G` will meet its required lifetime bounds + | ^ ------ the parameter type `G` must be valid for the anonymous lifetime defined here... + | _| + | | +LL | | where +LL | | G: Get, + | |______________^ ...so that the type `G` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -117,16 +109,15 @@ LL | fn bat<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_ + 'a | ++ error[E0309]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:85:5 + --> $DIR/missing-lifetimes-in-signature.rs:81:1 | LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a - | -- the parameter type `G` must be valid for the lifetime `'a` as defined here... -... -LL | / move || { -LL | | -LL | | *dest = g.get(); -LL | | } - | |_____^ ...so that the type `G` will meet its required lifetime bounds + | ^ -- the parameter type `G` must be valid for the lifetime `'a` as defined here... + | _| + | | +LL | | where +LL | | G: Get, + | |______________^ ...so that the type `G` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr index f70f6a1e1570b..14c73e900f080 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -69,11 +69,13 @@ LL | | true => async_dummy(), | | ------------- this is found to be of type `impl Future` LL | | LL | | false => async_dummy2(), - | | ^^^^^^^^^^^^^^ expected future, found a different future + | | ^^^^^^^^^^^^^^ expected `async_dummy::{opaque#0}`, found `async_dummy2::{opaque#0}` ... | LL | | }; | |_____- `match` arms have incompatible types | + = note: expected opaque type `impl Future` + found opaque type `impl Future` = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed index 8a2be310e0d81..b8c4c3c9b99b1 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed @@ -2,13 +2,14 @@ use std::fmt::Debug; #[derive(Debug, Copy, Clone)] +#[derive(Debug)] pub struct Vector2 { pub x: T, pub y: T, } #[derive(Debug, Copy, Clone)] -pub struct AABB { +pub struct AABB where Vector2: Debug where &Vector2: Debug { pub loc: Vector2, //~ ERROR the trait bound `K: Copy` is not satisfied //~^ ERROR the trait bound `K: Copy` is not satisfied //~| ERROR the trait bound `K: Copy` is not satisfied diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr index ad359b538cef9..d155e890d6c84 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr @@ -15,26 +15,53 @@ LL | pub struct AABB { | +++++++++++++++++++ error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:15:15 + | +LL | pub size: Vector2, + | ^^^^^^^^^^ the trait `Copy` is not implemented for `K` + | +note: required by a bound in `Vector2` + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:5:31 + | +LL | pub struct Vector2 { + | ^^^^ required by this bound in `Vector2` +help: consider further restricting type parameter `K` with trait `Copy` + | +LL | pub struct AABB { + | +++++++++++++++++++ + +error[E0277]: the trait bound `&Vector2: CoerceUnsized<&dyn Debug>` is not satisfied in `Vector2` --> $DIR/missing-bound-in-derive-copy-impl-2.rs:12:5 | LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion LL | pub struct AABB { LL | pub loc: Vector2, - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` + | ^^^^^^^^^^^^^^^^^^^ within `Vector2`, the trait `Debug` is not implemented for `Vector2` + | +help: consider annotating `Vector2` with `#[derive(Debug)]` + | +LL + #[derive(Debug)] +LL | pub struct Vector2 { + | +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -note: required for `Vector2` to implement `Debug` - --> $DIR/missing-bound-in-derive-copy-impl-2.rs:5:12 +LL | pub struct AABB where Vector2: Debug { + | +++++++++++++++++++++++ + +error[E0277]: `&Vector2` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:15:5 | LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion -LL | pub struct Vector2 { - | ^^^^^^^ ---- unsatisfied trait bound - = note: required for the cast from `&Vector2` to `&dyn Debug` -help: consider further restricting type parameter `K` with trait `Copy` +... +LL | pub size: Vector2, + | ^^^^^^^^^^^^^^^^^^^^ within `&Vector2`, the trait `Debug` is not implemented for `&Vector2` | -LL | pub struct AABB { - | +++++++++++++++++++ +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | pub struct AABB where &Vector2: Debug { + | ++++++++++++++++++++++++ error[E0277]: the trait bound `K: Copy` is not satisfied --> $DIR/missing-bound-in-derive-copy-impl-2.rs:12:5 @@ -64,18 +91,16 @@ LL | #[derive(Debug, Copy, Clone)] LL | pub size: Vector2, | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` | -note: required for `Vector2` to implement `Clone` - --> $DIR/missing-bound-in-derive-copy-impl-2.rs:5:12 +note: required by a bound in `Vector2` + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:5:31 | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion LL | pub struct Vector2 { - | ^^^^^^^ ---- unsatisfied trait bound + | ^^^^ required by this bound in `Vector2` help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB { | +++++++++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr index cc80e7297e48a..a379e8b54b08f 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr @@ -34,6 +34,22 @@ help: consider further restricting type parameter `K` with trait `Debug` LL | pub struct AABB { | +++++++++++++++++ +error[E0277]: `K` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl-3.rs:14:15 + | +LL | pub size: Vector2 + | ^^^^^^^^^^ the trait `Debug` is not implemented for `K` + | +note: required by a bound in `Vector2` + --> $DIR/missing-bound-in-derive-copy-impl-3.rs:5:23 + | +LL | pub struct Vector2{ + | ^^^^^ required by this bound in `Vector2` +help: consider further restricting type parameter `K` with trait `Debug` + | +LL | pub struct AABB { + | +++++++++++++++++ + error[E0277]: `K` doesn't implement `Debug` --> $DIR/missing-bound-in-derive-copy-impl-3.rs:12:5 | @@ -62,7 +78,7 @@ help: consider further restricting type parameter `K` with trait `Debug` LL | pub struct AABB { | +++++++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0204, E0277. For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr index 92e4188e2039f..0f503d11699b7 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr @@ -34,43 +34,54 @@ help: consider restricting type parameter `K` with trait `Debug` LL | pub struct AABB { | +++++++++++++++++ -error[E0277]: the trait bound `K: Copy` is not satisfied - --> $DIR/missing-bound-in-derive-copy-impl.rs:11:14 +error[E0277]: `K` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl.rs:17:15 | -LL | pub loc: Vector2, - | ^^^^^^^^^^ the trait `Copy` is not implemented for `K` +LL | pub size: Vector2, + | ^^^^^^^^^^ the trait `Debug` is not implemented for `K` | note: required by a bound in `Vector2` - --> $DIR/missing-bound-in-derive-copy-impl.rs:4:31 + --> $DIR/missing-bound-in-derive-copy-impl.rs:4:23 | LL | pub struct Vector2 { - | ^^^^ required by this bound in `Vector2` -help: consider restricting type parameter `K` with trait `Copy` + | ^^^^^ required by this bound in `Vector2` +help: consider restricting type parameter `K` with trait `Debug` | -LL | pub struct AABB { - | +++++++++++++++++++ +LL | pub struct AABB { + | +++++++++++++++++ -error[E0277]: the trait bound `K: Copy` is not satisfied +error[E0277]: the trait bound `&Vector2: CoerceUnsized<&dyn Debug>` is not satisfied in `Vector2` --> $DIR/missing-bound-in-derive-copy-impl.rs:11:5 | LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion LL | pub struct AABB { LL | pub loc: Vector2, - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` + | ^^^^^^^^^^^^^^^^^^^ within `Vector2`, the trait `Debug` is not implemented for `Vector2` + | +help: consider annotating `Vector2` with `#[derive(Debug)]` + | +LL + #[derive(Debug)] +LL | pub struct Vector2 { + | +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -note: required for `Vector2` to implement `Debug` - --> $DIR/missing-bound-in-derive-copy-impl.rs:4:12 +LL | pub struct AABB where Vector2: Debug { + | +++++++++++++++++++++++ + +error[E0277]: `&Vector2` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl.rs:17:5 | LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion -LL | pub struct Vector2 { - | ^^^^^^^ ---- unsatisfied trait bound - = note: required for the cast from `&Vector2` to `&dyn Debug` -help: consider restricting type parameter `K` with trait `Copy` +... +LL | pub size: Vector2, + | ^^^^^^^^^^^^^^^^^^^^ within `&Vector2`, the trait `Debug` is not implemented for `&Vector2` + | +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | pub struct AABB { - | +++++++++++++++++++ +LL | pub struct AABB where &Vector2: Debug { + | ++++++++++++++++++++++++ error[E0277]: `K` doesn't implement `Debug` --> $DIR/missing-bound-in-derive-copy-impl.rs:11:5 @@ -86,25 +97,6 @@ help: consider restricting type parameter `K` with trait `Debug` LL | pub struct AABB { | +++++++++++++++++ -error[E0277]: the trait bound `K: Copy` is not satisfied - --> $DIR/missing-bound-in-derive-copy-impl.rs:11:5 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -LL | pub struct AABB { -LL | pub loc: Vector2, - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` - | -note: required by a bound in `Vector2` - --> $DIR/missing-bound-in-derive-copy-impl.rs:4:31 - | -LL | pub struct Vector2 { - | ^^^^ required by this bound in `Vector2` -help: consider restricting type parameter `K` with trait `Copy` - | -LL | pub struct AABB { - | +++++++++++++++++++ - error[E0277]: `K` doesn't implement `Debug` --> $DIR/missing-bound-in-derive-copy-impl.rs:17:5 | @@ -119,28 +111,7 @@ help: consider restricting type parameter `K` with trait `Debug` LL | pub struct AABB { | +++++++++++++++++ -error[E0277]: the trait bound `K: Copy` is not satisfied - --> $DIR/missing-bound-in-derive-copy-impl.rs:17:5 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -... -LL | pub size: Vector2, - | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` - | -note: required for `Vector2` to implement `Clone` - --> $DIR/missing-bound-in-derive-copy-impl.rs:4:12 - | -LL | #[derive(Debug, Copy, Clone)] - | ----- in this derive macro expansion -LL | pub struct Vector2 { - | ^^^^^^^ ---- unsatisfied trait bound -help: consider restricting type parameter `K` with trait `Copy` - | -LL | pub struct AABB { - | +++++++++++++++++++ - -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors Some errors have detailed explanations: E0204, E0277. For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/suggestions/multi-suggestion.ascii.stderr b/tests/ui/suggestions/multi-suggestion.ascii.stderr index ecc4c5aa7c23b..0941e23c172a1 100644 --- a/tests/ui/suggestions/multi-suggestion.ascii.stderr +++ b/tests/ui/suggestions/multi-suggestion.ascii.stderr @@ -125,7 +125,7 @@ LL + let _ = Box::new_zeroed(); LL - let _ = Box {}; LL + let _ = Box::new_in(_, _); | - = and 16 other candidates + = and 17 other candidates help: consider using the `Default` trait | LL - let _ = Box {}; diff --git a/tests/ui/suggestions/multi-suggestion.unicode.stderr b/tests/ui/suggestions/multi-suggestion.unicode.stderr index 1f28a4d8fa289..8be77f22f0757 100644 --- a/tests/ui/suggestions/multi-suggestion.unicode.stderr +++ b/tests/ui/suggestions/multi-suggestion.unicode.stderr @@ -125,7 +125,7 @@ LL + let _ = Box::new_zeroed(); LL - let _ = Box {}; LL + let _ = Box::new_in(_, _); │ - ╰ and 16 other candidates + ╰ and 17 other candidates help: consider using the `Default` trait ╭╴ LL - let _ = Box {}; diff --git a/tests/ui/suggestions/multiple_tuples_implement_same_trait_continuous_arities.stderr b/tests/ui/suggestions/multiple_tuples_implement_same_trait_continuous_arities.stderr index fb9bb2642971a..80804165bc8f1 100644 --- a/tests/ui/suggestions/multiple_tuples_implement_same_trait_continuous_arities.stderr +++ b/tests/ui/suggestions/multiple_tuples_implement_same_trait_continuous_arities.stderr @@ -1,25 +1,19 @@ -error[E0277]: `Foo` doesn't implement `Debug` - --> $DIR/multiple_tuples_implement_same_trait_continuous_arities.rs:17:23 +error[E0277]: `({integer}, Foo)` doesn't implement `Debug` + --> $DIR/multiple_tuples_implement_same_trait_continuous_arities.rs:17:19 | LL | testing_debug((1, Foo)); - | ------------- ^^^ the trait `Debug` is not implemented for `Foo` + | ------------- ^^^^^^^^ the trait `Debug` is not implemented for `({integer}, Foo)` | | | required by a bound introduced by this call | = help: the following other types implement trait `Debug`: (T₁, T₂, …, Tₙ) up to tuples of arity 12 and 5 others - = note: required for `({integer}, Foo)` to implement `Debug` note: required by a bound in `testing_debug` --> $DIR/multiple_tuples_implement_same_trait_continuous_arities.rs:3:21 | LL | fn testing_debug(t: T) {} | ^^^^^ required by this bound in `testing_debug` -help: consider annotating `Foo` with `#[derive(Debug)]` - | -LL + #[derive(Debug)] -LL | struct Foo; - | error[E0277]: the trait bound `({integer}, Foo): MyTrait` is not satisfied --> $DIR/multiple_tuples_implement_same_trait_continuous_arities.rs:19:21 diff --git a/tests/ui/suggestions/opaque-type-error.stderr b/tests/ui/suggestions/opaque-type-error.stderr index 3ce45c7b67456..f98199d155126 100644 --- a/tests/ui/suggestions/opaque-type-error.stderr +++ b/tests/ui/suggestions/opaque-type-error.stderr @@ -12,10 +12,12 @@ LL | | thing_one() | | ----------- expected because of this LL | | } else { LL | | thing_two() - | | ^^^^^^^^^^^ expected future, found a different future + | | ^^^^^^^^^^^ expected `thing_one::{opaque#0}`, found `thing_two::{opaque#0}` LL | | }.await | |_____- `if` and `else` have incompatible types | + = note: expected opaque type `impl Future>` + found opaque type `impl Future>` = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/restrict-bound-already-has-generic-args.stderr b/tests/ui/suggestions/restrict-bound-already-has-generic-args.stderr index a284f2adb366c..01b35b0c834aa 100644 --- a/tests/ui/suggestions/restrict-bound-already-has-generic-args.stderr +++ b/tests/ui/suggestions/restrict-bound-already-has-generic-args.stderr @@ -3,9 +3,6 @@ error[E0271]: type mismatch resolving `<(A, as Pair>::Right | LL | fn frob(pair: impl Pair) -> impl Pair { | - expected this type parameter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<(A, as Pair>::Right) as Pair>::Right == B` -... -LL | (left, right) - | ------------- return type was inferred to be `(A, as Pair>::Right)` here | note: expected this to be `B` --> $DIR/restrict-bound-already-has-generic-args.rs:12:18 diff --git a/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr b/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr index 1f225767472ad..bb24e111f7c22 100644 --- a/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr +++ b/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr @@ -29,20 +29,6 @@ LL | .collect::(); FromIterator FromIterator FromIterator -note: the method call chain might not have had the expected associated types - --> $DIR/semi-suggestion-when-stmt-and-expr-span-equal.rs:20:10 - | -LL | String::new() - | ------------- this expression has type `String` -LL | .chars() - | ------- `Iterator::Item` is `char` here -LL | .filter(|x| !x.is_whitespace()) - | ------------------------------ `Iterator::Item` remains `char` here -LL | .map(|x| { - | __________^ -LL | | println!("Child spawned with the size: {}", x); -LL | | }) - | |__________^ `Iterator::Item` changed to `()` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL diff --git a/tests/ui/suggestions/slice-issue-87994.stderr b/tests/ui/suggestions/slice-issue-87994.stderr index dd5c00af90b22..aa32857ecc120 100644 --- a/tests/ui/suggestions/slice-issue-87994.stderr +++ b/tests/ui/suggestions/slice-issue-87994.stderr @@ -1,18 +1,3 @@ -error[E0277]: `[i32]` is not an iterator - --> $DIR/slice-issue-87994.rs:3:12 - | -LL | for _ in v[1..] { - | ^^^^^^ the trait `IntoIterator` is not implemented for `[i32]` - | - = note: the trait bound `[i32]: IntoIterator` is not satisfied - = note: required for `[i32]` to implement `IntoIterator` -help: consider borrowing here - | -LL | for _ in &v[1..] { - | + -LL | for _ in &mut v[1..] { - | ++++ - error[E0277]: `[i32]` is not an iterator --> $DIR/slice-issue-87994.rs:3:12 | @@ -28,21 +13,6 @@ LL | for _ in &v[1..] { LL | for _ in &mut v[1..] { | ++++ -error[E0277]: `[K]` is not an iterator - --> $DIR/slice-issue-87994.rs:11:13 - | -LL | for i2 in v2[1..] { - | ^^^^^^^ the trait `IntoIterator` is not implemented for `[K]` - | - = note: the trait bound `[K]: IntoIterator` is not satisfied - = note: required for `[K]` to implement `IntoIterator` -help: consider borrowing here - | -LL | for i2 in &v2[1..] { - | + -LL | for i2 in &mut v2[1..] { - | ++++ - error[E0277]: `[K]` is not an iterator --> $DIR/slice-issue-87994.rs:11:13 | @@ -58,6 +28,6 @@ LL | for i2 in &v2[1..] { LL | for i2 in &mut v2[1..] { | ++++ -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr b/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr index 4fda1e49911c8..f6ed651215c68 100644 --- a/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr +++ b/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr @@ -1,3 +1,41 @@ +error[E0782]: expected a type, found a trait + --> $DIR/suggest-blanket-impl-local-trait.rs:13:24 + | +LL | impl LocalTraitTwo for LocalTraitOne {} + | ^^^^^^^^^^^^^ + | +help: you can add the `dyn` keyword if you want a trait object + | +LL | impl LocalTraitTwo for dyn LocalTraitOne {} + | +++ +help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` + | +LL - impl LocalTraitTwo for LocalTraitOne {} +LL + impl LocalTraitTwo for T {} + | + +error[E0782]: expected a type, found a trait + --> $DIR/suggest-blanket-impl-local-trait.rs:18:23 + | +LL | impl fmt::Display for LocalTraitOne { + | ^^^^^^^^^^^^^ + | +help: you can add the `dyn` keyword if you want a trait object + | +LL | impl fmt::Display for dyn LocalTraitOne { + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/suggest-blanket-impl-local-trait.rs:26:23 + | +LL | impl fmt::Display for LocalTraitTwo + Send { + | ^^^^^^^^^^^^^^^^^^^^ + | +help: you can add the `dyn` keyword if you want a trait object + | +LL | impl fmt::Display for dyn LocalTraitTwo + Send { + | +++ + error[E0782]: expected a type, found a trait --> $DIR/suggest-blanket-impl-local-trait.rs:34:24 | @@ -30,22 +68,6 @@ LL - impl LocalTraitOne for fmt::Display + Send {} LL + impl LocalTraitOne for T {} | -error[E0782]: expected a type, found a trait - --> $DIR/suggest-blanket-impl-local-trait.rs:13:24 - | -LL | impl LocalTraitTwo for LocalTraitOne {} - | ^^^^^^^^^^^^^ - | -help: you can add the `dyn` keyword if you want a trait object - | -LL | impl LocalTraitTwo for dyn LocalTraitOne {} - | +++ -help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` - | -LL - impl LocalTraitTwo for LocalTraitOne {} -LL + impl LocalTraitTwo for T {} - | - error[E0782]: expected a type, found a trait --> $DIR/suggest-blanket-impl-local-trait.rs:46:29 | @@ -62,28 +84,6 @@ LL - impl GenericTrait for LocalTraitOne {} LL + impl GenericTrait for T {} | -error[E0782]: expected a type, found a trait - --> $DIR/suggest-blanket-impl-local-trait.rs:18:23 - | -LL | impl fmt::Display for LocalTraitOne { - | ^^^^^^^^^^^^^ - | -help: you can add the `dyn` keyword if you want a trait object - | -LL | impl fmt::Display for dyn LocalTraitOne { - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/suggest-blanket-impl-local-trait.rs:26:23 - | -LL | impl fmt::Display for LocalTraitTwo + Send { - | ^^^^^^^^^^^^^^^^^^^^ - | -help: you can add the `dyn` keyword if you want a trait object - | -LL | impl fmt::Display for dyn LocalTraitTwo + Send { - | +++ - error[E0782]: expected a type, found a trait --> $DIR/suggest-blanket-impl-local-trait.rs:53:35 | diff --git a/tests/ui/suggestions/suggest-dereferencing-index.stderr b/tests/ui/suggestions/suggest-dereferencing-index.stderr index cee5ffcb2ae8c..a1b66c2203e98 100644 --- a/tests/ui/suggestions/suggest-dereferencing-index.stderr +++ b/tests/ui/suggestions/suggest-dereferencing-index.stderr @@ -13,6 +13,8 @@ help: `usize` implements trait `SliceIndex` | = note: `SliceIndex` = note: required for `[{integer}]` to implement `Index<&usize>` + = note: 1 redundant requirement hidden + = note: required for `[{integer}; 3]` to implement `Index<&usize>` help: dereference this index | LL | let one_item_please: i32 = [1, 2, 3][*i]; diff --git a/tests/ui/suggestions/suggest-remove-reference-index.stderr b/tests/ui/suggestions/suggest-remove-reference-index.stderr index 4f396fe529508..07ceb87d160ed 100644 --- a/tests/ui/suggestions/suggest-remove-reference-index.stderr +++ b/tests/ui/suggestions/suggest-remove-reference-index.stderr @@ -13,6 +13,8 @@ help: `usize` implements trait `SliceIndex` | = note: `SliceIndex` = note: required for `[bool]` to implement `Index<&usize>` + = note: 1 redundant requirement hidden + = note: required for `[bool; 1]` to implement `Index<&usize>` help: remove this reference | LL - println!("{}", arr[&i]); @@ -34,6 +36,8 @@ help: `usize` implements trait `SliceIndex` | = note: `SliceIndex` = note: required for `[bool]` to implement `Index<&usize>` + = note: 1 redundant requirement hidden + = note: required for `[bool; 1]` to implement `Index<&usize>` help: remove this reference | LL - println!("{}", arr[&(i + 0)]); @@ -55,6 +59,8 @@ help: `usize` implements trait `SliceIndex` | = note: `SliceIndex` = note: required for `[bool]` to implement `Index<&usize>` + = note: 1 redundant requirement hidden + = note: required for `[bool; 1]` to implement `Index<&usize>` help: remove this reference | LL - println!("{}", arr[& i]); diff --git a/tests/ui/suggestions/suggest-remove-refs-5.stderr b/tests/ui/suggestions/suggest-remove-refs-5.stderr index ae83012c70e5d..b2a10e66b4d9d 100644 --- a/tests/ui/suggestions/suggest-remove-refs-5.stderr +++ b/tests/ui/suggestions/suggest-remove-refs-5.stderr @@ -1,8 +1,8 @@ -error[E0277]: `&mut &mut &mut &mut Vec` is not an iterator +error[E0277]: `Vec` is not an iterator --> $DIR/suggest-remove-refs-5.rs:4:14 | LL | for _ in &mut &mut v {} - | ^^^^^^^^^^^ `&mut &mut &mut &mut Vec` is not an iterator + | ^^^^^^^^^^^ `Vec` is not an iterator | = help: the trait `Iterator` is not implemented for `Vec` = note: required for `&mut Vec` to implement `Iterator` @@ -15,11 +15,11 @@ LL ~ let v = &mut Vec::::new(); LL ~ for _ in v {} | -error[E0277]: `&mut &mut &mut [u8; 1]` is not an iterator +error[E0277]: `[u8; 1]` is not an iterator --> $DIR/suggest-remove-refs-5.rs:7:14 | LL | for _ in &mut v {} - | ^^^^^^ `&mut &mut &mut [u8; 1]` is not an iterator + | ^^^^^^ `[u8; 1]` is not an iterator | = help: the trait `Iterator` is not implemented for `[u8; 1]` = note: required for `&mut [u8; 1]` to implement `Iterator` diff --git a/tests/ui/suggestions/types/into-inference-needs-type.stderr b/tests/ui/suggestions/types/into-inference-needs-type.stderr index 5fbc281072047..9c4d880de2d88 100644 --- a/tests/ui/suggestions/types/into-inference-needs-type.stderr +++ b/tests/ui/suggestions/types/into-inference-needs-type.stderr @@ -1,11 +1,9 @@ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/into-inference-needs-type.rs:12:10 | LL | .into()?; | ^^^^ | - = note: the type must implement `From, {closure@$DIR/into-inference-needs-type.rs:10:14: 10:17}>, fn(Option<&str>) -> Option> {Option::>::Some}>>` - = note: required for `FilterMap, {closure@$DIR/into-inference-needs-type.rs:10:14: 10:17}>, fn(Option<&str>) -> Option> {Option::>::Some}>` to implement `Into<_>` help: try using a fully qualified path to specify the expected types | LL ~ let list = , _>, _> as Into>::into(vec @@ -16,4 +14,4 @@ LL ~ .filter_map(Option::Some))?; error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr b/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr index c8e89b5d0bc66..8a6d90e580b2a 100644 --- a/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr +++ b/tests/ui/trait-bounds/deep-level-send-bound-check-issue-40827.stderr @@ -25,33 +25,6 @@ note: required by a bound in `f` LL | fn f(_: T) {} | ^^^^ required by this bound in `f` -error[E0277]: `Rc` cannot be sent between threads safely - --> $DIR/deep-level-send-bound-check-issue-40827.rs:14:7 - | -LL | f(Foo(Arc::new(Bar::B(None)))); - | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc` cannot be sent between threads safely - | | - | required by a bound introduced by this call - | - = help: within `Bar`, the trait `Send` is not implemented for `Rc` -note: required because it appears within the type `Bar` - --> $DIR/deep-level-send-bound-check-issue-40827.rs:7:7 - | -LL | enum Bar { -LL | A(Rc), - | ^^^^^^^ required by this field - = note: required for `Arc` to implement `Send` -note: required because it appears within the type `Foo` - --> $DIR/deep-level-send-bound-check-issue-40827.rs:4:12 - | -LL | struct Foo(Arc); - | ^^^^^^^^ required by this field -note: required by a bound in `f` - --> $DIR/deep-level-send-bound-check-issue-40827.rs:11:9 - | -LL | fn f(_: T) {} - | ^^^^ required by this bound in `f` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/trait-bounds/ice-unsized-struct-arg-issue2-121424.stderr b/tests/ui/trait-bounds/ice-unsized-struct-arg-issue2-121424.stderr index 398dc6ef637c9..1d2a9ab209720 100644 --- a/tests/ui/trait-bounds/ice-unsized-struct-arg-issue2-121424.stderr +++ b/tests/ui/trait-bounds/ice-unsized-struct-arg-issue2-121424.stderr @@ -1,30 +1,42 @@ -error[E0277]: the trait bound `[bool]: Copy` is not satisfied +error[E0277]: the size for values of type `[bool]` cannot be known at compilation time --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:5:22 | LL | const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]); - | ^^^^^^^^^^^ the trait `Copy` is not implemented for `[bool]` + | ^^^^^^^^^^^ doesn't have a size known at compile-time | -help: the trait `Copy` is implemented for `[T; N]` - --> $SRC_DIR/core/src/array/mod.rs:LL:COL -note: required by a bound in `MySlice` - --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:19 + = help: the trait `Sized` is not implemented for `[bool]` +note: required by an implicit `Sized` bound in `MySlice` + --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:16 | LL | struct MySlice(bool, T); - | ^^^^ required by this bound in `MySlice` + | ^ required by the implicit `Sized` requirement on this type parameter in `MySlice` +help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` + --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:16 + | +LL | struct MySlice(bool, T); + | ^ - ...if indirection were used here: `Box` + | | + | this could be changed to `T: ?Sized`... -error[E0277]: the trait bound `[bool]: Copy` is not satisfied +error[E0277]: the size for values of type `[bool]` cannot be known at compilation time --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:5:22 | LL | const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]); - | ^^^^^^^^^^^ the trait `Copy` is not implemented for `[bool]` + | ^^^^^^^^^^^ doesn't have a size known at compile-time | -help: the trait `Copy` is implemented for `[T; N]` - --> $SRC_DIR/core/src/array/mod.rs:LL:COL -note: required by a bound in `MySlice` - --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:19 + = help: the trait `Sized` is not implemented for `[bool]` +note: required by an implicit `Sized` bound in `MySlice` + --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:16 + | +LL | struct MySlice(bool, T); + | ^ required by the implicit `Sized` requirement on this type parameter in `MySlice` +help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` + --> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:16 | LL | struct MySlice(bool, T); - | ^^^^ required by this bound in `MySlice` + | ^ - ...if indirection were used here: `Box` + | | + | this could be changed to `T: ?Sized`... = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/trait-bounds/unsized-bound.stderr b/tests/ui/trait-bounds/unsized-bound.stderr index c8049ebee1173..22b0c2c069d35 100644 --- a/tests/ui/trait-bounds/unsized-bound.stderr +++ b/tests/ui/trait-bounds/unsized-bound.stderr @@ -37,6 +37,21 @@ LL - impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} LL + impl Trait<(A, B)> for (A, B) where B: ?Sized, {} | +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:2:12 + | +LL | impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} + | - ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | + = note: only the last element of a tuple may have a dynamically sized type +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} +LL + impl Trait<(A, B)> for (A, B) where B: ?Sized, {} + | + error[E0277]: the size for values of type `C` cannot be known at compilation time --> $DIR/unsized-bound.rs:5:52 | @@ -74,17 +89,19 @@ LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Size LL + impl Trait<(A, B, C)> for (A, B, C) {} | -error[E0277]: the size for values of type `B` cannot be known at compilation time - --> $DIR/unsized-bound.rs:5:52 +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:5:31 | LL | impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} - | - this type parameter needs to be `Sized` ^^^^^^^^^ doesn't have a size known at compile-time + | - ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` | = note: only the last element of a tuple may have a dynamically sized type help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} -LL + impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} +LL + impl Trait<(A, B, C)> for (A, B, C) {} | error[E0277]: the size for values of type `B` cannot be known at compilation time @@ -126,6 +143,21 @@ LL - impl Trait2<(A, B)> for (A, B) {} LL + impl Trait2<(A, B)> for (A, B) {} | +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:10:28 + | +LL | impl Trait2<(A, B)> for (A, B) {} + | - ^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | + = note: only the last element of a tuple may have a dynamically sized type +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait2<(A, B)> for (A, B) {} +LL + impl Trait2<(A, B)> for (A, B) {} + | + error[E0277]: the size for values of type `A` cannot be known at compilation time --> $DIR/unsized-bound.rs:14:23 | @@ -264,6 +296,6 @@ help: consider relaxing the implicit `Sized` restriction LL | trait Trait8 {} | ++++++++ -error: aborting due to 13 previous errors +error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/alias/cross-crate.stderr b/tests/ui/traits/alias/cross-crate.stderr index 8ed05b4758d84..6cb4b23aac205 100644 --- a/tests/ui/traits/alias/cross-crate.stderr +++ b/tests/ui/traits/alias/cross-crate.stderr @@ -2,28 +2,14 @@ error[E0277]: the trait bound `Rc: SendSync` is not satisfied --> $DIR/cross-crate.rs:14:17 | LL | use_alias::>(); - | ^^^^^^^ the trait `Send` is not implemented for `Rc` + | ^^^^^^^ the trait `SendSync` is not implemented for `Rc` | - = note: required for `Rc` to implement `SendSync` note: required by a bound in `use_alias` --> $DIR/cross-crate.rs:10:17 | LL | fn use_alias() {} | ^^^^^^^^ required by this bound in `use_alias` -error[E0277]: the trait bound `Rc: SendSync` is not satisfied - --> $DIR/cross-crate.rs:14:17 - | -LL | use_alias::>(); - | ^^^^^^^ the trait `Sync` is not implemented for `Rc` - | - = note: required for `Rc` to implement `SendSync` -note: required by a bound in `use_alias` - --> $DIR/cross-crate.rs:10:17 - | -LL | fn use_alias() {} - | ^^^^^^^^ required by this bound in `use_alias` - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/alias/default-trait-bounds.fail.stderr b/tests/ui/traits/alias/default-trait-bounds.fail.stderr index 9216a1443b647..4bc74f4962aee 100644 --- a/tests/ui/traits/alias/default-trait-bounds.fail.stderr +++ b/tests/ui/traits/alias/default-trait-bounds.fail.stderr @@ -1,25 +1,21 @@ -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `(): A1` is not satisfied --> $DIR/default-trait-bounds.rs:26:34 | LL | #[cfg(fail)] fn a1_fail() { a1::; } - | ^^^ doesn't have a size known at compile-time + | ^^^ the trait `A1` is not implemented for `()` | - = help: the trait `Sized` is not implemented for `str` - = note: required for `()` to implement `A1` note: required by a bound in `a1` --> $DIR/default-trait-bounds.rs:25:30 | LL | fn a1() where (): A1 { ensure_is_sized::; } | ^^^^^ required by this bound in `a1` -error[E0277]: the size for values of type `ExternTy` cannot be known +error[E0277]: the trait bound `(): B1` is not satisfied --> $DIR/default-trait-bounds.rs:49:34 | LL | #[cfg(fail)] fn b1_fail() { b1::; } - | ^^^^^^^^ doesn't have a known size + | ^^^^^^^^ the trait `B1` is not implemented for `()` | - = help: the nightly-only, unstable trait `MetaSized` is not implemented for `ExternTy` - = note: required for `()` to implement `B1` note: required by a bound in `b1` --> $DIR/default-trait-bounds.rs:47:36 | @@ -30,9 +26,8 @@ error[E0277]: the trait bound `ExternTy: C1` is not satisfied --> $DIR/default-trait-bounds.rs:65:34 | LL | #[cfg(fail)] fn c1_fail() { c1::; } - | ^^^^^^^^ the nightly-only, unstable trait `MetaSized` is not implemented for `ExternTy` + | ^^^^^^^^ the trait `C1` is not implemented for `ExternTy` | - = note: required for `ExternTy` to implement `C1` note: required by a bound in `c1` --> $DIR/default-trait-bounds.rs:63:35 | diff --git a/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr index 27e23adb92aed..cd93024faa5e8 100644 --- a/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr +++ b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr @@ -2,11 +2,10 @@ error[E0277]: the trait bound `(): IteratorAlias` is not satisfied --> $DIR/issue-108072-unmet-trait-alias-bound.rs:10:7 | LL | f(()) - | - ^^ the trait `Iterator` is not implemented for `()` + | - ^^ the trait `IteratorAlias` is not implemented for `()` | | | required by a bound introduced by this call | - = note: required for `()` to implement `IteratorAlias` note: required by a bound in `f` --> $DIR/issue-108072-unmet-trait-alias-bound.rs:7:14 | diff --git a/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr index 1884ba620c961..0d42662806904 100644 --- a/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr +++ b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.stderr @@ -7,11 +7,13 @@ LL | struct Foo(I); LL | Foo::<()>::f() | ^ associated function or constant cannot be called on `Foo<()>` due to unsatisfied trait bounds | -note: trait bound `(): Iterator` was not satisfied - --> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:5:23 +note: trait bound `(): IteratorAlias` was not satisfied + --> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:9:9 | -LL | trait IteratorAlias = Iterator; - | ------------- ^^^^^^^^ unsatisfied trait bound introduced here +LL | impl Foo { + | ^^^^^^^^^^^^^ ------ + | | + | unsatisfied trait bound introduced here error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/more-default-trait-bounds.fail.stderr b/tests/ui/traits/alias/more-default-trait-bounds.fail.stderr index 35672b14c73b3..d835cb23c2502 100644 --- a/tests/ui/traits/alias/more-default-trait-bounds.fail.stderr +++ b/tests/ui/traits/alias/more-default-trait-bounds.fail.stderr @@ -1,15 +1,9 @@ -error[E0277]: the trait bound `Unmarked: Mark` is not satisfied +error[E0277]: the trait bound `(): A1` is not satisfied --> $DIR/more-default-trait-bounds.rs:27:34 | LL | #[cfg(fail)] fn a1_fail() { a1::; } - | ^^^^^^^^ unsatisfied trait bound - | -help: the trait `Mark` is not implemented for `Unmarked` - --> $DIR/more-default-trait-bounds.rs:47:1 + | ^^^^^^^^ the trait `A1` is not implemented for `()` | -LL | enum Unmarked {} - | ^^^^^^^^^^^^^ - = note: required for `()` to implement `A1` note: required by a bound in `a1` --> $DIR/more-default-trait-bounds.rs:25:29 | @@ -22,12 +16,11 @@ error[E0277]: the trait bound `Unmarked: B1` is not satisfied LL | #[cfg(fail)] fn b1_fail() { b1::; } | ^^^^^^^^ unsatisfied trait bound | -help: the trait `Mark` is not implemented for `Unmarked` +help: the trait `B1` is not implemented for `Unmarked` --> $DIR/more-default-trait-bounds.rs:47:1 | LL | enum Unmarked {} | ^^^^^^^^^^^^^ - = note: required for `Unmarked` to implement `B1` note: required by a bound in `b1` --> $DIR/more-default-trait-bounds.rs:39:28 | diff --git a/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.stderr b/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.stderr index d2d7df466512d..33536801d9b66 100644 --- a/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.stderr +++ b/tests/ui/traits/ambiguous-trait-matching-distinct-lifetimes.stderr @@ -1,17 +1,3 @@ -error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo` - --> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19 - | -LL | where &'a T : Foo, - | ^^^ - | -note: multiple `impl`s or `where` clauses satisfying `&'a T: Foo` found - --> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:13:19 - | -LL | where &'a T : Foo, - | ^^^ -LL | &'b T : Foo - | ^^^ - error[E0283]: type annotations needed: cannot satisfy `&T: Foo` --> $DIR/ambiguous-trait-matching-distinct-lifetimes.rs:16:7 | @@ -26,6 +12,6 @@ LL | where &'a T : Foo, LL | &'b T : Foo | ^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/ambiguous-where-bounds-differ-by-lifetime.stderr b/tests/ui/traits/ambiguous-where-bounds-differ-by-lifetime.stderr index 30ac4fee1f27c..4276dac638810 100644 --- a/tests/ui/traits/ambiguous-where-bounds-differ-by-lifetime.stderr +++ b/tests/ui/traits/ambiguous-where-bounds-differ-by-lifetime.stderr @@ -1,14 +1,19 @@ -error[E0283]: type annotations needed: cannot satisfy `T0: Trait0<'l0>` - --> $DIR/ambiguous-where-bounds-differ-by-lifetime.rs:6:57 +error[E0283]: type annotations needed: cannot satisfy `T0: Trait0<'_>` + --> $DIR/ambiguous-where-bounds-differ-by-lifetime.rs:6:41 | LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} - | ^^^^^^^^^^^ + | ^^^^ | -note: multiple `impl`s or `where` clauses satisfying `T0: Trait0<'l0>` found +note: multiple `impl`s or `where` clauses satisfying `T0: Trait0<'_>` found --> $DIR/ambiguous-where-bounds-differ-by-lifetime.rs:6:57 | LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} | ^^^^^^^^^^^ ^^^^^^^^^^^ +note: required for `bool` to implement `Trait1<'l0, T0>` + --> $DIR/ambiguous-where-bounds-differ-by-lifetime.rs:6:21 + | +LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} + | ^^^^^^^^^^^^^^^ ^^^^ ----------- unsatisfied trait bound introduced here error: aborting due to 1 previous error diff --git a/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr b/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr index f26c321a2973c..5f09213f37129 100644 --- a/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr +++ b/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr @@ -2,25 +2,24 @@ error[E0599]: the associated function or constant `bat` exists for struct `Foo`, --> $DIR/associated-item-unsatisfied-trait-bounds.rs:8:10 | LL | struct Foo; - | ---------- associated function or constant `bat` not found for this struct because `Foo` doesn't implement `Bar` or `Baz` + | ---------- associated function or constant `bat` not found for this struct because it doesn't satisfy `Foo: Bar` or `Foo: Bat` ... LL | Foo::bat(()); | ^^^ associated function or constant cannot be called on `Foo` due to unsatisfied trait bounds | -note: for `bat` to be available, `Foo` must implement `Bar` and `Baz` +note: the following trait bounds were not satisfied: + `&Foo: Bar` + `&mut Foo: Bar` + `Foo: Bar` --> $DIR/associated-item-unsatisfied-trait-bounds.rs:5:38 | LL | impl Bat for T where T: 'static + Bar + Baz { fn bat(&self) { println!("generic bat"); } } - | --- - ^^^ ^^^ unsatisfied trait bound introduced here - | | - | unsatisfied trait bound introduced here -note: the traits `Bar` and `Baz` must be implemented + | --- - ^^^ unsatisfied trait bound introduced here +note: the trait `Bar` must be implemented --> $DIR/associated-item-unsatisfied-trait-bounds.rs:2:1 | LL | trait Bar {} | ^^^^^^^^^ -LL | trait Baz {} - | ^^^^^^^^^ = help: items from traits can only be used if the trait is implemented and in scope note: `Bat` defines an item `bat`, perhaps you need to implement it --> $DIR/associated-item-unsatisfied-trait-bounds.rs:4:1 diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index 0c045660cf7c2..0a326d9adc170 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -48,6 +48,23 @@ help: turn the generic argument into an associated item binding LL | fn func>(t: T) -> impl Trait<(), Assoc = i32> { | +++++++ +error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:19:46 + | +LL | fn func>(t: T) -> impl Trait<(), i32> { + | ^^^^^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `T` + --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11 + | +LL | pub trait Trait { + | ^^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: turn the generic argument into an associated item binding + | +LL | fn func>(t: T) -> impl Trait<(), Assoc = i32> { + | +++++++ + error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:26:18 | @@ -110,23 +127,6 @@ note: struct defined here, with 1 generic parameter: `T` LL | struct Struct> { | ^^^^^^ - -error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:19:46 - | -LL | fn func>(t: T) -> impl Trait<(), i32> { - | ^^^^^ expected 1 generic argument - | -note: trait defined here, with 1 generic parameter: `T` - --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11 - | -LL | pub trait Trait { - | ^^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: turn the generic argument into an associated item binding - | -LL | fn func>(t: T) -> impl Trait<(), Assoc = i32> { - | +++++++ - error: aborting due to 9 previous errors Some errors have detailed explanations: E0107, E0207. diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr index 5f8ea386142d1..52a1ba4773e15 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr @@ -1,11 +1,12 @@ -error[E0277]: the trait bound `str: Clone` is not satisfied +error[E0277]: the trait bound `str: Clone` is not satisfied in `dyn X` --> $DIR/check-trait-object-bounds-1.rs:12:9 | LL | f::>(); - | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | ^^^^^^^^^^^^^^ within `dyn X`, the trait `Clone` is not implemented for `str` | help: the trait `Clone` is implemented for `String` --> $SRC_DIR/alloc/src/string.rs:LL:COL + = note: required because it appears within the type `dyn X` note: required by a bound in `f` --> $DIR/check-trait-object-bounds-1.rs:7:9 | diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr index c4bc50746ebba..63c5bcac4269e 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr @@ -1,10 +1,10 @@ -error[E0277]: expected an `FnOnce(&i32)` closure, found `i32` +error[E0271]: type mismatch resolving `>::Output == &i32` --> $DIR/check-trait-object-bounds-2.rs:13:9 | LL | f:: X<'x, F = i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&i32)` closure, found `i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | - = help: the trait `for<'a> FnOnce(&'a i32)` is not implemented for `i32` + = note: required because it appears within the type `dyn for<'x> X<'x, F = i32>` note: required by a bound in `f` --> $DIR/check-trait-object-bounds-2.rs:8:9 | @@ -13,4 +13,4 @@ LL | fn f X<'r> + ?Sized>() { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr index 62c327bf7ceb7..65add60ff37b4 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr @@ -1,11 +1,12 @@ -error[E0277]: the trait bound `str: Clone` is not satisfied +error[E0277]: the trait bound `str: Clone` is not satisfied in `dyn X` --> $DIR/check-trait-object-bounds-4.rs:15:9 | LL | f::>(); - | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | ^^^^^^^^^^^^^^ within `dyn X`, the trait `Clone` is not implemented for `str` | help: the trait `Clone` is implemented for `String` --> $SRC_DIR/alloc/src/string.rs:LL:COL + = note: required because it appears within the type `dyn X` note: required by a bound in `f` --> $DIR/check-trait-object-bounds-4.rs:10:9 | diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr index 3e9e6dcac91ae..35760bc0d4487 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr @@ -11,6 +11,7 @@ note: expected this to be `i64` | LL | type T = U; | ^ + = note: required because it appears within the type `dyn Obj` note: required by a bound in `is_obj` --> $DIR/check-trait-object-bounds-5.rs:20:23 | diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr index 0e2a32735e96f..9f6360dc5a950 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr @@ -11,6 +11,7 @@ note: expected this to be `i64` | LL | type T = U; | ^ + = note: required because it appears within the type `dyn Obj` note: required by a bound in `is_obj` --> $DIR/check-trait-object-bounds-6.rs:17:23 | diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 1cd62d2cbdbaa..b5b8cb47c33c8 100644 --- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `u8: Pattern` is not satisfied --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 | LL | s.strip_suffix(b'\n').unwrap_or(s) - | ------------ ^^^^^ the trait `FnMut(char)` is not implemented for `u8` + | ------------ ^^^^^ the trait `FnOnce(char)` is not implemented for `u8` | | | required by a bound introduced by this call | @@ -18,6 +18,41 @@ LL | s.strip_suffix(b'\n').unwrap_or(s) note: required by a bound in `core::str::::strip_suffix` --> $SRC_DIR/core/src/str/mod.rs:LL:COL -error: aborting due to 1 previous error +error[E0277]: expected an `FnOnce(char)` closure, found `u8` + --> $DIR/assoc-fn-bound-root-obligation.rs:2:5 + | +LL | s.strip_suffix(b'\n').unwrap_or(s) + | ^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(char)` closure, found `u8` + | + = help: the trait `FnOnce(char)` is not implemented for `u8` + = help: the following other types implement trait `Pattern`: + &'b String + &'b [char; N] + &'b [char] + &'b str + &'c &'b str + [char; N] + char + = note: required for `u8` to implement `Pattern` + +error[E0277]: the trait bound `for<'a> ::Searcher<'a>: ReverseSearcher<'a>` is not satisfied + --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 + | +LL | s.strip_suffix(b'\n').unwrap_or(s) + | ------------ ^^^^^ the nightly-only, unstable trait `for<'a> ReverseSearcher<'a>` is not implemented for `::Searcher<'a>` + | | + | required by a bound introduced by this call + | + = help: the following other types implement trait `ReverseSearcher<'a>`: + CharArrayRefSearcher<'a, 'b, N> + CharArraySearcher<'a, N> + CharPredicateSearcher<'a, F> + CharSearcher<'a> + CharSliceSearcher<'a, 'b> + StrSearcher<'a, 'b> +note: required by a bound in `core::str::::strip_suffix` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/coercion-generic-bad.stderr b/tests/ui/traits/coercion-generic-bad.stderr index 947e76af4183a..0d083781079e7 100644 --- a/tests/ui/traits/coercion-generic-bad.stderr +++ b/tests/ui/traits/coercion-generic-bad.stderr @@ -1,9 +1,14 @@ -error[E0277]: the trait bound `Struct: Trait` is not satisfied +error[E0277]: the trait bound `Struct: Trait` is not satisfied in `Struct` --> $DIR/coercion-generic-bad.rs:16:36 | LL | let s: Box> = Box::new(Struct { person: "Fred" }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: within `Struct`, the trait `Trait` is not implemented for `Struct` + --> $DIR/coercion-generic-bad.rs:1:1 + | +LL | struct Struct { + | ^^^^^^^^^^^^^ help: the trait `Trait` is not implemented for `Struct` but trait `Trait<&'static str>` is implemented for it --> $DIR/coercion-generic-bad.rs:9:1 @@ -11,6 +16,12 @@ help: the trait `Trait` is not implemented for `Struct` LL | impl Trait<&'static str> for Struct { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for that trait implementation, expected `&'static str`, found `isize` +note: required because it appears within the type `Struct` + --> $DIR/coercion-generic-bad.rs:1:8 + | +LL | struct Struct { + | ^^^^^^ + = note: required for `Box` to implement `CoerceUnsized>>` = note: required for the cast from `Box` to `Box>` error: aborting due to 1 previous error diff --git a/tests/ui/traits/compare-impl-item-conflicting-lifetime-requirements.stderr b/tests/ui/traits/compare-impl-item-conflicting-lifetime-requirements.stderr index f6ae851430cd8..f72815269704a 100644 --- a/tests/ui/traits/compare-impl-item-conflicting-lifetime-requirements.stderr +++ b/tests/ui/traits/compare-impl-item-conflicting-lifetime-requirements.stderr @@ -9,36 +9,30 @@ note: first, the lifetime cannot outlive the lifetime `'s` as defined here... | LL | fn get<'s>(s: &'s str, _: ()) -> &'_ str; | ^^ -note: ...so that the method type is compatible with trait +note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/compare-impl-item-conflicting-lifetime-requirements.rs:17:5 | LL | fn get<'s>(s: &'s str, _: <&&'s () as Project>::Ty) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `fn(&'s _, ()) -> &'s _` - found `fn(&_, ()) -> &'static _` = note: but, the lifetime must be valid for the static lifetime... -note: ...so that the types are compatible +note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/compare-impl-item-conflicting-lifetime-requirements.rs:17:5 | LL | fn get<'s>(s: &'s str, _: <&&'s () as Project>::Ty) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `<&&() as Project>` - found `<&&'static () as Project>` -error[E0308]: mismatched types +error[E0478]: lifetime bound not satisfied --> $DIR/compare-impl-item-conflicting-lifetime-requirements.rs:17:31 | LL | fn get<'s>(s: &'s str, _: <&&'s () as Project>::Ty) -> &'static str { - | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected trait `<&&'s () as Project>` - found trait `<&&'static () as Project>` -note: the lifetime `'s` as defined here... +note: lifetime parameter instantiated with the lifetime `'s` as defined here --> $DIR/compare-impl-item-conflicting-lifetime-requirements.rs:17:12 | LL | fn get<'s>(s: &'s str, _: <&&'s () as Project>::Ty) -> &'static str { | ^^ - = note: ...does not necessarily outlive the static lifetime + = note: but lifetime parameter must outlive the static lifetime error: lifetime may not live long enough --> $DIR/compare-impl-item-conflicting-lifetime-requirements.rs:17:5 @@ -51,5 +45,5 @@ LL | fn get<'s>(s: &'s str, _: <&&'s () as Project>::Ty) -> &'static str { error: aborting due to 3 previous errors -Some errors have detailed explanations: E0308, E0803. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0478, E0803. +For more information about an error, try `rustc --explain E0478`. diff --git a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr index 30fbeb72fab9a..eef38d402f7a3 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr @@ -1,9 +1,16 @@ error[E0277]: the trait bound `(): const Tr` is not satisfied - --> $DIR/const-closure-trait-method-fail.rs:17:23 + --> $DIR/const-closure-trait-method-fail.rs:17:42 | LL | const _: () = assert!(need_const_closure(Tr::a) == 42); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ------------------ ^^^^^ + | | + | required by a bound introduced by this call | +note: required by a bound in `need_const_closure` + --> $DIR/const-closure-trait-method-fail.rs:13:32 + | +LL | const fn need_const_closure i32>(x: T) -> i32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `need_const_closure` help: make the `impl` of trait `Tr` `const` | LL | const impl Tr for () { diff --git a/tests/ui/traits/const-traits/specialization/specializing-constness-2.stderr b/tests/ui/traits/const-traits/specialization/specializing-constness-2.stderr index aed032714b6df..87139d353b710 100644 --- a/tests/ui/traits/const-traits/specialization/specializing-constness-2.stderr +++ b/tests/ui/traits/const-traits/specialization/specializing-constness-2.stderr @@ -1,13 +1,20 @@ -error[E0277]: the trait bound `T: [const] A` is not satisfied +error[E0277]: the trait bound `T: Sup` is not satisfied --> $DIR/specializing-constness-2.rs:26:6 | LL | ::a(); - | ^ + | ^ the trait `Sup` is not implemented for `T` | -help: make the `impl` of trait `A` `const` +note: required for `T` to implement `[const] A` + --> $DIR/specializing-constness-2.rs:19:38 | -LL | const impl A for T { - | +++++ +LL | const impl A for T { + | ----------- ^ ^ + | | + | unsatisfied trait bound introduced here +help: consider further restricting type parameter `T` with trait `Sup` + | +LL | const fn generic() { + | +++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/copy-bounds-impl-type-params.stderr b/tests/ui/traits/copy-bounds-impl-type-params.stderr index 4f9600f3f321d..84446aa8a5ac1 100644 --- a/tests/ui/traits/copy-bounds-impl-type-params.stderr +++ b/tests/ui/traits/copy-bounds-impl-type-params.stderr @@ -11,31 +11,18 @@ LL | impl Gettable for S {} | ---- ^^^^^^^^^^^ ^^^^ | | | unsatisfied trait bound introduced here +note: required because it appears within the type `S` + --> $DIR/copy-bounds-impl-type-params.rs:6:8 + | +LL | struct S(marker::PhantomData); + | ^ + = note: required for `&S` to implement `CoerceUnsized<&dyn Gettable>` = note: required for the cast from `&S` to `&dyn Gettable` help: consider restricting type parameter `T` with trait `Send` | LL | fn f(val: T) { | +++++++++++++++++++ -error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/copy-bounds-impl-type-params.rs:18:13 - | -LL | let a = &t as &dyn Gettable; - | ^^ the trait `Copy` is not implemented for `T` - | -note: required for `S` to implement `Gettable` - --> $DIR/copy-bounds-impl-type-params.rs:14:32 - | -LL | impl Gettable for S {} - | ---- ^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: required for the cast from `&S` to `&dyn Gettable` -help: consider restricting type parameter `T` with trait `Copy` - | -LL | fn f(val: T) { - | +++++++++++++++++++ - error[E0277]: `T` cannot be sent between threads safely --> $DIR/copy-bounds-impl-type-params.rs:25:31 | @@ -49,44 +36,24 @@ LL | impl Gettable for S {} | ---- ^^^^^^^^^^^ ^^^^ | | | unsatisfied trait bound introduced here +note: required because it appears within the type `S` + --> $DIR/copy-bounds-impl-type-params.rs:6:8 + | +LL | struct S(marker::PhantomData); + | ^ + = note: required for `&S` to implement `CoerceUnsized<&dyn Gettable>` = note: required for the cast from `&S` to `&dyn Gettable` help: consider restricting type parameter `T` with trait `Send` | LL | fn g(val: T) { | +++++++++++++++++++ -error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/copy-bounds-impl-type-params.rs:25:31 - | -LL | let a: &dyn Gettable = &t; - | ^^ the trait `Copy` is not implemented for `T` - | -note: required for `S` to implement `Gettable` - --> $DIR/copy-bounds-impl-type-params.rs:14:32 - | -LL | impl Gettable for S {} - | ---- ^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: required for the cast from `&S` to `&dyn Gettable` -help: consider restricting type parameter `T` with trait `Copy` - | -LL | fn g(val: T) { - | +++++++++++++++++++ - error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/copy-bounds-impl-type-params.rs:38:13 | LL | let a = t as Box>; | ^ the trait `Copy` is not implemented for `String` | -help: the trait `Gettable` is conditionally implemented for `S` - --> $DIR/copy-bounds-impl-type-params.rs:14:1 - | -LL | impl Gettable for S {} - | ^^^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unsatisfied requirement introduced here: `String: Copy` note: required for `S` to implement `Gettable` --> $DIR/copy-bounds-impl-type-params.rs:14:32 | @@ -94,6 +61,12 @@ LL | impl Gettable for S {} | ---- ^^^^^^^^^^^ ^^^^ | | | unsatisfied trait bound introduced here +note: required because it appears within the type `S` + --> $DIR/copy-bounds-impl-type-params.rs:6:8 + | +LL | struct S(marker::PhantomData); + | ^ + = note: required for `Box>` to implement `CoerceUnsized>>` = note: required for the cast from `Box>` to `Box>` error[E0277]: the trait bound `Foo: Copy` is not satisfied @@ -102,13 +75,6 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied LL | let a: Box> = t; | ^ the trait `Copy` is not implemented for `Foo` | -help: the trait `Gettable` is conditionally implemented for `S` - --> $DIR/copy-bounds-impl-type-params.rs:14:1 - | -LL | impl Gettable for S {} - | ^^^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unsatisfied requirement introduced here: `Foo: Copy` note: required for `S` to implement `Gettable` --> $DIR/copy-bounds-impl-type-params.rs:14:32 | @@ -116,6 +82,12 @@ LL | impl Gettable for S {} | ---- ^^^^^^^^^^^ ^^^^ | | | unsatisfied trait bound introduced here +note: required because it appears within the type `S` + --> $DIR/copy-bounds-impl-type-params.rs:6:8 + | +LL | struct S(marker::PhantomData); + | ^ + = note: required for `Box>` to implement `CoerceUnsized>>` = note: required for the cast from `Box>` to `Box>` help: consider annotating `Foo` with `#[derive(Copy)]` | @@ -132,6 +104,6 @@ LL | let t: S<&'a isize> = S(marker::PhantomData); LL | let a = &t as &dyn Gettable<&'a isize>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static` -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/cycle-cache-err-60010.stderr b/tests/ui/traits/cycle-cache-err-60010.stderr index 1da1e5c2101a4..5a95957c55a15 100644 --- a/tests/ui/traits/cycle-cache-err-60010.stderr +++ b/tests/ui/traits/cycle-cache-err-60010.stderr @@ -1,87 +1,21 @@ -error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe` +error[E0275]: overflow evaluating the requirement `>::Data == _` --> $DIR/cycle-cache-err-60010.rs:27:13 | LL | _parse: >::Data, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating whether `>::Data` is well-formed + --> $DIR/cycle-cache-err-60010.rs:27:13 | -note: required because it appears within the type `PhantomData` - --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `boxed::BoxRaw` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL -note: required because it appears within the type `Box` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL -note: required because it appears within the type `Runtime` - --> $DIR/cycle-cache-err-60010.rs:23:8 - | -LL | struct Runtime { - | ^^^^^^^ -note: required because it appears within the type `RootDatabase` - --> $DIR/cycle-cache-err-60010.rs:21:5 - | -LL | struct RootDatabase { -LL | _runtime: Runtime, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this field -note: required for `RootDatabase` to implement `SourceDatabase` - --> $DIR/cycle-cache-err-60010.rs:43:9 - | -LL | impl SourceDatabase for T - | ^^^^^^^^^^^^^^ ^ -LL | where -LL | T: RefUnwindSafe, - | ------------- unsatisfied trait bound introduced here -note: required for `ParseQuery` to implement `Query` - --> $DIR/cycle-cache-err-60010.rs:36:10 - | -LL | impl Query for ParseQuery - | ^^^^^^^^^ ^^^^^^^^^^ -LL | where -LL | DB: SourceDatabase, - | -------------- unsatisfied trait bound introduced here +LL | _parse: >::Data, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe` +error[E0275]: overflow evaluating the requirement `SalsaStorage: Sized` --> $DIR/cycle-cache-err-60010.rs:32:20 | LL | type Storage = SalsaStorage; | ^^^^^^^^^^^^ | -note: required because it appears within the type `PhantomData` - --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `boxed::BoxRaw` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL -note: required because it appears within the type `Box` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL -note: required because it appears within the type `Runtime` - --> $DIR/cycle-cache-err-60010.rs:23:8 - | -LL | struct Runtime { - | ^^^^^^^ -note: required because it appears within the type `RootDatabase` - --> $DIR/cycle-cache-err-60010.rs:21:5 - | -LL | struct RootDatabase { -LL | _runtime: Runtime, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this field -note: required for `RootDatabase` to implement `SourceDatabase` - --> $DIR/cycle-cache-err-60010.rs:43:9 - | -LL | impl SourceDatabase for T - | ^^^^^^^^^^^^^^ ^ -LL | where -LL | T: RefUnwindSafe, - | ------------- unsatisfied trait bound introduced here -note: required for `ParseQuery` to implement `Query` - --> $DIR/cycle-cache-err-60010.rs:36:10 - | -LL | impl Query for ParseQuery - | ^^^^^^^^^ ^^^^^^^^^^ -LL | where -LL | DB: SourceDatabase, - | -------------- unsatisfied trait bound introduced here -note: required because it appears within the type `SalsaStorage` - --> $DIR/cycle-cache-err-60010.rs:26:8 - | -LL | struct SalsaStorage { - | ^^^^^^^^^^^^ note: required by a bound in `Database::Storage` --> $DIR/cycle-cache-err-60010.rs:7:5 | @@ -93,6 +27,14 @@ help: consider relaxing the implicit `Sized` restriction LL | type Storage: ?Sized; | ++++++++ -error: aborting due to 2 previous errors +error[E0275]: overflow evaluating the requirement `RootDatabase: SourceDatabase` + --> $DIR/cycle-cache-err-60010.rs:69:27 + | +LL | SourceDatabase::parse(db); + | --------------------- ^^ + | | + | required by a bound introduced by this call + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr b/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr index 7fb3980839e4f..6accf62478fc0 100644 --- a/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr +++ b/tests/ui/traits/default_auto_traits/maybe-bounds-in-dyn-traits.stderr @@ -1,10 +1,10 @@ -error[E0277]: the trait bound `NonLeakS: bounds_check::LeakTr` is not satisfied +error[E0277]: the trait bound `&NonLeakS: CoerceUnsized<&dyn bounds_check::LeakTr + Leak>` is not satisfied in `NonLeakS` --> $DIR/maybe-bounds-in-dyn-traits.rs:65:26 | LL | let _: &dyn LeakTr = &NonLeakS; | ^^^^^^^^^ unsatisfied trait bound | -help: the trait `bounds_check::LeakTr` is not implemented for `NonLeakS` +help: within `NonLeakS`, the trait `bounds_check::LeakTr` is not implemented for `NonLeakS` --> $DIR/maybe-bounds-in-dyn-traits.rs:51:1 | LL | struct NonLeakS; @@ -14,8 +14,75 @@ help: the trait `bounds_check::LeakTr` is implemented for `LeakS` | LL | impl LeakTr for LeakS {} | ^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:51:8 + | +LL | struct NonLeakS; + | ^^^^^^^^ +note: required for `&NonLeakS` to implement `CoerceUnsized<&dyn bounds_check::LeakTr + Leak>` + --> $DIR/maybe-bounds-in-dyn-traits.rs:38:68 + | +LL | impl<'a, 'b: 'a, T: ?Sized + ?Leak + Unsize, U: ?Sized + ?Leak> CoerceUnsized<&'a U> for &'b T {} + | --------- ^^^^^^^^^^^^^^^^^^^^ ^^^^^ + | | + | unsatisfied trait bound introduced here = note: required for the cast from `&NonLeakS` to `&dyn bounds_check::LeakTr + Leak` +error[E0277]: the trait bound `&NonLeakS: CoerceUnsized<&dyn bounds_check::LeakTr>` is not satisfied in `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:69:36 + | +LL | let _: &(dyn LeakTr + ?Leak) = &NonLeakS; + | ^^^^^^^^^ unsatisfied trait bound + | +help: within `NonLeakS`, the trait `bounds_check::LeakTr` is not implemented for `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:51:1 + | +LL | struct NonLeakS; + | ^^^^^^^^^^^^^^^ +help: the trait `bounds_check::LeakTr` is implemented for `LeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:62:5 + | +LL | impl LeakTr for LeakS {} + | ^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:51:8 + | +LL | struct NonLeakS; + | ^^^^^^^^ +note: required for `&NonLeakS` to implement `CoerceUnsized<&dyn bounds_check::LeakTr>` + --> $DIR/maybe-bounds-in-dyn-traits.rs:38:68 + | +LL | impl<'a, 'b: 'a, T: ?Sized + ?Leak + Unsize, U: ?Sized + ?Leak> CoerceUnsized<&'a U> for &'b T {} + | --------- ^^^^^^^^^^^^^^^^^^^^ ^^^^^ + | | + | unsatisfied trait bound introduced here + = note: required for the cast from `&NonLeakS` to `&dyn bounds_check::LeakTr` + +error[E0277]: the trait bound `&NonLeakS: CoerceUnsized<&dyn MaybeLeakTr + Leak>` is not satisfied in `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:72:31 + | +LL | let _: &dyn MaybeLeakTr = &NonLeakS; + | ^^^^^^^^^ unsatisfied trait bound + | +help: within `NonLeakS`, the trait `Leak` is not implemented for `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:51:1 + | +LL | struct NonLeakS; + | ^^^^^^^^^^^^^^^ +note: required because it appears within the type `NonLeakS` + --> $DIR/maybe-bounds-in-dyn-traits.rs:51:8 + | +LL | struct NonLeakS; + | ^^^^^^^^ +note: required for `&NonLeakS` to implement `CoerceUnsized<&dyn MaybeLeakTr + Leak>` + --> $DIR/maybe-bounds-in-dyn-traits.rs:38:68 + | +LL | impl<'a, 'b: 'a, T: ?Sized + ?Leak + Unsize, U: ?Sized + ?Leak> CoerceUnsized<&'a U> for &'b T {} + | --------- ^^^^^^^^^^^^^^^^^^^^ ^^^^^ + | | + | unsatisfied trait bound introduced here + = note: required for the cast from `&NonLeakS` to `&dyn MaybeLeakTr + Leak` + error[E0038]: the trait `DynCompatCheck2` is not dyn compatible --> $DIR/maybe-bounds-in-dyn-traits.rs:90:17 | @@ -57,7 +124,7 @@ error[E0220]: associated type `Undefined` not found for `Leak` LL | let _: dyn LeakTr + ?Leak<(), Undefined = ()>; | ^^^^^^^^^ associated type `Undefined` not found -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors Some errors have detailed explanations: E0038, E0107, E0220, E0277. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/derive-implicit-bound-on-clone.stderr b/tests/ui/traits/derive-implicit-bound-on-clone.stderr index 2fb039f965288..d74ac1adc0293 100644 --- a/tests/ui/traits/derive-implicit-bound-on-clone.stderr +++ b/tests/ui/traits/derive-implicit-bound-on-clone.stderr @@ -13,15 +13,13 @@ note: `ContainsRc` does not implement `Clone`, so `&ContainsRc` was | LL | x.clone() | ^ -help: `Clone` is not implemented because the some trait bounds could not be satisfied +help: `Clone` is not implemented because a trait bound is not satisfied --> $DIR/derive-implicit-bound-on-clone.rs:5:19 | LL | #[derive(Clone)] | ----- in this derive macro expansion LL | struct ContainsRc { - | ^ ^ derive introduces an implicit unsatisfied trait bound `K: Clone` - | | - | derive introduces an implicit unsatisfied trait bound `T: Clone` + | ^ derive introduces an implicit `T: Clone` bound = help: consider manually implementing `Clone` to avoid the implicit type parameter bounds error[E0308]: mismatched types diff --git a/tests/ui/traits/derive-implicit-bound.stderr b/tests/ui/traits/derive-implicit-bound.stderr index 9c8cb11440d0c..a4252c9674830 100644 --- a/tests/ui/traits/derive-implicit-bound.stderr +++ b/tests/ui/traits/derive-implicit-bound.stderr @@ -1,30 +1,28 @@ -error[E0277]: can't compare `SomeNode` with `SomeNode` +error[E0277]: can't compare `Id` with `Id` --> $DIR/derive-implicit-bound.rs:25:15 | LL | accept_eq(&node); - | --------- ^^^^^ no implementation for `SomeNode == SomeNode` + | --------- ^^^^^ no implementation for `Id == Id` | | | required by a bound introduced by this call | - = help: the trait `PartialEq` is not implemented for `SomeNode` -note: required for `Id` to implement `PartialEq` - --> $DIR/derive-implicit-bound.rs:6:12 + = help: the trait `PartialEq` is not implemented for `Id` +help: the trait `PartialEq` is conditionally implemented for `Id` + --> $DIR/derive-implicit-bound.rs:5:10 | LL | #[derive(PartialEq, Eq)] - | --------- in this derive macro expansion + | ^^^^^^^^^ LL | pub struct Id(PhantomData); - | ^^ - type parameter would need to implement `PartialEq` - = help: consider manually implementing `PartialEq` to avoid undesired bounds caused by "imperfect derives" - = note: to learn more, visit + | - unsatisfied requirement introduced here: `_: PartialEq` note: required by a bound in `accept_eq` --> $DIR/derive-implicit-bound.rs:17:23 | LL | fn accept_eq(_: &impl PartialEq) { } | ^^^^^^^^^ required by this bound in `accept_eq` -help: consider annotating `SomeNode` with `#[derive(PartialEq)]` +help: consider annotating `Id` with `#[derive(PartialEq)]` | LL + #[derive(PartialEq)] -LL | struct SomeNode(); +LL | pub struct Id(PhantomData); | error: aborting due to 1 previous error diff --git a/tests/ui/traits/dyn-coerce-unsized-ice.stderr b/tests/ui/traits/dyn-coerce-unsized-ice.stderr index 1bd3874f0e120..06ce87d79fb64 100644 --- a/tests/ui/traits/dyn-coerce-unsized-ice.stderr +++ b/tests/ui/traits/dyn-coerce-unsized-ice.stderr @@ -8,16 +8,20 @@ LL | pub fn foo(x: dyn CoerceUnsized<*const dyn Trait>) -> *const dyn Trait { = note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit -error[E0277]: the size for values of type `(dyn CoerceUnsized<*const (dyn Trait + 'static)> + 'static)` cannot be known at compilation time +error[E0308]: mismatched types --> $DIR/dyn-coerce-unsized-ice.rs:12:5 | +LL | pub fn foo(x: dyn CoerceUnsized<*const dyn Trait>) -> *const dyn Trait { + | ---------------- expected `*const (dyn Trait + 'static)` because of return type +LL | LL | x - | ^ doesn't have a size known at compile-time + | ^ expected `*const dyn Trait`, found `dyn CoerceUnsized` | - = help: the trait `Sized` is not implemented for `(dyn CoerceUnsized<*const (dyn Trait + 'static)> + 'static)` - = note: required for the cast from `(dyn CoerceUnsized<*const (dyn Trait + 'static)> + 'static)` to `*const (dyn Trait + 'static)` + = note: expected raw pointer `*const (dyn Trait + 'static)` + found trait object `(dyn CoerceUnsized<*const (dyn Trait + 'static)> + 'static)` + = help: `*const (dyn Trait + 'static)` implements `CoerceUnsized` so you could change the expected type to `Box` error: aborting due to 2 previous errors -Some errors have detailed explanations: E0038, E0277. +Some errors have detailed explanations: E0038, E0308. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr b/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr index b4bc90f0dbe31..4df2346ee8aaf 100644 --- a/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr +++ b/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr @@ -25,11 +25,11 @@ LL | where LL | for<'a> F: Output<'a>, | ^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper` -error[E0277]: the trait bound `for<'a> _: From<<{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41} as Output<'a>>::Type>` is not satisfied - --> $DIR/explicit-reference-cast-unrelated-leaf.rs:18:13 +error[E0277]: the trait bound `for<'a> {closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}: Output<'a>` is not satisfied + --> $DIR/explicit-reference-cast-unrelated-leaf.rs:18:5 | LL | wrapper.do_something_wrapper(|value| ()); - | ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}` --> $DIR/explicit-reference-cast-unrelated-leaf.rs:18:34 @@ -41,14 +41,6 @@ help: this trait has no implementations, consider adding one | LL | trait Output<'a> { | ^^^^^^^^^^^^^^^^ -note: required by a bound in `Wrapper::do_something_wrapper` - --> $DIR/explicit-reference-cast-unrelated-leaf.rs:11:20 - | -LL | impl Wrapper { -LL | fn do_something_wrapper(self, _: F) -... -LL | for<'a> O: From<>::Type>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper` error: aborting due to 2 previous errors diff --git a/tests/ui/traits/fn-pointer/suggest-wrap-parens.fixed b/tests/ui/traits/fn-pointer/suggest-wrap-parens.fixed index 0bc8792b04e06..ffe0826c03506 100644 --- a/tests/ui/traits/fn-pointer/suggest-wrap-parens.fixed +++ b/tests/ui/traits/fn-pointer/suggest-wrap-parens.fixed @@ -5,6 +5,6 @@ trait Foo {} impl Foo for fn() {} fn main() { - let _x: &dyn Foo = &(main as fn()); + let _x: &dyn Foo = &main; //~^ ERROR the trait bound } diff --git a/tests/ui/traits/fn-pointer/suggest-wrap-parens.stderr b/tests/ui/traits/fn-pointer/suggest-wrap-parens.stderr index b71debac7156d..1d8a46727d8ff 100644 --- a/tests/ui/traits/fn-pointer/suggest-wrap-parens.stderr +++ b/tests/ui/traits/fn-pointer/suggest-wrap-parens.stderr @@ -1,14 +1,17 @@ -error[E0277]: the trait bound `fn() {main}: Foo` is not satisfied +error[E0277]: the trait bound `&fn() {main}: CoerceUnsized<&dyn Foo>` is not satisfied in `fn() {main}` --> $DIR/suggest-wrap-parens.rs:8:24 | LL | let _x: &dyn Foo = &main; - | ^^^^^ the trait `Foo` is not implemented for fn item `fn() {main}` + | ^^^^^ within `fn() {main}`, the trait `Foo` is not implemented for fn item `fn() {main}` | - = note: required for the cast from `&fn() {main}` to `&dyn Foo` -help: the trait `Foo` is implemented for fn pointer `fn()`, try casting using `as` +help: the trait `Foo` is implemented for fn pointer `fn()`, cast using `as` + --> $DIR/suggest-wrap-parens.rs:5:1 | -LL | let _x: &dyn Foo = &(main as fn()); - | + ++++++++ +LL | impl Foo for fn() {} + | ^^^^^^^^^^^^^^^^^ + = note: required because it appears within the type `fn() {main}` + = note: required for `&fn() {main}` to implement `CoerceUnsized<&dyn Foo>` + = note: required for the cast from `&fn() {main}` to `&dyn Foo` error: aborting due to 1 previous error diff --git a/tests/ui/traits/ice-with-dyn-pointee-errors.stderr b/tests/ui/traits/ice-with-dyn-pointee-errors.stderr index 6fe4020726a78..12ccb49027aa3 100644 --- a/tests/ui/traits/ice-with-dyn-pointee-errors.stderr +++ b/tests/ui/traits/ice-with-dyn-pointee-errors.stderr @@ -10,11 +10,27 @@ note: for a trait to be dyn compatible it needs to allow building a vtable | = note: the trait is not dyn compatible because it opted out of dyn-compatibility +error[E0271]: type mismatch resolving ` as Pointee>::Metadata == ()` + --> $DIR/ice-with-dyn-pointee-errors.rs:10:33 + | +LL | unknown_sized_object_ptr_in(x) + | --------------------------- ^ expected `()`, found `DynMetadata>` + | | + | required by a bound introduced by this call + | + = note: expected unit type `()` + found struct `DynMetadata>` +note: required by a bound in `unknown_sized_object_ptr_in` + --> $DIR/ice-with-dyn-pointee-errors.rs:6:50 + | +LL | fn unknown_sized_object_ptr_in(_: &(impl Pointee + ?Sized)) {} + | ^^^^^^^^^^^^^ required by this bound in `unknown_sized_object_ptr_in` + error[E0038]: the trait `Pointee` is not dyn compatible --> $DIR/ice-with-dyn-pointee-errors.rs:10:5 | LL | unknown_sized_object_ptr_in(x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Pointee` is not dyn compatible + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Pointee` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit @@ -23,10 +39,10 @@ note: for a trait to be dyn compatible it needs to allow building a vtable = note: the trait is not dyn compatible because it opted out of dyn-compatibility error[E0038]: the trait `Pointee` is not dyn compatible - --> $DIR/ice-with-dyn-pointee-errors.rs:10:5 + --> $DIR/ice-with-dyn-pointee-errors.rs:10:33 | LL | unknown_sized_object_ptr_in(x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Pointee` is not dyn compatible + | ^ `Pointee` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit @@ -46,6 +62,23 @@ note: for a trait to be dyn compatible it needs to allow building a vtable | = note: the trait is not dyn compatible because it opted out of dyn-compatibility -error: aborting due to 4 previous errors +error[E0308]: mismatched types + --> $DIR/ice-with-dyn-pointee-errors.rs:16:20 + | +LL | raw_pointer_in(&42) + | -------------- ^^^ expected `&dyn Pointee`, found `&{integer}` + | | + | arguments to this function are incorrect + | + = note: expected reference `&dyn Pointee` + found reference `&{integer}` +note: function defined here + --> $DIR/ice-with-dyn-pointee-errors.rs:8:4 + | +LL | fn raw_pointer_in(x: &dyn Pointee) { + | ^^^^^^^^^^^^^^ ------------------------------ + +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0271, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr index 4e324209fe9e7..278931fa7ff7d 100644 --- a/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr +++ b/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr @@ -1,27 +1,37 @@ -error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements +error[E0478]: lifetime bound not satisfied --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:28 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'b` as defined here... +note: lifetime parameter instantiated with the lifetime `'b` as defined here --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:9 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ -note: ...but the lifetime must also be valid for the lifetime `'a` as defined here... +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ -note: ...so that the types are compatible + +error[E0478]: lifetime bound not satisfied --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:28 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^^^^^^^^ - = note: expected `T1<'a>` - found `T1<'_>` + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6 + | +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { + | ^^ +note: but lifetime parameter must outlive the lifetime `'b` as defined here + --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:9 + | +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { + | ^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0803`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/traits/inductive-overflow/lifetime.stderr b/tests/ui/traits/inductive-overflow/lifetime.stderr index 406f4d25dce3f..ef6bfb3634c11 100644 --- a/tests/ui/traits/inductive-overflow/lifetime.stderr +++ b/tests/ui/traits/inductive-overflow/lifetime.stderr @@ -1,14 +1,9 @@ -error[E0275]: overflow evaluating the requirement `Box>>: NotAuto` - --> $DIR/lifetime.rs:29:5 +error[E0275]: overflow evaluating the requirement `X>: NotAuto` + --> $DIR/lifetime.rs:29:15 | LL | is_send::>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ | -note: required for `X>` to implement `NotAuto` - --> $DIR/lifetime.rs:19:12 - | -LL | impl NotAuto for X where T::P: NotAuto {} - | ^^^^^^^ ^^^^ ------- unsatisfied trait bound introduced here note: required by a bound in `is_send` --> $DIR/lifetime.rs:23:15 | diff --git a/tests/ui/traits/inductive-overflow/simultaneous.stderr b/tests/ui/traits/inductive-overflow/simultaneous.stderr index 29456d88b1bfc..7933a01a73413 100644 --- a/tests/ui/traits/inductive-overflow/simultaneous.stderr +++ b/tests/ui/traits/inductive-overflow/simultaneous.stderr @@ -1,16 +1,11 @@ -error[E0275]: overflow evaluating the requirement `{integer}: Tweedledum` - --> $DIR/simultaneous.rs:18:5 +error[E0275]: overflow evaluating the requirement `i32: Combo` + --> $DIR/simultaneous.rs:18:11 | LL | is_ee(4); - | ^^^^^^^^ + | ----- ^ + | | + | required by a bound introduced by this call | -note: required for `{integer}` to implement `Combo` - --> $DIR/simultaneous.rs:11:34 - | -LL | impl Combo for T {} - | ---------- ^^^^^ ^ - | | - | unsatisfied trait bound introduced here note: required by a bound in `is_ee` --> $DIR/simultaneous.rs:13:13 | diff --git a/tests/ui/traits/inductive-overflow/supertrait.stderr b/tests/ui/traits/inductive-overflow/supertrait.stderr index 99e9c8f93b8a4..172bd6b99fa8b 100644 --- a/tests/ui/traits/inductive-overflow/supertrait.stderr +++ b/tests/ui/traits/inductive-overflow/supertrait.stderr @@ -1,16 +1,11 @@ error[E0275]: overflow evaluating the requirement `NoClone: Magic` - --> $DIR/supertrait.rs:13:18 + --> $DIR/supertrait.rs:13:23 | LL | let (a, b) = copy(NoClone); - | ^^^^^^^^^^^^^ + | ---- ^^^^^^^ + | | + | required by a bound introduced by this call | -note: required for `NoClone` to implement `Magic` - --> $DIR/supertrait.rs:5:16 - | -LL | impl Magic for T {} - | ----- ^^^^^ ^ - | | - | unsatisfied trait bound introduced here note: required by a bound in `copy` --> $DIR/supertrait.rs:7:12 | diff --git a/tests/ui/traits/inductive-overflow/two-traits.stderr b/tests/ui/traits/inductive-overflow/two-traits.stderr index 7c80726582336..a9b3bbfa36981 100644 --- a/tests/ui/traits/inductive-overflow/two-traits.stderr +++ b/tests/ui/traits/inductive-overflow/two-traits.stderr @@ -16,10 +16,10 @@ LL | impl Magic for T { | +++++++++++++++++++ error[E0275]: overflow evaluating the requirement `*mut (): Magic` - --> $DIR/two-traits.rs:20:5 + --> $DIR/two-traits.rs:20:14 | LL | wizard::<*mut ()>(); - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^ | note: required by a bound in `wizard` --> $DIR/two-traits.rs:17:14 diff --git a/tests/ui/traits/issue-18400.stderr b/tests/ui/traits/issue-18400.stderr index af5519a15c23d..738408acbe317 100644 --- a/tests/ui/traits/issue-18400.stderr +++ b/tests/ui/traits/issue-18400.stderr @@ -1,20 +1,20 @@ -error[E0275]: overflow evaluating the requirement `_: Sized` - --> $DIR/issue-18400.rs:24:7 +error[E0277]: the trait bound `{integer}: Set<{integer}>` is not satisfied + --> $DIR/issue-18400.rs:24:16 | LL | 0.contains(bits); - | ^^^^^^^^ + | -------- ^^^^ the trait `Set<{integer}>` is not implemented for `{integer}` + | | + | required by a bound introduced by this call | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_18400`) -note: required for `{integer}` to implement `Set<&[_]>` +note: required for `{integer}` to implement `Set<&[{integer}]>` --> $DIR/issue-18400.rs:6:16 | LL | impl<'a, T, S> Set<&'a [T]> for S where - | - ^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here - = note: 128 redundant requirements hidden - = note: required for `{integer}` to implement `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` + | ^^^^^^^^^^^^ ^ +LL | T: Copy, +LL | S: Set, + | ------ unsatisfied trait bound introduced here error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/issue-28576.stderr b/tests/ui/traits/issue-28576.stderr index 50d7f8c56b25b..f23a10b388da1 100644 --- a/tests/ui/traits/issue-28576.stderr +++ b/tests/ui/traits/issue-28576.stderr @@ -18,6 +18,26 @@ help: consider relaxing the implicit `Sized` restriction LL | pub trait Foo { | ++++++++ +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-28576.rs:5:20 + | +LL | pub trait Bar: Foo { + | ^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Foo` + --> $DIR/issue-28576.rs:1:15 + | +LL | pub trait Foo { + | ^^^^^^^^ required by the implicit `Sized` requirement on this type parameter in `Foo` +help: consider further restricting `Self` + | +LL | pub trait Bar: Foo + Sized { + | +++++++ +help: consider relaxing the implicit `Sized` restriction + | +LL | pub trait Foo { + | ++++++++ + error[E0038]: the trait `Bar` is not dyn compatible --> $DIR/issue-28576.rs:9:16 | @@ -62,7 +82,27 @@ help: consider relaxing the implicit `Sized` restriction LL | pub trait Foo { | ++++++++ -error: aborting due to 3 previous errors +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-28576.rs:5:20 + | +LL | pub trait Bar: Foo { + | ^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `Foo` + --> $DIR/issue-28576.rs:1:15 + | +LL | pub trait Foo { + | ^^^^^^^^ required by the implicit `Sized` requirement on this type parameter in `Foo` +help: consider further restricting `Self` + | +LL | ) where Self: Sized; + | +++++++++++++++++ +help: consider relaxing the implicit `Sized` restriction + | +LL | pub trait Foo { + | ++++++++ + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0038, E0277. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/issue-50480.stderr b/tests/ui/traits/issue-50480.stderr index a8b6ff4d0d924..17649fdbee0e5 100644 --- a/tests/ui/traits/issue-50480.stderr +++ b/tests/ui/traits/issue-50480.stderr @@ -102,6 +102,14 @@ LL | struct Foo(N, NotDefined, ::Item, Vec, String); | = help: the trait `Iterator` is not implemented for `i32` +error: the type `std::clone::AssertParamIsClone<::Item>` is not well-formed + --> $DIR/issue-50480.rs:2:27 + | +LL | #[derive(Clone, Copy)] + | ----- in this derive macro expansion +LL | struct Foo(N, NotDefined, ::Item, Vec, String); + | ^^^^^^^^^^^^^^^^^^^^^^^ + error[E0277]: `i32` is not an iterator --> $DIR/issue-50480.rs:11:10 | @@ -120,7 +128,7 @@ LL | struct Bar(T, N, NotDefined, ::Item, Vec, String); | = help: the trait `Iterator` is not implemented for `i32` -error: aborting due to 13 previous errors +error: aborting due to 14 previous errors Some errors have detailed explanations: E0204, E0277, E0425. For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr b/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr index f61d09a3fb737..a53fc77b4f8f0 100644 --- a/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr +++ b/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr @@ -7,7 +7,7 @@ LL | Vec: Unpin, LL | forward(); | ^^^^^^^ -error: evaluate(Binder { value: TraitClause( as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitClause( as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/issue-83538-tainted-cache-after-cycle.rs:59:5 | LL | Third<'a, Ty>: Unpin, @@ -16,7 +16,7 @@ LL | Third<'a, Ty>: Unpin, LL | forward(); | ^^^^^^^ -error: evaluate(Binder { value: TraitClause( as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitClause( as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/issue-83538-tainted-cache-after-cycle.rs:63:5 | LL | Third<'a, Ty>: Unpin, diff --git a/tests/ui/traits/issue-85360-eval-obligation-ice.stderr b/tests/ui/traits/issue-85360-eval-obligation-ice.stderr index d7861984411de..6082edf91e6b0 100644 --- a/tests/ui/traits/issue-85360-eval-obligation-ice.stderr +++ b/tests/ui/traits/issue-85360-eval-obligation-ice.stderr @@ -7,7 +7,7 @@ LL | test::>>(make()); LL | fn test(_: T) {} | ----- predicate -error: evaluate(Binder { value: TraitClause(> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitClause(> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/issue-85360-eval-obligation-ice.rs:12:5 | LL | test::>>(make()); diff --git a/tests/ui/traits/issue-85735.stderr b/tests/ui/traits/issue-85735.stderr index 0980c5c33bdb4..8ce3e2fcb23c8 100644 --- a/tests/ui/traits/issue-85735.stderr +++ b/tests/ui/traits/issue-85735.stderr @@ -1,10 +1,10 @@ -error[E0283]: type annotations needed: cannot satisfy `T: FnMut(&'a ())` - --> $DIR/issue-85735.rs:7:8 +error[E0283]: type annotations needed: cannot satisfy `T: FnMut(&())` + --> $DIR/issue-85735.rs:5:25 | -LL | T: FnMut(&'a ()), - | ^^^^^^^^^^^^^ +LL | impl<'a, 'b, T> Foo for T + | ^ | -note: multiple `impl`s or `where` clauses satisfying `T: FnMut(&'a ())` found +note: multiple `impl`s or `where` clauses satisfying `T: FnMut(&())` found --> $DIR/issue-85735.rs:7:8 | LL | T: FnMut(&'a ()), @@ -12,6 +12,14 @@ LL | T: FnMut(&'a ()), LL | LL | T: FnMut(&'b ()), | ^^^^^^^^^^^^^ +note: required for `T` to implement `Foo` + --> $DIR/issue-85735.rs:5:17 + | +LL | impl<'a, 'b, T> Foo for T + | ^^^ ^ +LL | where +LL | T: FnMut(&'a ()), + | ------------- unsatisfied trait bound introduced here error: aborting due to 1 previous error diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr index de16865629f89..47a971fa76b65 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -13,21 +13,34 @@ LL | recurse(IteratorOfWrapped(elements).map(|t| t.0)) = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error[E0275]: overflow evaluating the requirement ` as Iterator>::Item == ()` +warning: overflow evaluating the requirement `IteratorOfWrapped<(), Map, {closure@...}>>, {closure@...}>>, {closure@...}>>, {closure@...}>>, {closure@...}>>: Iterator` | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`issue_91949_hangs_on_recursion`) -note: required for `IteratorOfWrapped<(), std::iter::Empty<()>>` to implement `Iterator` - --> $DIR/issue-91949-hangs-on-recursion.rs:14:32 + = note: which requires `Map>, {closure@...}>>, {closure@...}>>, {closure@...}>>, {closure@...}>>, {closure@...}>: Iterator` + = note: which requires `, {closure@...}>>, {closure@...}>>, {closure@...}>>, {closure@...}>>, {closure@...}>> as Iterator>::Item == Wrapped<()>` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`issue_91949_hangs_on_recursion`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error: reached the recursion limit while instantiating `recurse::, {closure@...}>>` + --> $DIR/issue-91949-hangs-on-recursion.rs:26:5 + | +LL | recurse(IteratorOfWrapped(elements).map(|t| t.0)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `recurse` defined here + --> $DIR/issue-91949-hangs-on-recursion.rs:21:1 | -LL | impl> Iterator for IteratorOfWrapped { - | -------- ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unsatisfied trait bound introduced here - = note: 256 redundant requirements hidden - = note: required for `IteratorOfWrapped<(), Map, {closure@...}>>` to implement `Iterator` +LL | / fn recurse(elements: T) -> Vec +LL | | +LL | | where +LL | | T: Iterator, + | |___________________________^ = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-91949-hangs-on-recursion.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error; 2 warnings emitted -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/map-types.stderr b/tests/ui/traits/map-types.stderr index 555e7222978d0..731eb33645326 100644 --- a/tests/ui/traits/map-types.stderr +++ b/tests/ui/traits/map-types.stderr @@ -1,14 +1,17 @@ -error[E0277]: the trait bound `Box>: Map` is not satisfied +error[E0277]: the trait bound `Box>: Map` is not satisfied in `Box>` --> $DIR/map-types.rs:17:41 | LL | let y: Box> = Box::new(x); - | ^^^^^^^^^^^ the trait `Map` is not implemented for `Box>` + | ^^^^^^^^^^^ within `Box>`, the trait `Map` is not implemented for `Box>` | help: the trait `Map` is implemented for `HashMap` --> $DIR/map-types.rs:10:1 | LL | impl Map for HashMap {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required because it appears within the type `Box>` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + = note: required for `Box>>` to implement `CoerceUnsized>>` = note: required for the cast from `Box>>` to `Box>` error: aborting due to 1 previous error diff --git a/tests/ui/traits/matching-lifetimes.stderr b/tests/ui/traits/matching-lifetimes.stderr index 8a802d57f5ccc..a42aaf3454e36 100644 --- a/tests/ui/traits/matching-lifetimes.stderr +++ b/tests/ui/traits/matching-lifetimes.stderr @@ -1,36 +1,32 @@ -error[E0308]: method not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/matching-lifetimes.rs:14:5 | LL | fn foo(x: Foo<'b,'a>) { - | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(Foo<'a, 'b>)` - found signature `fn(Foo<'b, 'a>)` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/matching-lifetimes.rs:13:6 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined here +note: but lifetime parameter must outlive the lifetime `'b` as defined here --> $DIR/matching-lifetimes.rs:13:9 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ -error[E0308]: method not compatible with trait +error[E0478]: lifetime bound not satisfied --> $DIR/matching-lifetimes.rs:14:5 | LL | fn foo(x: Foo<'b,'a>) { - | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | ^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(Foo<'a, 'b>)` - found signature `fn(Foo<'b, 'a>)` -note: the lifetime `'b` as defined here... +note: lifetime parameter instantiated with the lifetime `'b` as defined here --> $DIR/matching-lifetimes.rs:13:9 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/matching-lifetimes.rs:13:6 | LL | impl<'a,'b> Tr for Foo<'a,'b> { @@ -38,4 +34,4 @@ LL | impl<'a,'b> Tr for Foo<'a,'b> { error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/traits/method-on-unbounded-type-param.stderr b/tests/ui/traits/method-on-unbounded-type-param.stderr index 0b1f83a9de928..c26c935c138d4 100644 --- a/tests/ui/traits/method-on-unbounded-type-param.stderr +++ b/tests/ui/traits/method-on-unbounded-type-param.stderr @@ -14,15 +14,13 @@ LL | fn f(a: T, b: T) -> std::cmp::Ordering { LL | fn f(a: T, b: T) -> std::cmp::Ordering { | +++++ -error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied +error[E0599]: `&T` is not an iterator --> $DIR/method-on-unbounded-type-param.rs:5:10 | LL | (&a).cmp(&b) - | ^^^ method cannot be called on `&T` due to unsatisfied trait bounds + | ^^^ `&T` is not an iterator | = note: the following trait bounds were not satisfied: - `T: Ord` - which is required by `&T: Ord` `&T: Iterator` which is required by `&mut &T: Iterator` `T: Iterator` @@ -35,15 +33,13 @@ LL | fn g(a: T, b: T) -> std::cmp::Ordering { LL | fn g(a: T, b: T) -> std::cmp::Ordering { | +++++ -error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied +error[E0599]: `&T` is not an iterator --> $DIR/method-on-unbounded-type-param.rs:8:7 | LL | a.cmp(&b) - | ^^^ method cannot be called on `&T` due to unsatisfied trait bounds + | ^^^ `&T` is not an iterator | = note: the following trait bounds were not satisfied: - `T: Ord` - which is required by `&T: Ord` `&T: Iterator` which is required by `&mut &T: Iterator` `T: Iterator` @@ -60,7 +56,7 @@ error[E0599]: the method `cmp` exists for struct `Box`, but its trait bou --> $DIR/method-on-unbounded-type-param.rs:14:7 | LL | trait T {} - | ------- doesn't satisfy `dyn T: Iterator` or `dyn T: Ord` + | ------- doesn't satisfy `dyn T: Iterator` ... LL | x.cmp(&x); | ^^^ method cannot be called on `Box` due to unsatisfied trait bounds @@ -68,9 +64,7 @@ LL | x.cmp(&x); = note: the following trait bounds were not satisfied: `dyn T: Iterator` which is required by `Box: Iterator` - `dyn T: Ord` - which is required by `Box: Ord` - `Box: Iterator` + `dyn T: Iterator` which is required by `&mut Box: Iterator` `dyn T: Iterator` which is required by `&mut dyn T: Iterator` diff --git a/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.fixed b/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.fixed index c6c22a4db8b69..870c04281c456 100644 --- a/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.fixed +++ b/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.fixed @@ -1,6 +1,6 @@ //@ run-rustfix -pub fn foo(s: &[T], t: &[T]) { +pub fn foo(s: &[T], t: &[T]) where &[T]: PartialEq<&[T]> { let _ = s == t; //~ ERROR binary operation `==` cannot be applied to type `&[T]` } diff --git a/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.stderr b/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.stderr index 80b003bbcc56a..b008011c4a386 100644 --- a/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.stderr +++ b/tests/ui/traits/missing-trait-bounds/missing-trait-bound-for-op.stderr @@ -6,10 +6,10 @@ LL | let _ = s == t; | | | &[T] | -help: consider restricting type parameter `T` with trait `PartialEq` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | pub fn foo(s: &[T], t: &[T]) { - | +++++++++++++++++++++ +LL | pub fn foo(s: &[T], t: &[T]) where &[T]: PartialEq<&[T]> { + | +++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr b/tests/ui/traits/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr index 968e285af7ff8..ca4b5bf7cb303 100644 --- a/tests/ui/traits/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr +++ b/tests/ui/traits/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr @@ -7,20 +7,17 @@ LL | struct Foo { LL | self.foo(); | ^^^ method cannot be called on `&Foo` due to unsatisfied trait bounds | -note: the following trait bounds were not satisfied: - `T: Bar` - `T: Default` +note: trait bound `T: Default` was not satisfied --> $DIR/missing-trait-bounds-for-method-call.rs:10:9 | LL | impl Bar for Foo {} - | ^^^^^^^ ^^^ --- ------ - | | | - | | unsatisfied trait bound introduced here + | ^^^^^^^ --- ------ + | | | unsatisfied trait bound introduced here -help: consider restricting the type parameters to satisfy the trait bounds +help: consider restricting the type parameter to satisfy the trait bound | -LL | struct Foo where T: Bar, T: Default { - | ++++++++++++++++++++++++ +LL | struct Foo where T: Default { + | ++++++++++++++++ error[E0599]: the method `foo` exists for reference `&Fin`, but its trait bounds were not satisfied --> $DIR/missing-trait-bounds-for-method-call.rs:27:14 diff --git a/tests/ui/traits/mutual-recursion-issue-75860.stderr b/tests/ui/traits/mutual-recursion-issue-75860.stderr index 9e8eb1adb1111..b09bcf65a9c64 100644 --- a/tests/ui/traits/mutual-recursion-issue-75860.stderr +++ b/tests/ui/traits/mutual-recursion-issue-75860.stderr @@ -1,8 +1,10 @@ -error[E0275]: overflow assigning `_` to `Option<_>` - --> $DIR/mutual-recursion-issue-75860.rs:9:33 +error[E0275]: overflow assigning `Option>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `Option>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/mutual-recursion-issue-75860.rs:11:34 | -LL | let left = |o_a: Option<_>| o_a.unwrap(); - | ^^^^^^^^^^^^ +LL | let right = |o_b: Option<_>| o_b.unwrap(); + | ^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mutual_recursion_issue_75860`) error: aborting due to 1 previous error diff --git a/tests/ui/traits/negative-bounds/on-unimplemented.stderr b/tests/ui/traits/negative-bounds/on-unimplemented.stderr index 7feba0dbc819e..aaba53aacb9ed 100644 --- a/tests/ui/traits/negative-bounds/on-unimplemented.stderr +++ b/tests/ui/traits/negative-bounds/on-unimplemented.stderr @@ -3,9 +3,6 @@ error[E0277]: the trait bound `NotFoo: !Foo` is not satisfied | LL | fn hello() -> impl !Foo { | ^^^^^^^^^ unsatisfied trait bound -LL | -LL | NotFoo - | ------ return type was inferred to be `NotFoo` here | help: the trait bound `NotFoo: !Foo` is not satisfied --> $DIR/on-unimplemented.rs:8:1 diff --git a/tests/ui/traits/next-solver/overflow/fcw-on-auto-trait.old.stderr b/tests/ui/traits/next-solver/overflow/fcw-on-auto-trait.old.stderr new file mode 100644 index 0000000000000..64dfcbf180199 --- /dev/null +++ b/tests/ui/traits/next-solver/overflow/fcw-on-auto-trait.old.stderr @@ -0,0 +1,23 @@ +warning: overflow evaluating the requirement `Foo>>>>>: Sync` + --> $DIR/fcw-on-auto-trait.rs:23:5 + | +LL | require_sync::>>>>>>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: which requires `Option>>>>>: Sync` + = note: which requires `Foo>>>>: Sync` + = note: which requires `Option>>>>: Sync` + = note: which requires `Foo>>>: Sync` + = note: which requires `Option>>>: Sync` + = note: which requires `Foo>>: Sync` + = note: which requires `Option>>: Sync` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "16"]` attribute to your crate (`fcw_on_auto_trait`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/next-solver/overflow/fcw-on-normalization.old.stderr b/tests/ui/traits/next-solver/overflow/fcw-on-normalization.old.stderr new file mode 100644 index 0000000000000..13b47888560cc --- /dev/null +++ b/tests/ui/traits/next-solver/overflow/fcw-on-normalization.old.stderr @@ -0,0 +1,18 @@ +warning: overflow evaluating the requirement `>>>>>>>>> as HasAssoc>::Assoc == ()` + --> $DIR/fcw-on-normalization.rs:41:12 + | +LL | let b: >>>>>>>>> as HasAssoc>::Assoc = loop {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: which requires `>>>>>>>> as HasAssoc>::Assoc == ()` + = note: which requires `>>>>>>> as HasAssoc>::Assoc == ()` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "16"]` attribute to your crate (`fcw_on_normalization`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/next-solver/overflow/fcw-overflow-to-ambig-with-constraints.old.stderr b/tests/ui/traits/next-solver/overflow/fcw-overflow-to-ambig-with-constraints.old.stderr new file mode 100644 index 0000000000000..14151fbf4fcfc --- /dev/null +++ b/tests/ui/traits/next-solver/overflow/fcw-overflow-to-ambig-with-constraints.old.stderr @@ -0,0 +1,23 @@ +warning: overflow evaluating the requirement `u32: Constrain>>>, W, _>>, _>>` + --> $DIR/fcw-overflow-to-ambig-with-constraints.rs:30:5 + | +LL | fun_times(); + | ^^^^^^^^^^^ + | + = note: which requires `W>>>, W>>>, _>>, _>: Count` + = note: which requires `W>>>, W>>>, _>>, _>: Count` + = note: which requires `W>>>, W>>>, _>>, _>: Count` + = note: which requires `W>>>, W>>>, _>>, _>: Count` + = note: which requires `W>>>, W>>>, W<_, _>>>: Count` + = note: which requires `W>>>, W>>>, W<_, _>>>: Count` + = note: which requires `W>>>, W>>>, W<(), _>>>: Count` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "16"]` attribute to your crate (`fcw_overflow_to_ambig_with_constraints`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/next-solver/overflow/fcw-overflow-to-error.old.stderr b/tests/ui/traits/next-solver/overflow/fcw-overflow-to-error.old.stderr new file mode 100644 index 0000000000000..0632f7dc474b8 --- /dev/null +++ b/tests/ui/traits/next-solver/overflow/fcw-overflow-to-error.old.stderr @@ -0,0 +1,19 @@ +warning: overflow evaluating the requirement `W>>>>: Overflow` + --> $DIR/fcw-overflow-to-error.rs:35:23 + | +LL | W(W(W(W(W(()))))).foo(); + | ^^^ + | + = note: which requires `W>>>>: Trait` + = note: which requires `Indir>>>>: Trait` + = note: which requires `W>>>: Trait` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "16"]` attribute to your crate (`fcw_overflow_to_error`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr index 7e4b5cf68aedc..abcd93f376e13 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr +++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr @@ -13,22 +13,6 @@ LL | where LL | for V: Sized, | ^^^^^ required by this bound in `foo` -error[E0277]: `V` is not an iterator - --> $DIR/bad-sized-cond.rs:19:5 - | -LL | bar(); - | ^^^^^ `V` is not an iterator - | - = help: the trait `Iterator` is not implemented for `V` - = note: required for `V` to implement `IntoIterator` -note: required by a bound in `bar` - --> $DIR/bad-sized-cond.rs:11:15 - | -LL | pub fn bar() -LL | where -LL | for V: IntoIterator, - | ^^^^^^^^^^^^ required by this bound in `bar` - error[E0277]: the size for values of type `V` cannot be known at compilation time --> $DIR/bad-sized-cond.rs:19:5 | @@ -45,6 +29,6 @@ LL | where LL | for V: IntoIterator, | ^^^^^^^^^^^^ required by this bound in `bar` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.stderr b/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.stderr index 6ebba35fe9e2b..055ef1be31388 100644 --- a/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.stderr +++ b/tests/ui/traits/non_lifetime_binders/expected-region-found-kind.stderr @@ -1,15 +1,3 @@ -error[E0283]: type annotations needed: cannot satisfy `Self: E<'a>` - --> $DIR/expected-region-found-kind.rs:9:14 - | -LL | trait F<'a>: for E<'a> + for<'e> E<'e> {} - | ^^^^^^^^^^^^ - | -note: multiple `impl`s or `where` clauses satisfying `Self: E<'a>` found - --> $DIR/expected-region-found-kind.rs:9:14 - | -LL | trait F<'a>: for E<'a> + for<'e> E<'e> {} - | ^^^^^^^^^^^^ ^^^^^^^^^^^^^ - error[E0221]: ambiguous associated type `As` in bounds of `F` --> $DIR/expected-region-found-kind.rs:14:14 | @@ -22,24 +10,6 @@ LL | type As; LL | T: F<'a, As: E<'a>>, | ^^^^^^^^^ ambiguous associated type `As` -error[E0283]: type annotations needed: cannot satisfy `T: E<'a>` - --> $DIR/expected-region-found-kind.rs:14:8 - | -LL | T: F<'a, As: E<'a>>, - | ^^^^^^^^^^^^^^^^ - | -note: multiple `impl`s or `where` clauses satisfying `T: E<'a>` found - --> $DIR/expected-region-found-kind.rs:14:8 - | -LL | T: F<'a, As: E<'a>>, - | ^^^^^^^^^^^^^^^^ -note: required by a bound in `F` - --> $DIR/expected-region-found-kind.rs:9:14 - | -LL | trait F<'a>: for E<'a> + for<'e> E<'e> {} - | ^^^^^^^^^^^^ required by this bound in `F` - -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0221, E0283. -For more information about an error, try `rustc --explain E0221`. +For more information about this error, try `rustc --explain E0221`. diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-assoc-type.stderr b/tests/ui/traits/non_lifetime_binders/late-bound-assoc-type.stderr index ecd8319099f28..42efb5927669a 100644 --- a/tests/ui/traits/non_lifetime_binders/late-bound-assoc-type.stderr +++ b/tests/ui/traits/non_lifetime_binders/late-bound-assoc-type.stderr @@ -58,9 +58,6 @@ error[E0277]: the trait bound `{integer}: Trait<()>` is not satisfied | LL | fn produce() -> impl for Trait<(), Assoc = impl Trait> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<()>` is not implemented for `{integer}` -... -LL | 16 - | -- return type was inferred to be `{integer}` here | help: this trait has no implementations, consider adding one --> $DIR/late-bound-assoc-type.rs:7:1 diff --git a/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr index 38dcdbd0af2ad..4c7f591f1e3e4 100644 --- a/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr @@ -23,9 +23,6 @@ error[E0277]: the trait bound `{integer}: Trait<()>` is not satisfied | LL | fn produce() -> impl for Trait<(), Assoc = impl Trait> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<()>` is not implemented for `{integer}` -... -LL | 16 - | -- return type was inferred to be `{integer}` here | help: this trait has no implementations, consider adding one --> $DIR/non-lifetime-binder-in-constraint.rs:4:1 diff --git a/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.stderr b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.stderr index 3c352c9889cfa..d5e3e13cc2dde 100644 --- a/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.stderr @@ -15,11 +15,11 @@ LL | fn f() -> impl for Trait> {} | | | parameter defined here -error[E0277]: the trait bound `(): Trait>` is not satisfied +error[E0277]: the trait bound `(): Trait<_>` is not satisfied --> $DIR/non-lifetime-binder.rs:6:11 | LL | fn f() -> impl for Trait> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait>` is not implemented for `()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<_>` is not implemented for `()` | help: this trait has no implementations, consider adding one --> $DIR/non-lifetime-binder.rs:4:1 diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index e70ff4a89107d..13754b53c19c2 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -2,29 +2,43 @@ error[E0309]: the placeholder type `F` may not live long enough --> $DIR/type-match-with-late-bound.rs:8:32 | LL | async fn walk2<'a, T: 'a>(_: T) - | -- ^ ...so that the type `F` will meet its required lifetime bounds... + | -- ^ ...so that the type `F` will meet its required lifetime bounds | | | the placeholder type `F` must be valid for the lifetime `'a` as defined here... | -note: ...that is required by this bound - --> $DIR/type-match-with-late-bound.rs:10:15 +help: consider adding an explicit lifetime bound + | +LL | for F: 'a, F: 'a + | +++++ + +error[E0309]: the placeholder type `F` may not live long enough + --> $DIR/type-match-with-late-bound.rs:8:1 + | +LL | async fn walk2<'a, T: 'a>(_: T) + | ^ -- the placeholder type `F` must be valid for the lifetime `'a` as defined here... + | _| + | | +LL | | where +LL | | for F: 'a, + | |_________________^ ...so that the type `F` will meet its required lifetime bounds | -LL | for F: 'a, - | ^^ help: consider adding an explicit lifetime bound | LL | for F: 'a, F: 'a | +++++ error[E0309]: the placeholder type `F` may not live long enough - --> $DIR/type-match-with-late-bound.rs:11:1 + --> $DIR/type-match-with-late-bound.rs:8:1 | -LL | async fn walk2<'a, T: 'a>(_: T) - | -- the placeholder type `F` must be valid for the lifetime `'a` as defined here... -... -LL | {} - | ^^ ...so that the type `F` will meet its required lifetime bounds +LL | async fn walk2<'a, T: 'a>(_: T) + | ^ -- the placeholder type `F` must be valid for the lifetime `'a` as defined here... + | _| + | | +LL | | where +LL | | for F: 'a, + | |_________________^ ...so that the type `F` will meet its required lifetime bounds | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit lifetime bound | LL | for F: 'a, F: 'a @@ -39,12 +53,11 @@ LL | async fn walk2<'a, T: 'a>(_: T) LL | {} | ^^ ...so that the type `F` will meet its required lifetime bounds | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit lifetime bound | LL | for F: 'a, F: 'a | +++++ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/traits/normalize/copy-impl-cannot-normalize.stderr b/tests/ui/traits/normalize/copy-impl-cannot-normalize.stderr index 45c26ac9ef46a..d04061744052e 100644 --- a/tests/ui/traits/normalize/copy-impl-cannot-normalize.stderr +++ b/tests/ui/traits/normalize/copy-impl-cannot-normalize.stderr @@ -1,24 +1,57 @@ +error[E0277]: the trait bound `Foo: Clone` is not satisfied + --> $DIR/copy-impl-cannot-normalize.rs:22:18 + | +LL | impl Copy for Foo {} + | ^^^^^^ unsatisfied trait bound + | +help: the trait `Clone` is not implemented for `Foo` + --> $DIR/copy-impl-cannot-normalize.rs:5:1 + | +LL | struct Foo + | ^^^^^^^^^^^^^ +note: required by a bound in `Copy` + --> $SRC_DIR/core/src/marker.rs:LL:COL +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl Copy for Foo where Foo: Clone {} + | +++++++++++++++++++ + error[E0277]: the trait bound `T: TraitFoo` is not satisfied --> $DIR/copy-impl-cannot-normalize.rs:22:18 | LL | impl Copy for Foo {} | ^^^^^^ the trait `TraitFoo` is not implemented for `T` | -note: required for `Foo` to implement `Clone` - --> $DIR/copy-impl-cannot-normalize.rs:12:9 +note: required by a bound in `Foo` + --> $DIR/copy-impl-cannot-normalize.rs:7:8 | -LL | impl Clone for Foo - | ^^^^^ ^^^^^^ +LL | struct Foo LL | where LL | T: TraitFoo, - | -------- unsatisfied trait bound introduced here -note: required by a bound in `Copy` - --> $SRC_DIR/core/src/marker.rs:LL:COL + | ^^^^^^^^ required by this bound in `Foo` help: consider restricting type parameter `T` with trait `TraitFoo` | LL | impl Copy for Foo {} | ++++++++++ -error: aborting due to 1 previous error +error[E0277]: the size for values of type `Foo` cannot be known + --> $DIR/copy-impl-cannot-normalize.rs:22:18 + | +LL | impl Copy for Foo {} + | ^^^^^^ doesn't have a known size + | +help: the nightly-only, unstable trait `MetaSized` is not implemented for `Foo` + --> $DIR/copy-impl-cannot-normalize.rs:5:1 + | +LL | struct Foo + | ^^^^^^^^^^^^^ +note: required by a bound in `Copy` + --> $SRC_DIR/core/src/marker.rs:LL:COL +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl Copy for Foo where Foo: MetaSized {} + | +++++++++++++++++++++++ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/normalize/self-referential-param-env-normalization.stderr b/tests/ui/traits/normalize/self-referential-param-env-normalization.stderr index 5e9c2c92eaac6..522715e539a3a 100644 --- a/tests/ui/traits/normalize/self-referential-param-env-normalization.stderr +++ b/tests/ui/traits/normalize/self-referential-param-env-normalization.stderr @@ -1,42 +1,40 @@ -error[E0275]: overflow evaluating the requirement `Self: StreamingIterator<'_>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`self_referential_param_env_normalization`) -note: required for `Self` to implement `StreamingIterator<'_>` - --> $DIR/self-referential-param-env-normalization.rs:8:16 - | -LL | impl<'b, I, T> StreamingIterator<'b> for I - | ^^^^^^^^^^^^^^^^^^^^^ ^ -... -LL | T: FnMut(Self::Item, I::Item), - | -------------------------- unsatisfied trait bound introduced here - = note: 127 redundant requirements hidden - = note: required for `Self` to implement `StreamingIterator<'a>` - error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates --> $DIR/self-referential-param-env-normalization.rs:8:13 | LL | impl<'b, I, T> StreamingIterator<'b> for I | ^ unconstrained type parameter -error[E0275]: overflow evaluating the requirement `I: IntoIterator` - --> $DIR/self-referential-param-env-normalization.rs:14:17 +error[E0275]: overflow evaluating the requirement `>::Item == _` + --> $DIR/self-referential-param-env-normalization.rs:8:1 | -LL | type Item = T; - | ^ +LL | / impl<'b, I, T> StreamingIterator<'b> for I +LL | | +LL | | where +LL | | I: IntoIterator, +LL | | T: FnMut(Self::Item, I::Item), + | |__________________________________^ + +error[E0275]: overflow evaluating the requirement `>::Item == _` + --> $DIR/self-referential-param-env-normalization.rs:14:5 | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`self_referential_param_env_normalization`) -note: required for `I` to implement `StreamingIterator<'_>` - --> $DIR/self-referential-param-env-normalization.rs:8:16 +LL | type Item = T; + | ^^^^^^^^^ + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/self-referential-param-env-normalization.rs:14:17 | LL | impl<'b, I, T> StreamingIterator<'b> for I - | ^^^^^^^^^^^^^^^^^^^^^ ^ + | -- the parameter type `T` must be valid for the lifetime `'b` as defined here... ... -LL | T: FnMut(Self::Item, I::Item), - | -------------------------- unsatisfied trait bound introduced here - = note: 127 redundant requirements hidden - = note: required for `I` to implement `StreamingIterator<'b>` +LL | type Item = T; + | ^ ...so that the type `T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | T: FnMut(Self::Item, I::Item) + 'b, + | ++++ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0207, E0275. +Some errors have detailed explanations: E0207, E0275, E0309. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr index 7a2db203ac3f8..04bc6cb70effe 100644 --- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr +++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr @@ -1,24 +1,9 @@ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7 | LL | a.method(); | ^^^^^^ | -note: multiple `impl`s satisfying `B: I<_>` found - --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:5:1 - | -LL | impl I for B {} - | ^^^^^^^^^^^^^^^^^ -LL | impl I for B {} - | ^^^^^^^^^^^^^^^^^ -note: required for `A` to implement `V<_>` - --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:12:12 - | -LL | impl V for A - | ^^^^ ^^^^ -LL | where -LL | T: I, - | ---- unsatisfied trait bound introduced here help: try using a fully qualified path to specify the expected types | LL - a.method(); @@ -27,4 +12,4 @@ LL + as V>::method(a); error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/object/dyn-proj-non-dyn-compat.stderr b/tests/ui/traits/object/dyn-proj-non-dyn-compat.stderr index e3c6d2ffb2eda..221962e681eb2 100644 --- a/tests/ui/traits/object/dyn-proj-non-dyn-compat.stderr +++ b/tests/ui/traits/object/dyn-proj-non-dyn-compat.stderr @@ -1,21 +1,9 @@ -error[E0038]: the trait `Trait` is not dyn compatible +error[E0271]: type mismatch resolving `make::{opaque#0} == MyImpl` --> $DIR/dyn-proj-non-dyn-compat.rs:15:14 | LL | fn make() -> impl Trait as Trait>::Output> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/dyn-proj-non-dyn-compat.rs:5:8 - | -LL | trait Trait { - | ----- this trait is not dyn compatible... -LL | type Output; -LL | fn process(&mut self, input: T) -> T; - | ^^^^^^^ ...because method `process` has generic type parameters - = help: consider moving `process` to another trait - = help: only type `MyImpl` implements `Trait`; consider using it directly instead. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/object/enforce-supertrait-projection.stderr b/tests/ui/traits/object/enforce-supertrait-projection.stderr index 8c8a46ff82af6..9ef7a62b6ac2b 100644 --- a/tests/ui/traits/object/enforce-supertrait-projection.stderr +++ b/tests/ui/traits/object/enforce-supertrait-projection.stderr @@ -12,6 +12,7 @@ LL | foo::>(x) found type parameter `A` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + = note: required because it appears within the type `dyn Trait` note: required by a bound in `foo` --> $DIR/enforce-supertrait-projection.rs:15:8 | diff --git a/tests/ui/traits/on_unimplemented_long_types.stderr b/tests/ui/traits/on_unimplemented_long_types.stderr index 0bd8591257b26..ee9d9764e76dc 100644 --- a/tests/ui/traits/on_unimplemented_long_types.stderr +++ b/tests/ui/traits/on_unimplemented_long_types.stderr @@ -1,17 +1,8 @@ error[E0277]: `Option>>` doesn't implement `std::fmt::Display` --> $DIR/on_unimplemented_long_types.rs:3:17 | -LL | pub fn foo() -> impl std::fmt::Display { - | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound -LL | -LL | / Some(Some(Some(Some(Some(Some(Some(Some(Some(S... -LL | | Some(Some(Some(Some(Some(Some(Some(Some(So... -LL | | Some(Some(Some(Some(Some(Some(Some(Som... -LL | | Some(Some(Some(Some(Some(Some(Some... -... | -LL | | ))))))))))), -LL | | ))))))))))) - | |_______________- return type was inferred to be `Option>>` here +LL | pub fn foo() -> impl std::fmt::Display { + | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | = help: the trait `std::fmt::Display` is not implemented for `Option>>` = note: the full name for the type has been written to '$TEST_BUILD_DIR/on_unimplemented_long_types.long-type-$LONG_TYPE_HASH.txt' diff --git a/tests/ui/traits/opaque-trait-size-error-5883.stderr b/tests/ui/traits/opaque-trait-size-error-5883.stderr index dac937cda187d..c185fbc9f55ed 100644 --- a/tests/ui/traits/opaque-trait-size-error-5883.stderr +++ b/tests/ui/traits/opaque-trait-size-error-5883.stderr @@ -31,6 +31,21 @@ help: function arguments must have a statically known size, borrowed types alway LL | r: &dyn A + 'static | + -error: aborting due to 2 previous errors +error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time + --> $DIR/opaque-trait-size-error-5883.rs:11:5 + | +LL | Struct { r: r } + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)` +note: required because it appears within the type `Struct` + --> $DIR/opaque-trait-size-error-5883.rs:5:5 + | +LL | struct Struct { +LL | r: dyn A + 'static + | ^^^^^^^^^^^^^^^^^^ required by this field + = note: structs must have a statically known size to be initialized + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/param-without-lifetime-constraint.stderr b/tests/ui/traits/param-without-lifetime-constraint.stderr index d5d83675a1e71..2c402993b8980 100644 --- a/tests/ui/traits/param-without-lifetime-constraint.stderr +++ b/tests/ui/traits/param-without-lifetime-constraint.stderr @@ -1,21 +1,30 @@ -error: `impl` item signature doesn't match `trait` item signature +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements --> $DIR/param-without-lifetime-constraint.rs:14:5 | -LL | pub trait HaveRelationship { -LL | fn get_relation(&self) -> To; - | ----------------------------- expected `fn(&'1 Article) -> &'2 ProofReader` -... -LL | impl HaveRelationship<&ProofReader> for Article { LL | fn get_relation(&self) -> &ProofReader { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Article) -> &'1 ProofReader` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(&'1 Article) -> &'2 ProofReader` - found signature `fn(&'1 Article) -> &'1 ProofReader` -help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - --> $DIR/param-without-lifetime-constraint.rs:10:31 +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/param-without-lifetime-constraint.rs:10:21 | LL | fn get_relation(&self) -> To; - | ^^ consider borrowing this type parameter in the trait + | ^^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/param-without-lifetime-constraint.rs:14:5 + | +LL | fn get_relation(&self) -> &ProofReader { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but, the lifetime must be valid for the anonymous lifetime as defined here... + --> $DIR/param-without-lifetime-constraint.rs:13:23 + | +LL | impl HaveRelationship<&ProofReader> for Article { + | ^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/param-without-lifetime-constraint.rs:14:5 + | +LL | fn get_relation(&self) -> &ProofReader { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/traits/project-modulo-regions.with_clause.stderr b/tests/ui/traits/project-modulo-regions.with_clause.stderr index 398116153bc3d..283da7f136f8c 100644 --- a/tests/ui/traits/project-modulo-regions.with_clause.stderr +++ b/tests/ui/traits/project-modulo-regions.with_clause.stderr @@ -1,4 +1,4 @@ -error: evaluate(Binder { value: TraitClause(, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitClause(, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/project-modulo-regions.rs:50:5 | LL | fn test(val: MyStruct) where Helper: HelperTrait { diff --git a/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr b/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr index d69f85742a9d9..c3b0a5006d6c4 100644 --- a/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr +++ b/tests/ui/traits/projection-no-progress-cycle-issue-159750.stderr @@ -14,9 +14,6 @@ error[E0277]: the trait bound `!: Queryable` is not satisfied | LL | fn follow() -> impl Queryable> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Queryable` is not implemented for `!` -LL | -LL | loop {} - | ------- return type was inferred to be `!` here | help: this trait has no implementations, consider adding one --> $DIR/projection-no-progress-cycle-issue-159750.rs:14:1 @@ -24,15 +21,19 @@ help: this trait has no implementations, consider adding one LL | trait Queryable { | ^^^^^^^^^^^^^^^ -error[E0284]: type annotations needed +error[E0277]: the trait bound `Option<_>: Container<> as Queryable>::Output>` is not satisfied --> $DIR/projection-no-progress-cycle-issue-159750.rs:28:14 | LL | follow().finish(); - | ^^^^^^ + | ^^^^^^ the trait `Container<> as Queryable>::Output>` is not implemented for `Option<_>` | - = note: cannot satisfy `> as Queryable>::Output == _` +help: the trait `Container<> as Queryable>::Output>` is not implemented for `Option<_>` + but trait `Container<_>` is implemented for it + --> $DIR/projection-no-progress-cycle-issue-159750.rs:10:1 + | +LL | impl Container for Option { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0277, E0284. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/resolve-impl-before-constrain-check.stderr b/tests/ui/traits/resolve-impl-before-constrain-check.stderr index 13fbfdb855cbf..fccc0372a44bd 100644 --- a/tests/ui/traits/resolve-impl-before-constrain-check.stderr +++ b/tests/ui/traits/resolve-impl-before-constrain-check.stderr @@ -8,7 +8,7 @@ error[E0282]: type annotations needed --> $DIR/resolve-impl-before-constrain-check.rs:17:6 | LL | <() as Callable>::call() - | ^^ cannot infer type for type parameter `V` + | ^^ cannot infer type error: aborting due to 2 previous errors diff --git a/tests/ui/traits/self-without-lifetime-constraint.stderr b/tests/ui/traits/self-without-lifetime-constraint.stderr index 34cf99b3f0512..66c309f7b8010 100644 --- a/tests/ui/traits/self-without-lifetime-constraint.stderr +++ b/tests/ui/traits/self-without-lifetime-constraint.stderr @@ -1,21 +1,29 @@ -error: `impl` item signature doesn't match `trait` item signature +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements --> $DIR/self-without-lifetime-constraint.rs:46:5 | -LL | pub trait FromSql: Sized { -LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult; - | -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), _>` -... -LL | impl FromSql for &str { LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` - found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` -help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - --> $DIR/self-without-lifetime-constraint.rs:42:60 +note: first, the lifetime cannot outlive the anonymous lifetime defined here... + --> $DIR/self-without-lifetime-constraint.rs:42:29 | LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult; - | ^^^^ consider borrowing this type parameter in the trait + | ^^^^^^^^^^^^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/self-without-lifetime-constraint.rs:46:5 + | +LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: but, the lifetime must be valid for the anonymous lifetime as defined here... + --> $DIR/self-without-lifetime-constraint.rs:45:18 + | +LL | impl FromSql for &str { + | ^ +note: ...so that the declared lifetime parameter bounds are satisfied + --> $DIR/self-without-lifetime-constraint.rs:46:5 + | +LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0515]: cannot return value referencing function parameter `x` --> $DIR/self-without-lifetime-constraint.rs:17:87 @@ -28,4 +36,5 @@ LL | std::str::from_utf8(t).map_err(|_| FromSqlError::InvalidTyp error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0515`. +Some errors have detailed explanations: E0515, E0803. +For more information about an error, try `rustc --explain E0515`. diff --git a/tests/ui/traits/subtype-recursion-limit.stderr b/tests/ui/traits/subtype-recursion-limit.stderr index e3587de8613d6..a7805bebf02c4 100644 --- a/tests/ui/traits/subtype-recursion-limit.stderr +++ b/tests/ui/traits/subtype-recursion-limit.stderr @@ -1,8 +1,10 @@ -error[E0275]: overflow assigning `_` to `*const _` +error[E0275]: overflow assigning `*const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const _` to `*const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const *const _` --> $DIR/subtype-recursion-limit.rs:12:17 | LL | let mut w = (x, y); | ^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`subtype_recursion_limit`) error: aborting due to 1 previous error diff --git a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr index 3bae5798d0471..86332d5ee4ec1 100644 --- a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr +++ b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr @@ -16,23 +16,6 @@ LL - for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { LL + for (src, dest) in std::iter::zip(fields.iter(), variant.iter()) { | -error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator - --> $DIR/invalid-suggest-deref-issue-127590.rs:6:24 - | -LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator - | - = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` -help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` - --> $SRC_DIR/core/src/slice/iter/macros.rs:LL:COL - --> $SRC_DIR/core/src/slice/iter.rs:LL:COL - ::: $SRC_DIR/core/src/slice/iter.rs:LL:COL - | - = note: in this macro invocation - = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` - = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` - = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator --> $DIR/invalid-suggest-deref-issue-127590.rs:14:54 | @@ -51,23 +34,6 @@ LL - for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone( LL + for (src, dest) in std::iter::zip(fields.iter(), variant.iter().clone()) { | -error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator - --> $DIR/invalid-suggest-deref-issue-127590.rs:14:24 - | -LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone()) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator - | - = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` -help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` - --> $SRC_DIR/core/src/slice/iter/macros.rs:LL:COL - --> $SRC_DIR/core/src/slice/iter.rs:LL:COL - ::: $SRC_DIR/core/src/slice/iter.rs:LL:COL - | - = note: in this macro invocation - = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` - = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` - = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator --> $DIR/invalid-suggest-deref-issue-127590.rs:6:24 | @@ -100,6 +66,6 @@ help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` = note: required for `&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr index dafd3469b6f03..24d3a7032a45b 100644 --- a/tests/ui/traits/suggest-dereferences/root-obligation.stderr +++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr @@ -1,11 +1,12 @@ -error[E0277]: the trait bound `&char: Pattern` is not satisfied +error[E0277]: expected an `Fn(char)` closure, found `char` --> $DIR/root-obligation.rs:6:38 | LL | .filter(|c| "aeiou".contains(c)) - | -------- ^ the trait `Fn(char)` is not implemented for `char` + | -------- ^ expected an `Fn(char)` closure, found `char` | | | required by a bound introduced by this call | + = help: the trait `Fn(char)` is not implemented for `char` = note: required for `&char` to implement `FnOnce(char)` = note: required for `&char` to implement `Pattern` note: required by a bound in `core::str::::contains` diff --git a/tests/ui/traits/suggest-remove-deref-issue-140166.stderr b/tests/ui/traits/suggest-remove-deref-issue-140166.stderr index d619e831f9357..7be550b6454f5 100644 --- a/tests/ui/traits/suggest-remove-deref-issue-140166.stderr +++ b/tests/ui/traits/suggest-remove-deref-issue-140166.stderr @@ -1,23 +1,24 @@ -error[E0277]: the trait bound `&Chars: Trait` is not satisfied +error[E0277]: `FlatMap<&Chars>` doesn't implement `Debug` --> $DIR/suggest-remove-deref-issue-140166.rs:14:26 | LL | format_args!("{:?}", FlatMap(&Chars)); - | ---- ^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `&Chars` + | ---- ^^^^^^^^^^^^^^^ `FlatMap<&Chars>` cannot be formatted using `{:?}` because it doesn't implement `Debug` | | | required by this formatting parameter | -help: the trait `Trait` is implemented for `Chars` - --> $DIR/suggest-remove-deref-issue-140166.rs:4:1 +help: the trait `Debug` is not implemented for `FlatMap<&Chars>` + --> $DIR/suggest-remove-deref-issue-140166.rs:6:1 | -LL | impl Trait for Chars {} - | ^^^^^^^^^^^^^^^^^^^^ -note: required for `FlatMap<&Chars>` to implement `Debug` - --> $DIR/suggest-remove-deref-issue-140166.rs:7:16 +LL | struct FlatMap(T); + | ^^^^^^^^^^^^^^^^^ + = note: add `#[derive(Debug)]` to `FlatMap<&Chars>` or manually `impl Debug for FlatMap<&Chars>` +help: the trait `Debug` is conditionally implemented for `FlatMap` + --> $DIR/suggest-remove-deref-issue-140166.rs:7:1 | LL | impl std::fmt::Debug for FlatMap { - | ----- ^^^^^^^^^^^^^^^ ^^^^^^^^^^ + | ^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | unsatisfied trait bound introduced here + | unsatisfied requirement introduced here: `_: Trait` error: aborting due to 1 previous error diff --git a/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.stderr b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.stderr index b5a7e36518364..56d244e7c54c5 100644 --- a/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.stderr +++ b/tests/ui/traits/trait-impl-overflow-with-where-clause-20413.stderr @@ -7,62 +7,29 @@ LL | struct NoData; = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead -error[E0275]: overflow evaluating the requirement `NoData>>>>>>: Foo` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:9:36 +error[E0282]: type annotations needed + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:12:26 | -LL | impl Foo for T where NoData: Foo { - | ^^^ +LL | let val: NoData = NoData; + | ^^^^^^ cannot infer type of the type parameter `T` declared on the struct `NoData` | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_impl_overflow_with_where_clause_20413`) -note: required for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:9:9 +help: consider specifying a concrete type for the type parameter `T` | -LL | impl Foo for T where NoData: Foo { - | ^^^ ^ --- unsatisfied trait bound introduced here - = note: 126 redundant requirements hidden - = note: required for `NoData` to implement `Foo` +LL | let val: NoData = NoData::; + | ++++++++++++++ -error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>: Bar` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:28:42 +error[E0308]: mismatched types + --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:38:26 | -LL | impl Bar for T where EvenLessData: Baz { - | ^^^ +LL | let val: NoData = AlmostNoData(None); + | --------- ^^^^^^^^^^^^^^^^^^ expected `NoData`, found `AlmostNoData<_>` + | | + | expected due to this | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_impl_overflow_with_where_clause_20413`) -note: required for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:35:9 - | -LL | impl Baz for T where AlmostNoData: Bar { - | ^^^ ^ --- unsatisfied trait bound introduced here -note: required for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:28:9 - | -LL | impl Bar for T where EvenLessData: Baz { - | ^^^ ^ --- unsatisfied trait bound introduced here - = note: 125 redundant requirements hidden - = note: required for `EvenLessData` to implement `Baz` - -error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>: Baz` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:35:42 - | -LL | impl Baz for T where AlmostNoData: Bar { - | ^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_impl_overflow_with_where_clause_20413`) -note: required for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:28:9 - | -LL | impl Bar for T where EvenLessData: Baz { - | ^^^ ^ --- unsatisfied trait bound introduced here -note: required for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` - --> $DIR/trait-impl-overflow-with-where-clause-20413.rs:35:9 - | -LL | impl Baz for T where AlmostNoData: Bar { - | ^^^ ^ --- unsatisfied trait bound introduced here - = note: 125 redundant requirements hidden - = note: required for `AlmostNoData` to implement `Bar` + = note: expected struct `NoData` + found struct `AlmostNoData<_>` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0275, E0392. -For more information about an error, try `rustc --explain E0275`. +Some errors have detailed explanations: E0282, E0308, E0392. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/trait-implementation-ambiguity-69602.stderr b/tests/ui/traits/trait-implementation-ambiguity-69602.stderr index c771740bec415..04d31965847d6 100644 --- a/tests/ui/traits/trait-implementation-ambiguity-69602.stderr +++ b/tests/ui/traits/trait-implementation-ambiguity-69602.stderr @@ -13,7 +13,18 @@ LL | type MyA: TraitA; LL | impl TraitB for B { | ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation -error: aborting due to 2 previous errors +error[E0282]: type annotations needed for `[{integer}; _]` + --> $DIR/trait-implementation-ambiguity-69602.rs:22:9 + | +LL | let _ = [0; B::VALUE]; + | ^ - type must be known at this point + | +help: consider giving this pattern a type, where the placeholders `_` are specified + | +LL | let _: [{integer}; _] = [0; B::VALUE]; + | ++++++++++++++++ + +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0046, E0437. +Some errors have detailed explanations: E0046, E0282, E0437. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/traits/trivial-unsized-projection-2.bad.stderr b/tests/ui/traits/trivial-unsized-projection-2.bad.stderr index 16f1ceaf7e67f..a58cebabf75d8 100644 --- a/tests/ui/traits/trivial-unsized-projection-2.bad.stderr +++ b/tests/ui/traits/trivial-unsized-projection-2.bad.stderr @@ -1,27 +1,8 @@ -error[E0277]: the size for values of type `[()]` cannot be known at compilation time +error[E0271]: type mismatch resolving `::Assert == _` --> $DIR/trivial-unsized-projection-2.rs:22:12 | LL | const FOO: ::Assert = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: within `Tail`, the trait `Sized` is not implemented for `[()]` -note: required because it appears within the type `Tail` - --> $DIR/trivial-unsized-projection-2.rs:17:13 - | -LL | struct Tail([()]); - | ^^^^ required by this field -note: required by a bound in `Bad::Assert` - --> $DIR/trivial-unsized-projection-2.rs:14:15 - | -LL | trait Bad { -LL | type Assert -LL | where -LL | Self: Sized; - | ^^^^^ required by this bound in `Bad::Assert` -help: consider relaxing the implicit `Sized` restriction - | -LL | type Assert: ?Sized - | ++++++++ + | ^^^^^^^^^^^^^^^^^^^^^ types differ error[E0277]: the size for values of type `[()]` cannot be known at compilation time --> $DIR/trivial-unsized-projection-2.rs:22:12 @@ -43,12 +24,18 @@ LL | type Assert LL | where LL | Self: Sized; | ^^^^^ required by this bound in `Bad::Assert` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider relaxing the implicit `Sized` restriction | LL | type Assert: ?Sized | ++++++++ -error: aborting due to 2 previous errors +error[E0271]: type mismatch resolving `::Assert == _` + --> $DIR/trivial-unsized-projection-2.rs:22:36 + | +LL | const FOO: ::Assert = todo!(); + | ^^^^^^^ types differ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/trivial-unsized-projection.bad.stderr b/tests/ui/traits/trivial-unsized-projection.bad.stderr index bab0a72587320..a055181542d4d 100644 --- a/tests/ui/traits/trivial-unsized-projection.bad.stderr +++ b/tests/ui/traits/trivial-unsized-projection.bad.stderr @@ -1,22 +1,8 @@ -error[E0277]: the size for values of type `[()]` cannot be known at compilation time +error[E0271]: type mismatch resolving `<[()] as Bad>::Assert == _` --> $DIR/trivial-unsized-projection.rs:20:12 | LL | const FOO: <[()] as Bad>::Assert = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[()]` -note: required by a bound in `Bad::Assert` - --> $DIR/trivial-unsized-projection.rs:14:15 - | -LL | trait Bad { -LL | type Assert -LL | where -LL | Self: Sized; - | ^^^^^ required by this bound in `Bad::Assert` -help: consider relaxing the implicit `Sized` restriction - | -LL | type Assert: ?Sized - | ++++++++ + | ^^^^^^^^^^^^^^^^^^^^^ types differ error[E0277]: the size for values of type `[()]` cannot be known at compilation time --> $DIR/trivial-unsized-projection.rs:20:12 @@ -33,12 +19,18 @@ LL | type Assert LL | where LL | Self: Sized; | ^^^^^ required by this bound in `Bad::Assert` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider relaxing the implicit `Sized` restriction | LL | type Assert: ?Sized | ++++++++ -error: aborting due to 2 previous errors +error[E0271]: type mismatch resolving `<[()] as Bad>::Assert == _` + --> $DIR/trivial-unsized-projection.rs:20:36 + | +LL | const FOO: <[()] as Bad>::Assert = todo!(); + | ^^^^^^^ types differ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/unhandled-crate-mod-issue-144888.stderr b/tests/ui/traits/unhandled-crate-mod-issue-144888.stderr index 4cc5b41588efa..9d71d0f18b30f 100644 --- a/tests/ui/traits/unhandled-crate-mod-issue-144888.stderr +++ b/tests/ui/traits/unhandled-crate-mod-issue-144888.stderr @@ -30,34 +30,6 @@ LL | impl> Mirror for T {} | | | unsatisfied trait bound introduced here -error[E0277]: the size for values of type `RustaceansAreAwesome` cannot be known at compilation time - --> $DIR/unhandled-crate-mod-issue-144888.rs:16:5 - | -LL | fn transmute(&self) {} - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `RustaceansAreAwesome` to implement `Mirror` - --> $DIR/unhandled-crate-mod-issue-144888.rs:29:28 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here - -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/unhandled-crate-mod-issue-144888.rs:16:5 - | -LL | fn transmute(&self) {} - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `Self` to implement `Mirror` - --> $DIR/unhandled-crate-mod-issue-144888.rs:29:28 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here - error[E0271]: type mismatch resolving `::Assoc == ()` --> $DIR/unhandled-crate-mod-issue-144888.rs:10:1 | @@ -74,24 +46,6 @@ LL | impl> Mirror for T {} | | | unsatisfied trait bound introduced here -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/unhandled-crate-mod-issue-144888.rs:10:1 - | -LL | trait Foo: Super - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `Self` to implement `Mirror` - --> $DIR/unhandled-crate-mod-issue-144888.rs:29:28 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here -help: consider further restricting `Self` - | -LL | trait Foo: Super + Sized - | +++++++ - error[E0046]: not all trait items implemented, missing: `Assoc` --> $DIR/unhandled-crate-mod-issue-144888.rs:29:1 | @@ -120,25 +74,7 @@ LL | impl> Mirror for T {} | | | unsatisfied trait bound introduced here -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/unhandled-crate-mod-issue-144888.rs:16:5 - | -LL | fn transmute(&self) {} - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -note: required for `Self` to implement `Mirror` - --> $DIR/unhandled-crate-mod-issue-144888.rs:29:28 - | -LL | impl> Mirror for T {} - | - ^^^^^^ ^ - | | - | unsatisfied trait bound implicitly introduced here -help: consider further restricting `Self` - | -LL | fn transmute(&self) where Self: Sized {} - | +++++++++++++++++ - -error: aborting due to 9 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0046, E0271, E0277. +Some errors have detailed explanations: E0046, E0271. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/traits/well-formed-recursion-limit.stderr b/tests/ui/traits/well-formed-recursion-limit.stderr index a4c85c4fcbdf3..d6527141d6024 100644 --- a/tests/ui/traits/well-formed-recursion-limit.stderr +++ b/tests/ui/traits/well-formed-recursion-limit.stderr @@ -14,11 +14,13 @@ LL | let (ab, ba) = (i.ab, i.ba); | = note: available fields are: `0`, `1` -error[E0275]: overflow assigning `_` to `Option<_>` +error[E0275]: overflow assigning `Option>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `Option>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/well-formed-recursion-limit.rs:15:33 | LL | let left = move |o_a| match o_a { | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`well_formed_recursion_limit`) error: aborting due to 3 previous errors diff --git a/tests/ui/transmutability/primitives/bool-mut.stderr b/tests/ui/transmutability/primitives/bool-mut.stderr index da84d8af6af43..67a1fe18cd800 100644 --- a/tests/ui/transmutability/primitives/bool-mut.stderr +++ b/tests/ui/transmutability/primitives/bool-mut.stderr @@ -1,9 +1,10 @@ -error[E0277]: `u8` cannot be safely transmuted into `bool` +error[E0277]: `&mut bool` cannot be safely transmuted into `&mut u8` --> $DIR/bool-mut.rs:14:50 | LL | assert::is_transmutable::<&'static mut bool, &'static mut u8>() - | ^^^^^^^^^^^^^^^ at least one value of `u8` isn't a bit-valid value of `bool` + | ^^^^^^^^^^^^^^^ unsatisfied trait bound | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static mut bool, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static mut u8` note: required by a bound in `is_transmutable` --> $DIR/bool-mut.rs:9:14 | diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr index 38a78a9cdc8f9..07a5b07ea5386 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr @@ -1,9 +1,10 @@ -error[E0277]: `B` cannot be safely transmuted into `A` +error[E0277]: `&B` cannot be safely transmuted into `&A` --> $DIR/recursive-wrapper-types-bit-incompatible.rs:23:49 | LL | assert::is_maybe_transmutable::<&'static B, &'static A>(); - | ^^^^^^^^^^ at least one value of `B` isn't a bit-valid value of `A` + | ^^^^^^^^^^ unsatisfied trait bound | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static B, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static A` note: required by a bound in `is_maybe_transmutable` --> $DIR/recursive-wrapper-types-bit-incompatible.rs:9:14 | diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.stderr b/tests/ui/transmutability/references/reject_lifetime_extension.stderr index 392aec03b3d2c..2f6af71be4052 100644 --- a/tests/ui/transmutability/references/reject_lifetime_extension.stderr +++ b/tests/ui/transmutability/references/reject_lifetime_extension.stderr @@ -1,78 +1,138 @@ -error: lifetime may not live long enough +error[E0277]: `&u8` cannot be safely transmuted into `&u8` --> $DIR/reject_lifetime_extension.rs:20:18 | -LL | fn extend_bare<'a>(src: &'a u8) -> &'static u8 { - | -- lifetime `'a` defined here LL | unsafe { transmute(src) } - | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<&u8, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&u8` +note: required by a bound in `transmute` + --> $DIR/reject_lifetime_extension.rs:11:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` -error: lifetime may not live long enough +error[E0277]: `&&u8` cannot be safely transmuted into `&&u8` --> $DIR/reject_lifetime_extension.rs:28:18 | -LL | fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 { - | -- lifetime `'a` defined here LL | unsafe { transmute(src) } - | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<&&u8, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&&u8` +note: required by a bound in `transmute` + --> $DIR/reject_lifetime_extension.rs:11:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` -error: lifetime may not live long enough +error[E0277]: `(&u8,)` cannot be safely transmuted into `(&u8,)` --> $DIR/reject_lifetime_extension.rs:36:18 | -LL | fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) { - | -- lifetime `'a` defined here LL | unsafe { transmute(src) } - | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<(&u8,), Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `(&u8,)` +note: required by a bound in `transmute` + --> $DIR/reject_lifetime_extension.rs:11:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` -error: lifetime may not live long enough +error[E0277]: `(&u8, u8)` cannot be safely transmuted into `(&u8, u8)` --> $DIR/reject_lifetime_extension.rs:40:18 | -LL | fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) { - | -- lifetime `'a` defined here LL | unsafe { transmute(src) } - | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<(&u8, u8), Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `(&u8, u8)` +note: required by a bound in `transmute` + --> $DIR/reject_lifetime_extension.rs:11:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` -error: lifetime may not live long enough +error[E0277]: `r#struct::Struct<'_>` cannot be safely transmuted into `r#struct::Struct<'_>` --> $DIR/reject_lifetime_extension.rs:50:18 | -LL | fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> { - | -- lifetime `'a` defined here LL | unsafe { transmute(src) } - | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `r#struct::Struct<'_>` + --> $DIR/reject_lifetime_extension.rs:47:5 + | +LL | struct Struct<'a>(&'a u8); + | ^^^^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/reject_lifetime_extension.rs:11:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` -error: lifetime may not live long enough +error[E0277]: `Single<'_>` cannot be safely transmuted into `Single<'_>` --> $DIR/reject_lifetime_extension.rs:62:18 | -LL | fn extend_single<'a>(src: Single<'a>) -> Single<'static> { - | -- lifetime `'a` defined here LL | unsafe { transmute(src) } - | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `Single<'_>` + --> $DIR/reject_lifetime_extension.rs:57:5 + | +LL | enum Single<'a> { + | ^^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/reject_lifetime_extension.rs:11:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` -error: lifetime may not live long enough +error[E0277]: `Multi<'_>` cannot be safely transmuted into `Multi<'_>` --> $DIR/reject_lifetime_extension.rs:72:18 | -LL | fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> { - | -- lifetime `'a` defined here LL | unsafe { transmute(src) } - | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `Multi<'_>` + --> $DIR/reject_lifetime_extension.rs:65:5 + | +LL | enum Multi<'a> { + | ^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/reject_lifetime_extension.rs:11:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` -error[E0521]: borrowed data escapes outside of function +error[E0277]: `&u8` cannot be safely transmuted into `&u8` --> $DIR/reject_lifetime_extension.rs:80:18 | -LL | fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 { - | -- --- `src` is only valid in the function body - | | - | lifetime `'a` defined here LL | unsafe { extend_hrtb(src) } - | ^^^^^^^^^^^^^^^^ - | | - | `src` escapes the function body here - | argument requires that `'a` must outlive `'static` + | ^^^^^^^^^^^^---^ + | | | + | | `&u8` doesn't satisfy the trait bound + | unsatisfied trait bound | -note: due to a current limitation of the type system, this implies a `'static` lifetime - --> $DIR/reject_lifetime_extension.rs:85:9 + = help: the nightly-only, unstable trait `for<'b> std::mem::TransmuteFrom<&u8, Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `&'b u8` +note: required by a bound in `extend_hrtb` + --> $DIR/reject_lifetime_extension.rs:85:25 | +LL | unsafe fn extend_hrtb<'a>(src: &'a u8) -> &'static u8 +LL | where LL | for<'b> &'b u8: TransmuteFrom<&'a u8>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extend_hrtb` error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0521`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/unsafecell.stderr b/tests/ui/transmutability/references/unsafecell.stderr index 45b540bd58940..01d777e81b775 100644 --- a/tests/ui/transmutability/references/unsafecell.stderr +++ b/tests/ui/transmutability/references/unsafecell.stderr @@ -2,8 +2,9 @@ error[E0277]: `&u8` cannot be safely transmuted into `&UnsafeCell` --> $DIR/unsafecell.rs:27:50 | LL | assert::is_maybe_transmutable::<&'static u8, &'static UnsafeCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Freeze` is not implemented for `UnsafeCell` + | ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static u8, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static UnsafeCell` note: required by a bound in `is_maybe_transmutable` --> $DIR/unsafecell.rs:12:14 | @@ -16,8 +17,69 @@ error[E0277]: `&UnsafeCell` cannot be safely transmuted into `&UnsafeCell $DIR/unsafecell.rs:29:62 | LL | assert::is_maybe_transmutable::<&'static UnsafeCell, &'static UnsafeCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Freeze` is not implemented for `UnsafeCell` + | ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static UnsafeCell, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static UnsafeCell` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/unsafecell.rs:12:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `&mut u8` cannot be safely transmuted into `&mut UnsafeCell` + --> $DIR/unsafecell.rs:35:54 + | +LL | assert::is_maybe_transmutable::<&'static mut u8, &'static mut UnsafeCell>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static mut u8, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static mut UnsafeCell` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/unsafecell.rs:12:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `&mut UnsafeCell` cannot be safely transmuted into `&mut u8` + --> $DIR/unsafecell.rs:36:66 + | +LL | assert::is_maybe_transmutable::<&'static mut UnsafeCell, &'static mut u8>(); + | ^^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static mut UnsafeCell, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static mut u8` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/unsafecell.rs:12:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `&mut UnsafeCell` cannot be safely transmuted into `&mut UnsafeCell` + --> $DIR/unsafecell.rs:37:66 + | +LL | assert::is_maybe_transmutable::<&'static mut UnsafeCell, &'static mut UnsafeCell>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static mut UnsafeCell, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static mut UnsafeCell` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/unsafecell.rs:12:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `&mut UnsafeCell` cannot be safely transmuted into `&u8` + --> $DIR/unsafecell.rs:42:68 + | +LL | assert::is_maybe_transmutable::<&'static mut UnsafeCell, &'static u8>(); + | ^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static mut UnsafeCell, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static u8` note: required by a bound in `is_maybe_transmutable` --> $DIR/unsafecell.rs:12:14 | @@ -30,8 +92,9 @@ error[E0277]: `&mut bool` cannot be safely transmuted into `&UnsafeCell` --> $DIR/unsafecell.rs:45:56 | LL | assert::is_maybe_transmutable::<&'static mut bool, &'static UnsafeCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Freeze` is not implemented for `UnsafeCell` + | ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static mut bool, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static UnsafeCell` note: required by a bound in `is_maybe_transmutable` --> $DIR/unsafecell.rs:12:14 | @@ -44,8 +107,9 @@ error[E0277]: `&mut UnsafeCell` cannot be safely transmuted into `&UnsafeC --> $DIR/unsafecell.rs:46:68 | LL | assert::is_maybe_transmutable::<&'static mut UnsafeCell, &'static UnsafeCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Freeze` is not implemented for `UnsafeCell` + | ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static mut UnsafeCell, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static UnsafeCell` note: required by a bound in `is_maybe_transmutable` --> $DIR/unsafecell.rs:12:14 | @@ -54,6 +118,6 @@ LL | where LL | Dst: TransmuteFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` -error: aborting due to 4 previous errors +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr index 7ee1b06b115b2..2ce40c2fffca6 100644 --- a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr +++ b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr @@ -1,9 +1,10 @@ -error[E0277]: `u8` cannot be safely transmuted into `Src` +error[E0277]: `&mut Src` cannot be safely transmuted into `&mut u8` --> $DIR/should_reject_if_ref_src_has_safety_invariant.rs:23:41 | LL | assert::is_transmutable::<&mut Src, &mut Dst>(); - | ^^^^^^^^ `Src` may carry safety invariants + | ^^^^^^^^ unsatisfied trait bound | + = help: the nightly-only, unstable trait `TransmuteFrom<&mut Src, Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `&mut u8` note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_ref_src_has_safety_invariant.rs:13:14 | diff --git a/tests/ui/transmutability/uninhabited.stderr b/tests/ui/transmutability/uninhabited.stderr index 3ddd3a32bca67..cccddf9353da5 100644 --- a/tests/ui/transmutability/uninhabited.stderr +++ b/tests/ui/transmutability/uninhabited.stderr @@ -78,6 +78,27 @@ LL | const _: () = { LL | assert!(false); | ^^^^^^^^^^^^^^ evaluation of `yawning_void_enum::_` failed here +error[E0277]: `DistantVoid` cannot be safely transmuted into `&distant_void::Void` + --> $DIR/uninhabited.rs:87:50 + | +LL | assert::is_maybe_transmutable::(); + | ^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom` is not implemented for `&'static distant_void::Void` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/uninhabited.rs:10:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` + error[E0277]: `u128` cannot be safely transmuted into `DistantVoid` --> $DIR/uninhabited.rs:88:43 | @@ -128,7 +149,7 @@ LL | | lifetimes: true, LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error: aborting due to 8 previous errors +error: aborting due to 9 previous errors Some errors have detailed explanations: E0080, E0277. For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/transmutability/unsafe-binder-opaque-type-layout.stderr b/tests/ui/transmutability/unsafe-binder-opaque-type-layout.stderr index d2bfbfbf3a095..b02da5104bb70 100644 --- a/tests/ui/transmutability/unsafe-binder-opaque-type-layout.stderr +++ b/tests/ui/transmutability/unsafe-binder-opaque-type-layout.stderr @@ -1,8 +1,17 @@ -error[E0277]: the trait bound `OpaqueType::{opaque#0}: Copy` is not satisfied +error[E0277]: the trait bound `OpaqueType::{opaque#0}: Copy` is not satisfied in `OpaqueType::{opaque#0}` --> $DIR/unsafe-binder-opaque-type-layout.rs:9:19 | LL | type OpaqueType = unsafe<> impl OpaqueTrait; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `OpaqueType::{opaque#0}` + | ^^^^^^^^^---------------- + | | | + | | within this `OpaqueType::{opaque#0}` + | within `OpaqueType::{opaque#0}`, the trait `Copy` is not implemented for `OpaqueType::{opaque#0}` + | +note: required because it appears within the type `OpaqueType::{opaque#0}` + --> $DIR/unsafe-binder-opaque-type-layout.rs:9:28 + | +LL | type OpaqueType = unsafe<> impl OpaqueTrait; + | ^^^^^^^^^^^^^^^^ error[E0119]: conflicting implementations of trait `AnotherTrait` for type `unsafe<> _` --> $DIR/unsafe-binder-opaque-type-layout.rs:14:1 diff --git a/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr b/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr index 403a8fee0aecc..f206e8a90e3ad 100644 --- a/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr +++ b/tests/ui/try-block/try-block-bad-type-heterogeneous.stderr @@ -32,6 +32,20 @@ LL | let res = try bikeshed () { }; | = help: the nightly-only, unstable trait `Try` is not implemented for `()` +error[E0277]: the trait bound `(): FromResidual<_>` is not satisfied + --> $DIR/try-block-bad-type-heterogeneous.rs:17:33 + | +LL | let res = try bikeshed () { }; + | ^ the nightly-only, unstable trait `FromResidual<_>` is not implemented for `()` + +error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`) + --> $DIR/try-block-bad-type-heterogeneous.rs:17:33 + | +LL | let res = try bikeshed () { }; + | ^ could not wrap the final value of the block as `()` doesn't implement `Try` + | + = help: the nightly-only, unstable trait `Try` is not implemented for `()` + error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`) --> $DIR/try-block-bad-type-heterogeneous.rs:20:34 | @@ -40,7 +54,13 @@ LL | let res = try bikeshed i32 { 5 }; | = help: the nightly-only, unstable trait `Try` is not implemented for `i32` -error: aborting due to 5 previous errors +error[E0277]: the trait bound `i32: FromResidual<_>` is not satisfied + --> $DIR/try-block-bad-type-heterogeneous.rs:20:34 + | +LL | let res = try bikeshed i32 { 5 }; + | ^ the nightly-only, unstable trait `FromResidual<_>` is not implemented for `i32` + +error: aborting due to 8 previous errors Some errors have detailed explanations: E0271, E0277. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/try-block/try-block-bad-type.stderr b/tests/ui/try-block/try-block-bad-type.stderr index 6f806da088b60..1a4f72713b86d 100644 --- a/tests/ui/try-block/try-block-bad-type.stderr +++ b/tests/ui/try-block/try-block-bad-type.stderr @@ -31,6 +31,20 @@ LL | let res: () = try { }; | = help: the nightly-only, unstable trait `Try` is not implemented for `()` +error[E0277]: the trait bound `(): FromResidual<_>` is not satisfied + --> $DIR/try-block-bad-type.rs:17:25 + | +LL | let res: () = try { }; + | ^ the nightly-only, unstable trait `FromResidual<_>` is not implemented for `()` + +error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`) + --> $DIR/try-block-bad-type.rs:17:25 + | +LL | let res: () = try { }; + | ^ could not wrap the final value of the block as `()` doesn't implement `Try` + | + = help: the nightly-only, unstable trait `Try` is not implemented for `()` + error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`) --> $DIR/try-block-bad-type.rs:20:26 | @@ -39,7 +53,13 @@ LL | let res: i32 = try { 5 }; | = help: the nightly-only, unstable trait `Try` is not implemented for `i32` -error: aborting due to 5 previous errors +error[E0277]: the trait bound `i32: FromResidual<_>` is not satisfied + --> $DIR/try-block-bad-type.rs:20:26 + | +LL | let res: i32 = try { 5 }; + | ^ the nightly-only, unstable trait `FromResidual<_>` is not implemented for `i32` + +error: aborting due to 8 previous errors Some errors have detailed explanations: E0271, E0277, E0308. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/try-block/try-block-in-while.stderr b/tests/ui/try-block/try-block-in-while.stderr index 6d6917362bc7d..648b0666793d1 100644 --- a/tests/ui/try-block/try-block-in-while.stderr +++ b/tests/ui/try-block/try-block-in-while.stderr @@ -6,6 +6,12 @@ LL | while try { false } {} | = help: the nightly-only, unstable trait `Try` is not implemented for `bool` -error: aborting due to 1 previous error +error[E0277]: the trait bound `bool: FromResidual<_>` is not satisfied + --> $DIR/try-block-in-while.rs:6:17 + | +LL | while try { false } {} + | ^^^^^ the nightly-only, unstable trait `FromResidual<_>` is not implemented for `bool` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/try-trait/deep-try-chain-issue-153583.stderr b/tests/ui/try-trait/deep-try-chain-issue-153583.stderr index d3794136202b4..0f1fa091ff967 100644 --- a/tests/ui/try-trait/deep-try-chain-issue-153583.stderr +++ b/tests/ui/try-trait/deep-try-chain-issue-153583.stderr @@ -6,6 +6,14 @@ LL | 0?????????????????????????????????????????????????????????????????????? | = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}` -error: aborting due to 1 previous error +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/deep-try-chain-issue-153583.rs:6:5 + | +LL | fn main() -> Result<(), ()> { + | --------------------------- this function should return `Result` or `Option` to accept `?` +LL | 0???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????... + | ^^ cannot use the `?` operator in a function that returns `{integer}` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/try-trait/try-operator-on-main.stderr b/tests/ui/try-trait/try-operator-on-main.stderr index d58720638aec1..272bcc3efa7b2 100644 --- a/tests/ui/try-trait/try-operator-on-main.stderr +++ b/tests/ui/try-trait/try-operator-on-main.stderr @@ -24,6 +24,15 @@ LL | ()?; | = help: the nightly-only, unstable trait `Try` is not implemented for `()` +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/try-operator-on-main.rs:10:5 + | +LL | fn main() { + | --------- this function should return `Result` or `Option` to accept `?` +... +LL | ()?; + | ^^^ cannot use the `?` operator in a function that returns `()` + error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-operator-on-main.rs:10:7 | @@ -53,6 +62,15 @@ LL | ()?; | = help: the nightly-only, unstable trait `Try` is not implemented for `()` -error: aborting due to 5 previous errors +error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/try-operator-on-main.rs:19:5 + | +LL | fn try_trait_generic() -> T { + | ----------------------------------- this function should return `Result` or `Option` to accept `?` +LL | // and a non-`Try` object on a `Try` fn. +LL | ()?; + | ^^^ cannot use the `?` operator in a function that returns `()` + +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/tuple/missing-field-access.stderr b/tests/ui/tuple/missing-field-access.stderr index fd9f01f8ff6ac..21db4c936d387 100644 --- a/tests/ui/tuple/missing-field-access.stderr +++ b/tests/ui/tuple/missing-field-access.stderr @@ -7,10 +7,17 @@ LL | struct F(BufReader); LL | let x = f.get_ref(); | ^^^^^^^ method not found in `F` | + --> $SRC_DIR/core/src/pin.rs:LL:COL + | + = note: the method is available for `Pin<&F>` here help: one of the expressions' fields has a method of the same name | LL | let x = f.0.get_ref(); | ++ +help: consider wrapping the receiver expression with the appropriate type + | +LL | let x = Pin::new(&f).get_ref(); + | ++++++++++ + error[E0599]: no method named `get_ref` found for tuple `(BufReader,)` in the current scope --> $DIR/missing-field-access.rs:14:15 @@ -18,10 +25,17 @@ error[E0599]: no method named `get_ref` found for tuple `(BufReader,)` in LL | let x = f.get_ref(); | ^^^^^^^ method not found in `(BufReader,)` | + --> $SRC_DIR/core/src/pin.rs:LL:COL + | + = note: the method is available for `Pin<&(BufReader,)>` here help: one of the expressions' fields has a method of the same name | LL | let x = f.0.get_ref(); | ++ +help: consider wrapping the receiver expression with the appropriate type + | +LL | let x = Pin::new(&f).get_ref(); + | ++++++++++ + error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr index e6b94c525ff23..54ae151240cdf 100644 --- a/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr +++ b/tests/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.stderr @@ -4,16 +4,12 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, LL | impl<'a, I> UnwrapItemsExt for I { | ^^ unconstrained lifetime parameter -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/assoc-type-lifetime-unconstrained.rs:22:9 +error: non-defining use of `::Iter` in the defining scope + --> $DIR/assoc-type-lifetime-unconstrained.rs:21:5 | -LL | impl<'a, I> UnwrapItemsExt for I { - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | MyStruct {} - | ^^^^^^^^^^^ +LL | fn unwrap_items(self) -> Self::Iter { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0207, E0792. -For more information about an error, try `rustc --explain E0207`. +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr index 72fae0173cbb5..6d7c4e927fa54 100644 --- a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr +++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr @@ -26,28 +26,20 @@ help: add missing generic argument LL | Tuple(Alias), | +++ -error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` not covered - --> $DIR/bad-tait-no-substs.rs:15:11 +error: item does not constrain `Alias::{opaque#0}` + --> $DIR/bad-tait-no-substs.rs:14:4 | -LL | match x {} - | ^ pattern `UninhabitedVariants::Tuple(_)` not covered +LL | fn uwu(x: UninhabitedVariants) { + | ^^^ | -note: `UninhabitedVariants` defined here - --> $DIR/bad-tait-no-substs.rs:7:10 - | -LL | pub enum UninhabitedVariants { - | ^^^^^^^^^^^^^^^^^^^ -LL | Tuple(Alias), - | ----- not covered - = note: the matched value is of type `UninhabitedVariants` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown - | -LL ~ match x { -LL + UninhabitedVariants::Tuple(_) => todo!(), -LL ~ } + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/bad-tait-no-substs.rs:5:21 | +LL | type Alias<'a, U> = impl Trait; + | ^^^^^^^^^^^^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0004, E0106, E0107. -For more information about an error, try `rustc --explain E0004`. +Some errors have detailed explanations: E0106, E0107. +For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr index 53b20d61025f0..dc6d4468ff1a4 100644 --- a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr +++ b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr @@ -1,12 +1,20 @@ -error[E0792]: expected generic type parameter, found `::Assoc` - --> $DIR/bound_reduction2.rs:16:46 +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/bound_reduction2.rs:16:4 + | +LL | fn foo_desugared(_: T) -> Foo { + | ^^^^^^^^^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/bound_reduction2.rs:9:15 | LL | type Foo = impl Trait; - | - this generic parameter must be used with a generic type parameter -... + | ^^^^^^^^^^^^^ +note: this use of `Foo<::Assoc>` does not have unique universal generic arguments + --> $DIR/bound_reduction2.rs:16:46 + | LL | fn foo_desugared(_: T) -> Foo { | ^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr index 21166631c3e2f..0d870fb62325e 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: Clone` is not satisfied - --> $DIR/bounds-are-checked-2.rs:10:5 + --> $DIR/bounds-are-checked-2.rs:9:1 | -LL | t - | ^ the trait `Clone` is not implemented for `T` +LL | fn f(t: T) -> X { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `T` | note: required by a bound in an opaque type --> $DIR/bounds-are-checked-2.rs:6:22 diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr index 7617268dd8e0c..6b66d62806fda 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked.stderr @@ -1,12 +1,8 @@ -error[E0792]: expected generic lifetime parameter, found `'static` - --> $DIR/bounds-are-checked.rs:10:5 +error: non-defining use of `X<'_>` in the defining scope + --> $DIR/bounds-are-checked.rs:9:1 | -LL | type X<'a> = impl Into<&'static str> + From<&'a str>; - | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type -... -LL | t - | ^ +LL | fn f<'a: 'static>(t: &'a str) -> X<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr index ccba2d37fd03f..5c7bb205bf6d1 100644 --- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr +++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr @@ -1,8 +1,10 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/closure_wf_outlives.rs:21:9 + --> $DIR/closure_wf_outlives.rs:17:5 | -LL | || {} - | ^^^^^ +LL | / fn define<'a, 'b>() -> Opaque<'a, 'b> +LL | | where +LL | | 'a: 'b, + | |_______________^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/closure_wf_outlives.rs:14:17 @@ -16,10 +18,13 @@ LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; | ^^ error[E0803]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/closure_wf_outlives.rs:36:9 + --> $DIR/closure_wf_outlives.rs:31:5 | -LL | || {} - | ^^^^^ +LL | / fn define<'a, 'b, 'x>() -> Opaque<'a, 'b> +LL | | where +LL | | 'a: 'x, +LL | | 'x: 'b, + | |_______________^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/closure_wf_outlives.rs:28:17 @@ -27,35 +32,38 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined here... LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/closure_wf_outlives.rs:36:9 + --> $DIR/closure_wf_outlives.rs:31:5 | -LL | || {} - | ^^^^^ +LL | / fn define<'a, 'b, 'x>() -> Opaque<'a, 'b> +LL | | where +LL | | 'a: 'x, +LL | | 'x: 'b, + | |_______________^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/closure_wf_outlives.rs:28:21 | LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/closure_wf_outlives.rs:36:9 + --> $DIR/closure_wf_outlives.rs:31:5 | -LL | || {} - | ^^^^^ +LL | / fn define<'a, 'b, 'x>() -> Opaque<'a, 'b> +LL | | where +LL | | 'a: 'x, +LL | | 'x: 'b, + | |_______________^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/closure_wf_outlives.rs:64:9 + --> $DIR/closure_wf_outlives.rs:60:5 | -LL | || {} - | ^^^^^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds... +LL | / fn define() -> Opaque +LL | | where +LL | | T: 'static, + | | ^ + | | | + | |___________________the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds | -note: ...that is required by this bound - --> $DIR/closure_wf_outlives.rs:62:12 - | -LL | T: 'static, - | ^^^^^^^ help: consider adding an explicit lifetime bound | LL | type Opaque = impl Sized; diff --git a/tests/ui/type-alias-impl-trait/coherence/orphanck-tait-with-projection-arg.stderr b/tests/ui/type-alias-impl-trait/coherence/orphanck-tait-with-projection-arg.stderr index 7ec550856b712..e9d7156ed98f5 100644 --- a/tests/ui/type-alias-impl-trait/coherence/orphanck-tait-with-projection-arg.stderr +++ b/tests/ui/type-alias-impl-trait/coherence/orphanck-tait-with-projection-arg.stderr @@ -43,7 +43,19 @@ help: this trait has no implementations, consider adding one LL | trait Identity { | ^^^^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error[E0277]: the trait bound `(): Identity` is not satisfied + --> $DIR/orphanck-tait-with-projection-arg.rs:11:24 + | +LL | fn clone(&self) -> Self { + | ^^^^ the trait `Identity` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/orphanck-tait-with-projection-arg.rs:5:1 + | +LL | trait Identity { + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors Some errors have detailed explanations: E0207, E0210, E0277, E0658. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr index 241eccc5f2b09..c5750e8fe959f 100644 --- a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr +++ b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr @@ -6,18 +6,14 @@ LL | async fn test() { | = note: the only supported types are integers, `bool`, and `char` -error: item does not constrain `Bar::{opaque#0}` - --> $DIR/const_generic_type.rs:8:10 +error[E0282]: type annotations needed + --> $DIR/const_generic_type.rs:8:30 | LL | async fn test() { - | ^^^^ + | ^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/const_generic_type.rs:5:12 - | -LL | type Bar = impl std::fmt::Display; - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/constrain_inputs.stderr b/tests/ui/type-alias-impl-trait/constrain_inputs.stderr index cb299a2021edf..8503789642791 100644 --- a/tests/ui/type-alias-impl-trait/constrain_inputs.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_inputs.stderr @@ -52,33 +52,23 @@ LL | type BadTraitRef = dyn Fn(Ty<&str>) -> &str; = note: lifetimes appearing in an associated or opaque type are not considered constrained = note: consider introducing a named lifetime parameter -error: item does not constrain `lifetime_params::Ty::{opaque#0}` - --> $DIR/constrain_inputs.rs:8:8 +error[E0282]: type annotations needed + --> $DIR/constrain_inputs.rs:8:20 | LL | fn execute(ty: Ty<'_>) -> &str { todo!() } - | ^^^^^^^ + | ^^^^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/constrain_inputs.rs:4:19 - | -LL | type Ty<'a> = impl Sized; - | ^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque -error: item does not constrain `lifetime_params_2::Ty::{opaque#0}` - --> $DIR/constrain_inputs.rs:23:8 +error[E0282]: type annotations needed + --> $DIR/constrain_inputs.rs:23:20 | LL | fn execute(ty: Ty<'_>) -> &str { ty() } - | ^^^^^^^ - | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/constrain_inputs.rs:19:19 + | ^^^^^^ cannot infer type | -LL | type Ty<'a> = impl FnOnce() -> &'a str; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 8 previous errors -Some errors have detailed explanations: E0581, E0582. -For more information about an error, try `rustc --explain E0581`. +Some errors have detailed explanations: E0282, E0581, E0582. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr index 587328e287005..8e8928e463989 100644 --- a/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr +++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal.stderr @@ -1,15 +1,11 @@ -error: item does not constrain `Opaque::{opaque#0}` - --> $DIR/different_args_considered_equal.rs:11:4 +error[E0282]: type annotations needed + --> $DIR/different_args_considered_equal.rs:13:5 | -LL | fn get_iter<'a>() -> impl IntoIterator> { - | ^^^^^^^^ +LL | None::> + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/different_args_considered_equal.rs:3:23 - | -LL | pub type Opaque<'a> = impl Sized; - | ^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr index 2cb8f03235af2..d9e95538a0cd3 100644 --- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr +++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr @@ -1,12 +1,19 @@ -error[E0792]: expected generic lifetime parameter, found `'static` +error: lifetime may not live long enough --> $DIR/different_args_considered_equal2.rs:10:9 | -LL | pub type Opaque<'a> = impl Sized; - | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type +LL | fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator> { + | -- lifetime `'a` defined here ... LL | None::> - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + | + = note: requirement occurs because of a mutable pointer to `&str` + = note: mutable pointers are invariant over their type parameter + = help: see for more information about variance +help: to declare that `impl IntoIterator>` captures data from argument `a`, you can add an explicit `'a` lifetime bound + | +LL | fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator> + 'a { + | ++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr index 4d7dd6b2ad5f5..faafd4752bf8c 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr @@ -1,14 +1,17 @@ -error: concrete type differs from previous defining opaque type use - --> $DIR/different_defining_uses_never_type-2.rs:9:31 +error[E0308]: mismatched types + --> $DIR/different_defining_uses_never_type-2.rs:9:20 | LL | let y: Tait<'b> = 1i32; - | ^^^^ expected `()`, got `i32` + | ^^^^^^^^ expected `()`, found `i32` + +error[E0308]: mismatched types + --> $DIR/different_defining_uses_never_type-2.rs:9:20 | -note: previous use here - --> $DIR/different_defining_uses_never_type-2.rs:14:5 +LL | let y: Tait<'b> = 1i32; + | ^^^^^^^^ expected `()`, found `i32` | -LL | x - | ^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr index eb9001cc6244c..82dfaedcbbd57 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr @@ -1,14 +1,17 @@ -error: concrete type differs from previous defining opaque type use - --> $DIR/different_defining_uses_never_type-3.rs:9:30 +error[E0308]: mismatched types + --> $DIR/different_defining_uses_never_type-3.rs:9:20 | LL | let y: Tait = 1i32; - | ^^^^ expected `()`, got `i32` + | ^^^^^^^ expected `()`, found `i32` + +error[E0308]: mismatched types + --> $DIR/different_defining_uses_never_type-3.rs:9:20 | -note: previous use here - --> $DIR/different_defining_uses_never_type-3.rs:14:5 +LL | let y: Tait = 1i32; + | ^^^^^^^ expected `()`, found `i32` | -LL | x - | ^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr index b87e884708ab1..cb8008fed98cd 100644 --- a/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr +++ b/tests/ui/type-alias-impl-trait/different_lifetimes_defining_uses.stderr @@ -1,14 +1,14 @@ error: concrete type differs from previous defining opaque type use - --> $DIR/different_lifetimes_defining_uses.rs:13:5 + --> $DIR/different_lifetimes_defining_uses.rs:12:1 | -LL | b - | ^ expected `&'a u32`, got `&'b u32` +LL | fn bar<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'a u32`, got `&'b u32` | note: previous use here - --> $DIR/different_lifetimes_defining_uses.rs:8:5 + --> $DIR/different_lifetimes_defining_uses.rs:7:1 | -LL | a - | ^ +LL | fn foo<'a, 'b>(a: &'a u32, b: &'b u32) -> OneLifetime<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr b/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr index 34af7cb32c270..b6b8bffdf54b7 100644 --- a/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr +++ b/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-ok.stderr @@ -1,48 +1,26 @@ -error: non-defining opaque type use in defining scope - --> $DIR/equal-lifetime-params-not-ok.rs:11:37 +error: non-defining use of `mod1::Opaque<'_, '_>` in the defining scope + --> $DIR/equal-lifetime-params-not-ok.rs:11:5 | LL | fn test<'a>() -> Opaque<'a, 'a> {} - | ^^ - | -note: lifetime used multiple times - --> $DIR/equal-lifetime-params-not-ok.rs:9:17 - | -LL | type Opaque<'a, 'b> = impl super::Trait<'a, 'b>; - | ^^ ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: non-defining opaque type use in defining scope - --> $DIR/equal-lifetime-params-not-ok.rs:18:49 +error: non-defining use of `mod2::Opaque<'_, '_>` in the defining scope + --> $DIR/equal-lifetime-params-not-ok.rs:18:5 | LL | fn test<'a: 'b, 'b: 'a>() -> Opaque<'a, 'b> {} - | ^^ - | -note: lifetime used multiple times - --> $DIR/equal-lifetime-params-not-ok.rs:16:17 - | -LL | type Opaque<'a, 'b> = impl super::Trait<'a, 'b>; - | ^^ ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: non-defining opaque type use in defining scope - --> $DIR/equal-lifetime-params-not-ok.rs:25:61 +error: non-defining use of `mod3::Opaque<'_, '_>` in the defining scope + --> $DIR/equal-lifetime-params-not-ok.rs:25:5 | LL | fn test<'a: 'b, 'b: 'a>(a: &'a str) -> Opaque<'a, 'b> { a } - | ^ - | -note: lifetime used multiple times - --> $DIR/equal-lifetime-params-not-ok.rs:23:17 - | -LL | type Opaque<'a, 'b> = impl super::Trait<'a, 'b>; - | ^^ ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0792]: expected generic lifetime parameter, found `'static` - --> $DIR/equal-lifetime-params-not-ok.rs:36:42 +error: non-defining use of `mod4::Opaque<'_>` in the defining scope + --> $DIR/equal-lifetime-params-not-ok.rs:36:5 | -LL | type Opaque<'a> = impl super::Trait<'a, 'a>; - | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type -LL | #[define_opaque(Opaque)] LL | fn test<'a: 'static>() -> Opaque<'a> {} - | ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/future.stderr b/tests/ui/type-alias-impl-trait/future.stderr index 8510ab27fb752..982bd8ab687fe 100644 --- a/tests/ui/type-alias-impl-trait/future.stderr +++ b/tests/ui/type-alias-impl-trait/future.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/future.rs:16:5 + --> $DIR/future.rs:15:1 | -LL | async move { bar.bar() } - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` +LL | fn foo(bar: B) -> FooFuture { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` | note: required by a bound in `foo` --> $DIR/future.rs:15:11 diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr index 1f30bb83da9ae..686c8a85d0009 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr @@ -1,12 +1,8 @@ -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/generic-not-strictly-equal.rs:38:5 +error: non-defining use of `Opaque<'_>` in the defining scope + --> $DIR/generic-not-strictly-equal.rs:28:18 | -LL | type Opaque<'a> = impl Copy + Captures<'a>; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | relate(opaque, hidden); // defining use: Opaque<'?1> := u8 - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | let opaque = None::>; // let's call this lifetime '?1 + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr index 1f30bb83da9ae..686c8a85d0009 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr @@ -1,12 +1,8 @@ -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/generic-not-strictly-equal.rs:38:5 +error: non-defining use of `Opaque<'_>` in the defining scope + --> $DIR/generic-not-strictly-equal.rs:28:18 | -LL | type Opaque<'a> = impl Copy + Captures<'a>; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | relate(opaque, hidden); // defining use: Opaque<'?1> := u8 - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | let opaque = None::>; // let's call this lifetime '?1 + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr index 352e6fd3c5c84..3042c72ddf1d3 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr @@ -1,14 +1,8 @@ -error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_lifetime_param.rs:9:5 +error: non-defining use of `Two<'_, '_>` in the defining scope + --> $DIR/generic_duplicate_lifetime_param.rs:8:1 | -LL | t - | ^ - | -note: lifetime used multiple times - --> $DIR/generic_duplicate_lifetime_param.rs:5:10 - | -LL | type Two<'a, 'b> = impl std::fmt::Debug; - | ^^ ^^ +LL | fn one<'a>(t: &'a ()) -> Two<'a, 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr index 022e534df1a29..b375998e22b0d 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr @@ -1,38 +1,44 @@ -error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_param_use.rs:22:30 +error: item does not constrain `TwoTys::{opaque#0}` + --> $DIR/generic_duplicate_param_use.rs:22:4 | LL | fn one_ty(t: T) -> TwoTys { - | ^^^^^^^^^^^^ + | ^^^^^^ | -note: type used multiple times - --> $DIR/generic_duplicate_param_use.rs:15:13 + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/generic_duplicate_param_use.rs:15:21 | LL | type TwoTys = impl Debug; - | ^ ^ - -error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_param_use.rs:29:5 - | -LL | t - | ^ + | ^^^^^^^^^^ +note: this use of `TwoTys` does not have unique universal generic arguments + --> $DIR/generic_duplicate_param_use.rs:22:30 | -note: lifetime used multiple times - --> $DIR/generic_duplicate_param_use.rs:17:19 +LL | fn one_ty(t: T) -> TwoTys { + | ^^^^^^^^^^^^ + +error: non-defining use of `TwoLifetimes<'_, '_>` in the defining scope + --> $DIR/generic_duplicate_param_use.rs:28:1 | -LL | type TwoLifetimes<'a, 'b> = impl Debug; - | ^^ ^^ +LL | fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_param_use.rs:34:50 +error: item does not constrain `TwoConsts::{opaque#0}` + --> $DIR/generic_duplicate_param_use.rs:34:4 | LL | fn one_const(t: *mut [u8; N]) -> TwoConsts { - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^ | -note: constant used multiple times - --> $DIR/generic_duplicate_param_use.rs:19:16 + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/generic_duplicate_param_use.rs:19:50 | LL | type TwoConsts = impl Debug; - | ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ + | ^^^^^^^^^^ +note: this use of `TwoConsts` does not have unique universal generic arguments + --> $DIR/generic_duplicate_param_use.rs:34:50 + | +LL | fn one_const(t: *mut [u8; N]) -> TwoConsts { + | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr index 193f0c92c9deb..4afeeef85389b 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr @@ -1,8 +1,8 @@ error[E0277]: `T` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use2.rs:12:5 + --> $DIR/generic_duplicate_param_use2.rs:11:1 | -LL | t - | ^ the trait `Debug` is not implemented for `T` +LL | fn two(t: T, _: U) -> Two { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `T` | note: required by a bound in an opaque type --> $DIR/generic_duplicate_param_use2.rs:8:23 diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr index f0d1e93b0b769..b34d94adc366c 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr @@ -1,8 +1,8 @@ error[E0277]: `U` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use4.rs:12:5 + --> $DIR/generic_duplicate_param_use4.rs:11:1 | -LL | u - | ^ the trait `Debug` is not implemented for `U` +LL | fn three(_: T, u: U) -> Two { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `U` | note: required by a bound in an opaque type --> $DIR/generic_duplicate_param_use4.rs:8:23 diff --git a/tests/ui/type-alias-impl-trait/generic_not_used.stderr b/tests/ui/type-alias-impl-trait/generic_not_used.stderr index a480040006eaf..1ac5d7e520f93 100644 --- a/tests/ui/type-alias-impl-trait/generic_not_used.stderr +++ b/tests/ui/type-alias-impl-trait/generic_not_used.stderr @@ -10,5 +10,13 @@ error: type parameter `V` is part of concrete type but not used in parameter lis LL | fn wrong_generic(_: U, v: V) -> WrongGeneric { | ^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: type parameter `V` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/generic_not_used.rs:9:57 + | +LL | fn wrong_generic(_: U, v: V) -> WrongGeneric { + | ^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr index 2b3f7d7502835..3d6353689f83f 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr @@ -4,30 +4,23 @@ error: at least one trait must be specified LL | type WrongGeneric = impl 'static; | ^^^^^^^^^^^^ -error[E0792]: expected generic type parameter, found `&i32` - --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 +error: item does not constrain `WrongGeneric::{opaque#0}` + --> $DIR/generic_type_does_not_live_long_enough.rs:3:4 | -LL | let z: i32 = x; - | ^ -... -LL | type WrongGeneric = impl 'static; - | - this generic parameter must be used with a generic type parameter - -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/generic_type_does_not_live_long_enough.rs:14:9 +LL | fn main() { + | ^^^^ | -LL | t - | ^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/generic_type_does_not_live_long_enough.rs:9:28 | -help: consider adding an explicit lifetime bound +LL | type WrongGeneric = impl 'static; + | ^^^^^^^^^^^^ +note: this use of `WrongGeneric<&i32>` does not have unique universal generic arguments + --> $DIR/generic_type_does_not_live_long_enough.rs:5:13 | -LL | fn wrong_generic(t: T) -> WrongGeneric { - | +++++++++ +LL | let x = wrong_generic(&y); + | ^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0310, E0792. -For more information about an error, try `rustc --explain E0310`. diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr index b1bc62c5910e1..ea1273ad2c0f5 100644 --- a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr +++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | fn underconstrain(_: T) -> Underconstrained { | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -note: required by a bound on the type alias `Underconstrained` +note: required by a bound in `Underconstrained` --> $DIR/generic_underconstrained.rs:6:26 | LL | type Underconstrained = impl Send; - | ^^^^^ required by this bound + | ^^^^^ required by this bound in `Underconstrained` help: consider restricting type parameter `T` with trait `Trait` | LL | fn underconstrain(_: T) -> Underconstrained { @@ -20,12 +20,6 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | fn underconstrain(_: T) -> Underconstrained { | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -note: required by a bound on the type alias `Underconstrained` - --> $DIR/generic_underconstrained.rs:6:26 - | -LL | type Underconstrained = impl Send; - | ^^^^^ required by this bound - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider restricting type parameter `T` with trait `Trait` | LL | fn underconstrain(_: T) -> Underconstrained { diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr index 1e3c454a5bc20..3d49fff0c9a27 100644 --- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr +++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr @@ -4,11 +4,11 @@ error[E0277]: `U` doesn't implement `Debug` LL | fn underconstrained(_: U) -> Underconstrained { | ^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `U` | -note: required by a bound on the type alias `Underconstrained` +note: required by a bound in `Underconstrained` --> $DIR/generic_underconstrained2.rs:5:26 | LL | type Underconstrained = impl Send; - | ^^^^^^^^^^^^^^^ required by this bound + | ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained` help: consider restricting type parameter `U` with trait `Debug` | LL | fn underconstrained(_: U) -> Underconstrained { @@ -20,11 +20,11 @@ error[E0277]: `V` doesn't implement `Debug` LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { | ^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `V` | -note: required by a bound on the type alias `Underconstrained2` +note: required by a bound in `Underconstrained2` --> $DIR/generic_underconstrained2.rs:15:27 | LL | type Underconstrained2 = impl Send; - | ^^^^^^^^^^^^^^^ required by this bound + | ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained2` help: consider restricting type parameter `V` with trait `Debug` | LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { @@ -36,12 +36,6 @@ error[E0277]: `U` doesn't implement `Debug` LL | fn underconstrained(_: U) -> Underconstrained { | ^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `U` | -note: required by a bound on the type alias `Underconstrained` - --> $DIR/generic_underconstrained2.rs:5:26 - | -LL | type Underconstrained = impl Send; - | ^^^^^^^^^^^^^^^ required by this bound - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider restricting type parameter `U` with trait `Debug` | LL | fn underconstrained(_: U) -> Underconstrained { @@ -53,12 +47,6 @@ error[E0277]: `V` doesn't implement `Debug` LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { | ^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `V` | -note: required by a bound on the type alias `Underconstrained2` - --> $DIR/generic_underconstrained2.rs:15:27 - | -LL | type Underconstrained2 = impl Send; - | ^^^^^^^^^^^^^^^ required by this bound - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider restricting type parameter `V` with trait `Debug` | LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { diff --git a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr index 20991a30b531c..131629475120c 100644 --- a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr +++ b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr @@ -1,11 +1,14 @@ error[E0271]: type mismatch resolving `<() as Proj>::Assoc == i32` - --> $DIR/hidden_type_mismatch.rs:45:9 + --> $DIR/hidden_type_mismatch.rs:39:5 | -LL | pub type Sep = impl Sized + std::fmt::Display; - | ------------------------------ the found opaque type +LL | pub type Sep = impl Sized + std::fmt::Display; + | ------------------------------ the found opaque type ... -LL | Bar { inner: 1i32, _marker: () } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Proj>::Assoc == i32` +LL | / pub fn define_tait() -> Tait +LL | | where +... | +LL | | (): Proj, + | |______________________________^ type mismatch resolving `<() as Proj>::Assoc == i32` | note: expected this to be `i32` --> $DIR/hidden_type_mismatch.rs:21:22 diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr index 8e6778bdd0b53..004e97c14f96a 100644 --- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr @@ -1,12 +1,11 @@ -error[E0792]: expected generic lifetime parameter, found `'x` - --> $DIR/higher_kinded_params3.rs:27:9 +error[E0284]: type annotations needed + --> $DIR/higher_kinded_params3.rs:26:26 | -LL | type Tait<'a> = impl std::fmt::Debug + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | f = g; - | ^^^^^ +LL | fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> { + | ^^^^^ cannot infer type + | + = note: cannot satisfy `for<'x> <&'x A as B>::C == _` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr index 315bdfb2272fc..4d38c74ee1338 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden.stderr @@ -1,68 +1,48 @@ -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/hkl_forbidden.rs:11:5 +error[E0275]: overflow evaluating the requirement `test::{opaque#0} == for<'a> fn(&'a str) -> &'a str {id}` + --> $DIR/hkl_forbidden.rs:10:21 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (id, id) - | ^^^^^^^^ +LL | fn test(s: &str) -> (impl Fn(&str) -> Opaque<'_>, impl Fn(&str) -> Opaque<'_>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hkl_forbidden`) -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/hkl_forbidden.rs:11:5 +error[E0275]: overflow evaluating the requirement `test2::{opaque#0} == for<'a, 'b> fn((&'a str, &'b str)) -> (_, _) {id2}` + --> $DIR/hkl_forbidden.rs:23:15 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (id, id) - | ^^^^^^^^ +LL | fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'b>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hkl_forbidden`) -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/hkl_forbidden.rs:24:5 +error[E0275]: overflow evaluating the requirement `test3::{opaque#0} == for<'a> fn(&'a str) -> &'a str {id}` + --> $DIR/hkl_forbidden.rs:32:22 | -LL | type Opaque2<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | id2 - | ^^^ - -error[E0792]: expected generic lifetime parameter, found `'b` - --> $DIR/hkl_forbidden.rs:24:5 +LL | fn test3(s: &str) -> (impl Fn(&str) -> Opaque3<'_>, Opaque3<'_>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | type Opaque2<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | id2 - | ^^^ + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hkl_forbidden`) -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/hkl_forbidden.rs:33:5 +error[E0275]: overflow evaluating the requirement `test4::{opaque#0} == for<'a> fn(&'a str) -> &'a str {id}` + --> $DIR/hkl_forbidden.rs:38:22 | -LL | type Opaque3<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (id, s) - | ^^^^^^^ - -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/hkl_forbidden.rs:39:5 +LL | fn test4(s: &str) -> (Opaque4<'_>, impl Fn(&str) -> Opaque4<'_>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | type Opaque4<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (s, id) - | ^^^^^^^ + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hkl_forbidden`) -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/hkl_forbidden.rs:45:5 +error: item does not constrain `outer_impl::{opaque#0}` + --> $DIR/hkl_forbidden.rs:44:4 + | +LL | fn outer_impl() -> impl for<'a> Fn(&'a ()) -> Inner<'a> { + | ^^^^^^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/hkl_forbidden.rs:44:20 | -LL | type Inner<'a> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | |x| x - | ^^^^^ +LL | fn outer_impl() -> impl for<'a> Fn(&'a ()) -> Inner<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr index 7404c844ae7b0..d370c32e908f2 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden2.stderr @@ -1,12 +1,11 @@ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/hkl_forbidden2.rs:15:5 +error[E0282]: type annotations needed + --> $DIR/hkl_forbidden2.rs:14:14 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | &() - | ^^^ +LL | fn test() -> &'static dyn for<'a> Trait<'a, Assoc = Opaque<'a>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr index d699059e3972c..f4857336335a6 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr @@ -1,12 +1,12 @@ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/hkl_forbidden3.rs:11:5 +error[E0282]: type annotations needed + --> $DIR/hkl_forbidden3.rs:10:47 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | foo - | ^^^ +LL | fn test() -> for<'a> fn(&'a ()) -> Opaque<'a> { + | _______________________________________________^ +LL | | foo +LL | | } + | |_^ cannot infer type error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr index 87313e3495249..411111b002080 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr @@ -11,17 +11,21 @@ note: this opaque type is supposed to be constrained LL | type FutNothing<'a> = impl 'a + Future; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: concrete type differs from previous defining opaque type use +error[E0275]: overflow evaluating the requirement `for<'any> for<'a> fn(&'a mut ()) -> impl Future {operation}: FnMut(&'any mut ())` --> $DIR/hkl_forbidden4.rs:13:5 | LL | call(operation).await - | ^^^^^^^^^^^^^^^ expected `{async fn body of operation()}`, got `FutNothing<'_>` + | ^^^^^^^^^^^^^^^ | -note: previous use here - --> $DIR/hkl_forbidden4.rs:12:35 + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hkl_forbidden4`) +note: required by a bound in `call` + --> $DIR/hkl_forbidden4.rs:21:18 | -LL | async fn operation(_: &mut ()) -> () { - | ^^ +LL | async fn call(_f: F) +... +LL | for<'any> F: FnMut(&'any mut ()) -> FutNothing<'any>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call` error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr index 4b050f362c9ca..8be3a0c72b1a4 100644 --- a/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr +++ b/tests/ui/type-alias-impl-trait/ice-failed-to-resolve-instance-for-110696.stderr @@ -26,6 +26,15 @@ note: this opaque type is supposed to be constrained LL | type DummyT = impl F; | ^^^^^^ -error: aborting due to 2 previous errors +error[E0275]: overflow evaluating the requirement ` as MyIndex<_>>::O == {type error}` + --> $DIR/ice-failed-to-resolve-instance-for-110696.rs:47:26 + | +LL | fn my_index(self) -> Self::O { + | ^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`ice_failed_to_resolve_instance_for_110696`) + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0207`. +Some errors have detailed explanations: E0207, E0275. +For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr index cbd06a5824d6b..274ebf1f8bece 100644 --- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr +++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound2.stderr @@ -1,20 +1,11 @@ -error[E0277]: the trait bound `Foo: Yay` is not satisfied - --> $DIR/impl_trait_for_tait_bound2.rs:12:14 +error[E0282]: type annotations needed + --> $DIR/impl_trait_for_tait_bound2.rs:12:5 | LL | is_yay::(); - | ^^^ the trait `Yay` is not implemented for `Foo` + | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `is_yay` | -help: the trait `Yay` is implemented for `u32` - --> $DIR/impl_trait_for_tait_bound2.rs:8:1 - | -LL | impl Yay for u32 {} - | ^^^^^^^^^^^^^^^^ -note: required by a bound in `is_yay` - --> $DIR/impl_trait_for_tait_bound2.rs:15:14 - | -LL | fn is_yay() {} - | ^^^ required by this bound in `is_yay` + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.edition2015.stderr b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.edition2015.stderr index 4f1e769bc6c40..eb26ab4206df2 100644 --- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.edition2015.stderr +++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.edition2015.stderr @@ -1,12 +1,11 @@ error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds - --> $DIR/imply_bounds_from_bounds_param.rs:29:5 + --> $DIR/imply_bounds_from_bounds_param.rs:28:1 | LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { - | -- ------------ opaque type defined here - | | + | ^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^------------ + | | | + | | opaque type defined here | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here -LL | <&'a mut i32 as Callable>::call(y) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: add a `use<...>` bound to explicitly capture `'a` | diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr index f399520e7fd3f..135affc6a0911 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound.stderr @@ -1,12 +1,14 @@ -error[E0792]: expected generic lifetime parameter, found `'_` +error: lifetime may not live long enough --> $DIR/in-assoc-ty-early-bound.rs:11:60 | -LL | type Assoc<'a, 'b> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter LL | fn bar<'a: 'a, 'b: 'b>(x: &'a ()) -> Self::Assoc<'a, 'b> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here LL | let closure = |x: &'a ()| -> Self::Assoc<'b, 'a> { x }; - | ^ + | ^ associated function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | + = help: consider adding the following bound: `'a: 'b` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr index aaed03e739b4c..1e1abf526dcbc 100644 --- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr +++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr @@ -1,12 +1,8 @@ -error[E0792]: expected generic lifetime parameter, found `'_` +error: non-defining use of `<() as Foo>::Assoc<'_>` in the defining scope --> $DIR/in-assoc-ty-early-bound2.rs:15:20 | -LL | type Assoc<'a> = impl Sized; - | -- this generic parameter must be used with a generic lifetime parameter -... LL | let _: Self::Assoc<'a> = x; | ^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/in-where-clause.stderr b/tests/ui/type-alias-impl-trait/in-where-clause.stderr index 97b63a8ad3e32..2082e3ff3c138 100644 --- a/tests/ui/type-alias-impl-trait/in-where-clause.stderr +++ b/tests/ui/type-alias-impl-trait/in-where-clause.stderr @@ -1,9 +1,10 @@ -error[E0391]: cycle detected when computing type of opaque `Bar::{opaque#0}` +error[E0391]: cycle detected when computing type of `Bar::{opaque#0}` --> $DIR/in-where-clause.rs:5:12 | LL | type Bar = impl Sized; | ^^^^^^^^^^ | + = note: ...which requires computing type of opaque `Bar::{opaque#0}`... note: ...which requires borrow-checking `foo`... --> $DIR/in-where-clause.rs:9:1 | @@ -15,20 +16,22 @@ LL | | Bar: Send, = note: ...which requires checking if `foo` contains FFI-unwind calls... = note: ...which requires building MIR for `foo`... = note: ...which requires match-checking `foo`... - = note: ...which requires type-checking `foo`... -note: ...which requires computing revealed normalized predicates of `foo::{constant#0}`... +note: ...which requires type-checking `foo`... --> $DIR/in-where-clause.rs:13:9 | LL | [0; 1 + 2] | ^^^^^ - = note: ...which requires revealing opaque types in `[Binder { value: TraitClause(, polarity:Positive), bound_vars: [] }]`... -note: ...which requires computing type of `Bar::{opaque#0}`... - --> $DIR/in-where-clause.rs:5:12 + = note: ...which requires evaluating type-level constant... + = note: ...which requires const-evaluating + checking `foo::{constant#0}`... + = note: ...which requires checking if `foo::{constant#0}` is a trivial const... + = note: ...which again requires computing type of `Bar::{opaque#0}`, completing the cycle +note: cycle used when checking that `foo` is well-formed + --> $DIR/in-where-clause.rs:9:1 | -LL | type Bar = impl Sized; - | ^^^^^^^^^^ - = note: ...which again requires computing type of opaque `Bar::{opaque#0}`, completing the cycle - = note: cycle used when evaluating trait selection obligation `Bar: core::marker::Send` +LL | / fn foo() -> Bar +LL | | where +LL | | Bar: Send, + | |______________^ = note: for more information, see and error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/incomplete-inference.stderr b/tests/ui/type-alias-impl-trait/incomplete-inference.stderr index 8e423567203e0..27baeafe35be9 100644 --- a/tests/ui/type-alias-impl-trait/incomplete-inference.stderr +++ b/tests/ui/type-alias-impl-trait/incomplete-inference.stderr @@ -4,6 +4,7 @@ error[E0282]: type annotations needed LL | None | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` | + = note: cannot infer type of hidden type of opaque help: consider specifying a concrete type for the type parameter `T` | LL | None:: diff --git a/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr index 426a6c29fff66..6e4179614bb55 100644 --- a/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr +++ b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr @@ -1,9 +1,12 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/infinite-cycle-involving-weak.rs:6:13 +error[E0308]: mismatched types + --> $DIR/infinite-cycle-involving-weak.rs:8:5 | LL | fn foo() -> T { - | ^ + | - expected `_` because of return type +LL | +LL | None::<&'static T> + | ^^^^^^^^^^^^^^^^^^ recursive type with infinite-size name error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type-alias-impl-trait/issue-109054.stderr b/tests/ui/type-alias-impl-trait/issue-109054.stderr index 5ce6f54e5f9ad..01e777268ff83 100644 --- a/tests/ui/type-alias-impl-trait/issue-109054.stderr +++ b/tests/ui/type-alias-impl-trait/issue-109054.stderr @@ -1,4 +1,4 @@ -error: item does not constrain `ReturnType::{opaque#0}` +error: item does not constrain `FnType::{opaque#0}` --> $DIR/issue-109054.rs:14:8 | LL | fn deref(&self) -> &Self::Target { @@ -6,10 +6,10 @@ LL | fn deref(&self) -> &Self::Target { | = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` note: this opaque type is supposed to be constrained - --> $DIR/issue-109054.rs:7:23 + --> $DIR/issue-109054.rs:8:15 | -LL | type ReturnType<'a> = impl std::future::Future + 'a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | type FnType = impl Fn(&u32) -> ReturnType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/issue-52843.stderr b/tests/ui/type-alias-impl-trait/issue-52843.stderr index ee2390d09451d..16cda64459665 100644 --- a/tests/ui/type-alias-impl-trait/issue-52843.stderr +++ b/tests/ui/type-alias-impl-trait/issue-52843.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: Default` is not satisfied - --> $DIR/issue-52843.rs:8:5 + --> $DIR/issue-52843.rs:7:1 | -LL | t - | ^ the trait `Default` is not implemented for `T` +LL | fn foo(t: T) -> Foo { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `T` | note: required by a bound in an opaque type --> $DIR/issue-52843.rs:3:20 diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr index 689f7a733cb5e..2d882a0b4e660 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr @@ -10,16 +10,11 @@ note: this opaque type is supposed to be constrained | LL | type Bug = impl Fn(T) -> U + Copy; | ^^^^^^^^^^^^^^^^^^^^^^ - -error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/issue-53092-2.rs:7:41 +note: this use of `Bug` does not have unique universal generic arguments + --> $DIR/issue-53092-2.rs:7:32 | LL | const CONST_BUG: Bug = unsafe { std::mem::transmute(|_: u8| ()) }; - | ^^^^^^^^^^^^^^^^^^^ - | - = note: source type: `{closure@$DIR/issue-53092-2.rs:7:61: 7:68}` (0 bits) - = note: target type: `{type error}` (the type has an unknown layout) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/type-alias-impl-trait/issue-53092.stderr b/tests/ui/type-alias-impl-trait/issue-53092.stderr index a8554b9a98922..5414c42b12923 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092.stderr +++ b/tests/ui/type-alias-impl-trait/issue-53092.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `U: From` is not satisfied - --> $DIR/issue-53092.rs:8:5 + --> $DIR/issue-53092.rs:7:1 | -LL | |x| x.into() - | ^^^^^^^^^^^^ the trait `From` is not implemented for `U` +LL | fn make_bug>() -> Bug { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From` is not implemented for `U` | note: required by a bound in `make_bug` --> $DIR/issue-53092.rs:7:19 diff --git a/tests/ui/type-alias-impl-trait/issue-53598.stderr b/tests/ui/type-alias-impl-trait/issue-53598.stderr index f1dd3c69443cf..7fe7385ccd2f8 100644 --- a/tests/ui/type-alias-impl-trait/issue-53598.stderr +++ b/tests/ui/type-alias-impl-trait/issue-53598.stderr @@ -4,5 +4,13 @@ error: type parameter `T` is part of concrete type but not used in parameter lis LL | fn foo(_: T) -> Self::Item { | ^^^^^^^^^^ -error: aborting due to 1 previous error +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-53598.rs:19:31 + | +LL | fn foo(_: T) -> Self::Item { + | ^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/issue-60371.stderr b/tests/ui/type-alias-impl-trait/issue-60371.stderr index eef6571ff8c23..3662a8062c3a5 100644 --- a/tests/ui/type-alias-impl-trait/issue-60371.stderr +++ b/tests/ui/type-alias-impl-trait/issue-60371.stderr @@ -8,19 +8,19 @@ LL | type Item = impl Bug; = help: add `#![feature(impl_trait_in_assoc_type)]` 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[E0277]: the trait bound `(): Bug` is not satisfied - --> $DIR/issue-60371.rs:10:40 +error[E0271]: type mismatch resolving `<&() as Bug>::Item == ()` + --> $DIR/issue-60371.rs:10:37 | LL | const FUN: fn() -> Self::Item = || (); - | ^^ the trait `Bug` is not implemented for `()` + | ^^^^^ type mismatch resolving `<&() as Bug>::Item == ()` | -help: the trait `Bug` is implemented for `&()` - --> $DIR/issue-60371.rs:7:1 +note: types differ + --> $DIR/issue-60371.rs:8:17 | -LL | impl Bug for &() { - | ^^^^^^^^^^^^^^^^ +LL | type Item = impl Bug; + | ^^^^^^^^ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0277, E0658. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0658. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/type-alias-impl-trait/issue-60564.stderr b/tests/ui/type-alias-impl-trait/issue-60564.stderr index bfe8d92fedd3a..32899a57ca2bd 100644 --- a/tests/ui/type-alias-impl-trait/issue-60564.stderr +++ b/tests/ui/type-alias-impl-trait/issue-60564.stderr @@ -1,12 +1,20 @@ -error[E0792]: expected generic type parameter, found `u8` - --> $DIR/issue-60564.rs:20:34 +error: item does not constrain `IterBitsIter::{opaque#0}` + --> $DIR/issue-60564.rs:20:8 + | +LL | fn iter_bits(self, n: u8) -> Self::BitsIter { + | ^^^^^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/issue-60564.rs:8:30 | LL | type IterBitsIter = impl std::iter::Iterator; - | - this generic parameter must be used with a generic type parameter -... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: this use of `IterBitsIter` does not have unique universal generic arguments + --> $DIR/issue-60564.rs:20:34 + | LL | fn iter_bits(self, n: u8) -> Self::BitsIter { | ^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr index 165c1c25280bd..10a3c18f98f61 100644 --- a/tests/ui/type-alias-impl-trait/issue-63279.stderr +++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr @@ -1,26 +1,28 @@ -error[E0277]: expected an `FnOnce()` closure, found `()` +error[E0271]: type mismatch resolving `Closure == ()` --> $DIR/issue-63279.rs:6:11 | LL | fn c() -> Closure { - | ^^^^^^^ expected an `FnOnce()` closure, found `()` - | - = help: the trait `FnOnce()` is not implemented for `()` - = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` + | ^^^^^^^ types differ -error[E0277]: expected an `FnOnce()` closure, found `()` +error[E0271]: type mismatch resolving `Closure == ()` --> $DIR/issue-63279.rs:8:11 | LL | || -> Closure { || () } - | ^^^^^^^ expected an `FnOnce()` closure, found `()` + | ^^^^^^^ types differ + +error[E0271]: type mismatch resolving `Closure == ()` + --> $DIR/issue-63279.rs:8:5 | - = help: the trait `FnOnce()` is not implemented for `()` - = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` +LL | || -> Closure { || () } + | ^^^^^^^^^^^^^ types differ error[E0308]: mismatched types --> $DIR/issue-63279.rs:8:21 | LL | || -> Closure { || () } - | ^^^^^ expected `()`, found closure + | ------- ^^^^^ expected `()`, found closure + | | + | expected `()` because of return type | = note: expected unit type `()` found closure `{closure@$DIR/issue-63279.rs:8:21: 8:23}` @@ -32,6 +34,9 @@ LL | || -> Closure { (|| ())() } error[E0308]: mismatched types --> $DIR/issue-63279.rs:8:5 | +LL | fn c() -> Closure { + | ------- expected `()` because of return type +LL | LL | || -> Closure { || () } | ^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure | @@ -42,7 +47,7 @@ help: use parentheses to call this closure LL | (|| -> Closure { || () })() | + +++ -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0308. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/type-alias-impl-trait/issue-63355.stderr b/tests/ui/type-alias-impl-trait/issue-63355.stderr index cb1ef0ce41deb..a1e84c9f57e06 100644 --- a/tests/ui/type-alias-impl-trait/issue-63355.stderr +++ b/tests/ui/type-alias-impl-trait/issue-63355.stderr @@ -1,15 +1,11 @@ -error: item does not constrain `FooImpl::{opaque#0}` - --> $DIR/issue-63355.rs:43:8 +error[E0282]: type annotations needed + --> $DIR/issue-63355.rs:43:17 | LL | fn bar() -> Self::Bar { - | ^^^ + | ^^^^^^^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/issue-63355.rs:30:20 - | -LL | pub type FooImpl = impl Foo; - | ^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/issue-65384.stderr b/tests/ui/type-alias-impl-trait/issue-65384.stderr index 5653ee324be18..d9e0d51031847 100644 --- a/tests/ui/type-alias-impl-trait/issue-65384.stderr +++ b/tests/ui/type-alias-impl-trait/issue-65384.stderr @@ -7,6 +7,15 @@ LL | impl MyTrait for () {} LL | impl MyTrait for Bar {} | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `Bar == ()` + --> $DIR/issue-65384.rs:13:14 + | +LL | fn bazr() -> Bar {} + | ^^^ + +error[E0275]: overflow evaluating the requirement `Bar == {type error}` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0275. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr index e58b2d4aa6098..0d0b83e31aceb 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr @@ -1,12 +1,20 @@ -error[E0792]: expected generic type parameter, found `()` - --> $DIR/issue-68368-non-defining-use-2.rs:10:15 +error: item does not constrain `Alias::{opaque#0}` + --> $DIR/issue-68368-non-defining-use-2.rs:10:4 + | +LL | fn f<'a>() -> Alias<'a, ()> {} + | ^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/issue-68368-non-defining-use-2.rs:7:21 | LL | type Alias<'a, U> = impl Trait; - | - this generic parameter must be used with a generic type parameter -... + | ^^^^^^^^^^^^^ +note: this use of `Alias<'a, ()>` does not have unique universal generic arguments + --> $DIR/issue-68368-non-defining-use-2.rs:10:15 + | LL | fn f<'a>() -> Alias<'a, ()> {} | ^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr index 3ec19e206008d..dc799a2256533 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr @@ -1,12 +1,20 @@ -error[E0792]: expected generic type parameter, found `()` - --> $DIR/issue-68368-non-defining-use.rs:10:15 +error: item does not constrain `Alias::{opaque#0}` + --> $DIR/issue-68368-non-defining-use.rs:10:4 + | +LL | fn f<'a>() -> Alias<'a, ()> {} + | ^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/issue-68368-non-defining-use.rs:7:21 | LL | type Alias<'a, U> = impl Trait; - | - this generic parameter must be used with a generic type parameter -... + | ^^^^^^^^^^^^^ +note: this use of `Alias<'a, ()>` does not have unique universal generic arguments + --> $DIR/issue-68368-non-defining-use.rs:10:15 + | LL | fn f<'a>() -> Alias<'a, ()> {} | ^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-74761.stderr b/tests/ui/type-alias-impl-trait/issue-74761.stderr index a4826c293467e..f21aa0b65a73a 100644 --- a/tests/ui/type-alias-impl-trait/issue-74761.stderr +++ b/tests/ui/type-alias-impl-trait/issue-74761.stderr @@ -10,16 +10,12 @@ error[E0207]: the lifetime parameter `'b` is not constrained by the impl trait, LL | impl<'a, 'b> A for () { | ^^ unconstrained lifetime parameter -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/issue-74761.rs:12:28 +error: non-defining use of `<() as A>::B` in the defining scope + --> $DIR/issue-74761.rs:12:5 | -LL | impl<'a, 'b> A for () { - | -- this generic parameter must be used with a generic lifetime parameter -... LL | fn f(&self) -> Self::B {} - | ^^ + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0207, E0792. -For more information about an error, try `rustc --explain E0207`. +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/issue-77179.stderr b/tests/ui/type-alias-impl-trait/issue-77179.stderr index 222edfb90a7b3..1fb5773e0b95e 100644 --- a/tests/ui/type-alias-impl-trait/issue-77179.stderr +++ b/tests/ui/type-alias-impl-trait/issue-77179.stderr @@ -1,9 +1,18 @@ -error[E0792]: expected generic type parameter, found `i32` - --> $DIR/issue-77179.rs:8:14 +error: item does not constrain `Pointer::{opaque#0}` + --> $DIR/issue-77179.rs:8:4 + | +LL | fn test() -> Pointer<_> { + | ^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/issue-77179.rs:5:19 | LL | type Pointer = impl std::ops::Deref; - | - this generic parameter must be used with a generic type parameter -... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: this use of `Pointer` does not have unique universal generic arguments + --> $DIR/issue-77179.rs:8:14 + | LL | fn test() -> Pointer<_> { | ^^^^^^^^^^ @@ -16,7 +25,7 @@ LL | fn test() -> Pointer<_> { help: replace with the correct return type | LL - fn test() -> Pointer<_> { -LL + fn test() -> Pointer { +LL + fn test() -> Box { | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions @@ -27,5 +36,4 @@ LL | fn bar() -> Pointer<_>; error: aborting due to 3 previous errors -Some errors have detailed explanations: E0121, E0792. -For more information about an error, try `rustc --explain E0121`. +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/type-alias-impl-trait/issue-89686.stderr b/tests/ui/type-alias-impl-trait/issue-89686.stderr index 7ad1442f666c2..d0fba8c72e1ad 100644 --- a/tests/ui/type-alias-impl-trait/issue-89686.stderr +++ b/tests/ui/type-alias-impl-trait/issue-89686.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `T: Trait` is not satisfied - --> $DIR/issue-89686.rs:19:9 + --> $DIR/issue-89686.rs:15:5 | -LL | async move { self.f().await } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` +LL | / fn g<'a>(&'a self) -> G<'a, Self> +LL | | where +LL | | Self: Sized, + | |____________________^ the trait `Trait` is not implemented for `T` | help: consider restricting type parameter `T` with trait `Trait` | diff --git a/tests/ui/type-alias-impl-trait/issue-90400-1.stderr b/tests/ui/type-alias-impl-trait/issue-90400-1.stderr index 85700056d47c6..c2311cf9c3c3a 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-1.stderr +++ b/tests/ui/type-alias-impl-trait/issue-90400-1.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/issue-90400-1.rs:22:9 + --> $DIR/issue-90400-1.rs:21:5 | -LL | move || bar.bar() - | ^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` +LL | fn foo(&self, bar: B) -> Self::FooFn { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` | note: required by a bound in `::foo` --> $DIR/issue-90400-1.rs:21:15 diff --git a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr index d4faa6e939259..0a0b67168613c 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/issue-90400-2.rs:25:9 + --> $DIR/issue-90400-2.rs:24:5 | -LL | MyBaz(bar) - | ^^^^^^^^^^ the trait `Bar` is not implemented for `B` +LL | fn foo(&self, bar: B) -> Self::FooFn { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` | note: required for `MyBaz` to implement `Baz` --> $DIR/issue-90400-2.rs:30:14 diff --git a/tests/ui/type-alias-impl-trait/issue-94429.stderr b/tests/ui/type-alias-impl-trait/issue-94429.stderr index 3f85d23144a4f..28dd9baf303f0 100644 --- a/tests/ui/type-alias-impl-trait/issue-94429.stderr +++ b/tests/ui/type-alias-impl-trait/issue-94429.stderr @@ -1,8 +1,14 @@ -error[E0271]: type mismatch resolving `<{coroutine@issue-94429.rs:18:9} as Coroutine>::Yield == ()` +error[E0271]: type mismatch resolving `::Coro == {coroutine@issue-94429.rs:18:9}` --> $DIR/issue-94429.rs:15:26 | LL | fn run(&mut self) -> Self::Coro { - | ^^^^^^^^^^ expected `()`, found integer + | ^^^^^^^^^^ type mismatch resolving `::Coro == {coroutine@issue-94429.rs:18:9}` + | +note: types differ + --> $DIR/issue-94429.rs:13:17 + | +LL | type Coro = impl Coroutine; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained-mismatch.stderr b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained-mismatch.stderr index 4f4ca1041d768..c1a468ed24cd6 100644 --- a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained-mismatch.stderr +++ b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained-mismatch.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-96572-unconstrained-mismatch.rs:8:14 | LL | match foo { - | --- this expression has type `T` + | --- this expression has type `Option<(u32, u32)>` LL | None => (), LL | Some((a, b, c)) => (), | ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements diff --git a/tests/ui/type-alias-impl-trait/issue-98604.stderr b/tests/ui/type-alias-impl-trait/issue-98604.stderr index 77c6ba3003f0d..ccae3aa971a6a 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98604.stderr @@ -4,6 +4,8 @@ error[E0271]: expected `test` to return `Pin>>`, but LL | Box::new(test) as AsyncFnPtr; | ^^^^^^^^^^^^^^ expected `Pin>>`, found future | + = note: required because it appears within the type `fn() -> impl Future {test}` + = note: required for `Box impl Future {test}>` to implement `CoerceUnsized Pin + 'static)>>>>` = note: required for the cast from `Box impl Future {test}>` to `Box<(dyn Fn() -> Pin + 'static)>> + 'static)>` error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/issue-98608.stderr b/tests/ui/type-alias-impl-trait/issue-98608.stderr index 872a6ed435001..495c2d31e533f 100644 --- a/tests/ui/type-alias-impl-trait/issue-98608.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98608.stderr @@ -9,6 +9,8 @@ LL | let b: Box Box> = Box::new(hi); | = note: expected struct `Box` found opaque type `impl Sized` + = note: required because it appears within the type `fn() -> impl Sized {hi}` + = note: required for `Box impl Sized {hi}>` to implement `CoerceUnsized Box>>` = note: required for the cast from `Box impl Sized {hi}>` to `Box Box>` error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr b/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr index 9d38e8f36b15c..cf87222419b01 100644 --- a/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr +++ b/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr @@ -1,16 +1,10 @@ error[E0308]: mismatched types --> $DIR/itiat-allow-nested-closures.rs:21:22 | -LL | type Assoc = impl Sized; - | ---------- the found opaque type -... LL | let _: i32 = closure(); - | --- ^^^^^^^^^ expected `i32`, found opaque type + | --- ^^^^^^^^^ expected `i32`, found `()` | | | expected due to this - | - = note: expected type `i32` - found opaque type `<() as Foo>::Assoc` error[E0308]: mismatched types --> $DIR/itiat-allow-nested-closures.rs:22:9 diff --git a/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr b/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr index 22d16e39fc404..c6f7ecf7e161f 100644 --- a/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr +++ b/tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr @@ -10,28 +10,41 @@ LL | Thunk::new(|cont| cont) = note: expected struct `Thunk<_>` found unit type `()` -error[E0277]: expected an `FnOnce()` closure, found `()` - --> $DIR/lazy_subtyping_of_opaques.rs:12:23 +error[E0271]: type mismatch resolving `Tait == ()` + --> $DIR/lazy_subtyping_of_opaques.rs:10:29 | -LL | Thunk::new(|cont| cont) - | ^^^^ expected an `FnOnce()` closure, found `()` - | - = help: the trait `FnOnce()` is not implemented for `()` - = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` +LL | fn reify_as_tait() -> Thunk { + | ^^^^ types differ -error[E0277]: expected an `FnOnce()` closure, found `()` +error[E0271]: type mismatch resolving `Tait == ()` --> $DIR/lazy_subtyping_of_opaques.rs:10:23 | LL | fn reify_as_tait() -> Thunk { - | ^^^^^^^^^^^ expected an `FnOnce()` closure, found `()` -LL | + | ^^^^^^^^^^^ types differ + +error[E0277]: the trait bound `{closure@$DIR/lazy_subtyping_of_opaques.rs:12:16: 12:22}: ContFn` is not satisfied + --> $DIR/lazy_subtyping_of_opaques.rs:12:16 + | +LL | Thunk::new(|cont| cont) + | ---------- ^^^^^^^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call + | +help: the trait `ContFn` is not implemented for closure `{closure@$DIR/lazy_subtyping_of_opaques.rs:12:16: 12:22}` + --> $DIR/lazy_subtyping_of_opaques.rs:12:16 + | LL | Thunk::new(|cont| cont) - | ----------------------- return type was inferred to be `{type error}` here + | ^^^^^^ +note: required by a bound in `Thunk::::new` + --> $DIR/lazy_subtyping_of_opaques.rs:22:12 | - = help: the trait `FnOnce()` is not implemented for `()` - = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` +LL | impl Thunk { +LL | fn new(f: F) +LL | where +LL | F: ContFn, + | ^^^^^^ required by this bound in `Thunk::::new` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277, E0308. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/type-alias-impl-trait/match-upvar-discriminant-of-opaque.stderr b/tests/ui/type-alias-impl-trait/match-upvar-discriminant-of-opaque.stderr index 2bfce2d63a8ee..a697a9f0442f6 100644 --- a/tests/ui/type-alias-impl-trait/match-upvar-discriminant-of-opaque.stderr +++ b/tests/ui/type-alias-impl-trait/match-upvar-discriminant-of-opaque.stderr @@ -1,9 +1,11 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/match-upvar-discriminant-of-opaque.rs:7:9 +error[E0275]: overflow assigning `Option<({integer}, PhantomData)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>` to `Option<({integer}, PhantomData)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>>)>` + --> $DIR/match-upvar-discriminant-of-opaque.rs:5:28 | -LL | None => (), - | ^^^^ +LL | let foo: T = Some((42, std::marker::PhantomData::)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`match_upvar_discriminant_of_opaque`) error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr index b73e6b8c1015b..90e1cadca0bc6 100644 --- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr +++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr @@ -1,11 +1,11 @@ error[E0700]: hidden type for `Opaque2` captures lifetime that does not appear in bounds - --> $DIR/missing_lifetime_bound.rs:6:47 + --> $DIR/missing_lifetime_bound.rs:6:1 | LL | type Opaque2 = impl Sized; | ---------- opaque type defined here ... LL | fn defining<'a, T>(x: &'a i32) -> Opaque { x } - | -- ^ + | ^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | hidden type `&'a i32` captures the lifetime `'a` as defined here diff --git a/tests/ui/type-alias-impl-trait/multi-error.stderr b/tests/ui/type-alias-impl-trait/multi-error.stderr index 3cb267c7c2615..1d735c764f2fd 100644 --- a/tests/ui/type-alias-impl-trait/multi-error.stderr +++ b/tests/ui/type-alias-impl-trait/multi-error.stderr @@ -10,12 +10,21 @@ note: for this opaque type LL | type Bar = impl Sized; | ^^^^^^^^^^ -error[E0792]: expected generic type parameter, found `u32` - --> $DIR/multi-error.rs:17:17 +error: item does not constrain `<() as Foo>::Bar::{opaque#0}` + --> $DIR/multi-error.rs:17:8 + | +LL | fn foo() -> (Self::Bar, Self::Baz) { + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/multi-error.rs:15:19 | LL | type Bar = impl Sized; - | - this generic parameter must be used with a generic type parameter -LL | type Baz = impl Sized; + | ^^^^^^^^^^ +note: this use of `<() as Foo>::Bar` does not have unique universal generic arguments + --> $DIR/multi-error.rs:17:17 + | LL | fn foo() -> (Self::Bar, Self::Baz) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr index 05a169882cb11..baffc1dba4c93 100644 --- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr +++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr @@ -1,15 +1,37 @@ -error[E0277]: the trait bound `&'static B: From<&A>` is not satisfied +error[E0308]: mismatched types --> $DIR/multiple-def-uses-in-one-fn.rs:10:45 | LL | fn f(a: &'static A, b: B) -> (X, X) { - | ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B` + | - - expected type parameter ^^^^^^^^^^^^^^^^^^ expected `&B`, found `&A` + | | + | found type parameter | - = note: required for `&A` to implement `Into<&'static B>` -help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + = note: expected reference `&B` + found reference `&A` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error[E0271]: type mismatch resolving `X == &A` + --> $DIR/multiple-def-uses-in-one-fn.rs:10:45 + | +LL | fn f(a: &'static A, b: B) -> (X, X) { + | ^^^^^^^^^^^^^^^^^^ types differ + +error[E0308]: mismatched types + --> $DIR/multiple-def-uses-in-one-fn.rs:10:45 + | +LL | fn f(a: &'static A, b: B) -> (X, X) { + | - - expected type parameter ^^^^^^^^^^^^^^^^^^ expected `&B`, found `&A` + | | + | found type parameter | -LL | fn f(a: &'static A, b: B) -> (X, X) where &'static B: From<&A> { - | ++++++++++++++++++++++++++ + = note: expected reference `&B` + found reference `&A` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 1 previous error +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0308. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr index 8d79b37f0f5f3..5b0aa4f19e6f4 100644 --- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr +++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn2.stderr @@ -1,11 +1,30 @@ -error: concrete type differs from previous defining opaque type use +error[E0308]: mismatched types --> $DIR/multiple-def-uses-in-one-fn2.rs:10:63 | LL | fn f(a: A, b: B) -> (X, X) { - | ^^^^^^^^^^^^^^^^^^ - | | - | expected `A`, got `B` - | this expression supplies two conflicting concrete types for the same opaque type + | - - expected type parameter ^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A` + | | + | found type parameter + | + = note: expected type parameter `B` + found type parameter `A` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + +error[E0308]: mismatched types + --> $DIR/multiple-def-uses-in-one-fn2.rs:10:63 + | +LL | fn f(a: A, b: B) -> (X, X) { + | - - expected type parameter ^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A` + | | + | found type parameter + | + = note: expected type parameter `B` + found type parameter `A` + = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound + = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr index ad60d186dd36e..536aeb19a71d9 100644 --- a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr +++ b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr @@ -1,24 +1,24 @@ -error[E0700]: hidden type for `WithoutLt` captures lifetime that does not appear in bounds - --> $DIR/nested-tait-hrtb.rs:8:62 +error[E0271]: type mismatch resolving `<() as Trait<'a>>::Assoc == &str` + --> $DIR/nested-tait-hrtb.rs:8:20 | -LL | type WithoutLt = impl Sized; - | ---------- opaque type defined here -LL | #[define_opaque(WithoutLt)] LL | fn without_lt() -> impl for<'a> Trait<'a, Assoc = WithoutLt> {} - | -- ^^ - | | - | hidden type `&'a str` captures the lifetime `'a` as defined here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<() as Trait<'a>>::Assoc == &str` + | +note: types differ + --> $DIR/nested-tait-hrtb.rs:4:42 + | +LL | impl<'a> Trait<'a> for () { type Assoc = &'a str; } + | ^^^^^^^ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/nested-tait-hrtb.rs:14:60 +error[E0275]: overflow evaluating the requirement `with_lt::{opaque#0} == ()` + --> $DIR/nested-tait-hrtb.rs:14:17 | -LL | type WithLt<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... LL | fn with_lt() -> impl for<'a> Trait<'a, Assoc = WithLt<'a>> {} - | ^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`nested_tait_hrtb`) error: aborting due to 2 previous errors -Some errors have detailed explanations: E0700, E0792. -For more information about an error, try `rustc --explain E0700`. +Some errors have detailed explanations: E0271, E0275. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr index be7aec92312a1..2c3424a53643a 100644 --- a/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr +++ b/tests/ui/type-alias-impl-trait/nested-tait-inference3.stderr @@ -1,15 +1,11 @@ -error: item does not constrain `FooX::{opaque#0}` - --> $DIR/nested-tait-inference3.rs:13:4 +error[E0282]: type annotations needed + --> $DIR/nested-tait-inference3.rs:13:13 | LL | fn foo() -> impl Foo { - | ^^^ + | ^^^^^^^^^^^^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/nested-tait-inference3.rs:6:13 - | -LL | type FooX = impl Debug; - | ^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/nested.stderr b/tests/ui/type-alias-impl-trait/nested.stderr index 9ac0fe5302be9..9c8ec373318d2 100644 --- a/tests/ui/type-alias-impl-trait/nested.stderr +++ b/tests/ui/type-alias-impl-trait/nested.stderr @@ -1,15 +1,10 @@ -error: item does not constrain `Foo::{opaque#0}` - --> $DIR/nested.rs:11:4 +error[E0282]: type annotations needed + --> $DIR/nested.rs:11:13 | LL | fn bar() -> Bar { - | ^^^ + | ^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/nested.rs:3:12 - | -LL | type Foo = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error[E0277]: `Bar` doesn't implement `Debug` --> $DIR/nested.rs:17:22 @@ -23,4 +18,5 @@ LL | println!("{:?}", bar()); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0282. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr index aabae31577759..7a5d7a5c352f2 100644 --- a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr +++ b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.stderr @@ -1,32 +1,11 @@ -error: item does not constrain `Foo::{opaque#0}` - --> $DIR/nested_type_alias_impl_trait.rs:14:8 +error[E0282]: type annotations needed + --> $DIR/nested_type_alias_impl_trait.rs:14:28 | LL | pub fn get_foot(_: Foo) -> Foot { - | ^^^^^^^^ + | ^^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/nested_type_alias_impl_trait.rs:5:16 - | -LL | pub type Foo = impl Debug; - | ^^^^^^^^^^ - -error: opaque type's hidden type cannot be another opaque type from the same scope - --> $DIR/nested_type_alias_impl_trait.rs:16:5 - | -LL | get_foo() - | ^^^^^^^^^ one of the two opaque types used here has to be outside its defining scope - | -note: opaque type whose hidden type is being assigned - --> $DIR/nested_type_alias_impl_trait.rs:6:17 - | -LL | pub type Foot = impl Debug; - | ^^^^^^^^^^ -note: opaque type being used as hidden type - --> $DIR/nested_type_alias_impl_trait.rs:5:16 - | -LL | pub type Foo = impl Debug; - | ^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque -error: aborting due to 2 previous errors +error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr index c9646a4e9a4d0..56608ae984535 100644 --- a/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr +++ b/tests/ui/type-alias-impl-trait/no_inferrable_concrete_type.stderr @@ -1,15 +1,10 @@ -error: item does not constrain `Foo::{opaque#0}` - --> $DIR/no_inferrable_concrete_type.rs:10:8 +error[E0282]: type annotations needed + --> $DIR/no_inferrable_concrete_type.rs:10:15 | LL | pub fn bar(x: Foo) -> Foo { - | ^^^ + | ^^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/no_inferrable_concrete_type.rs:6:16 - | -LL | pub type Foo = impl Copy; - | ^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/no_inferrable_concrete_type.rs:17:22 @@ -22,4 +17,5 @@ LL | let _: Foo = std::mem::transmute(0u8); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0512`. +Some errors have detailed explanations: E0282, E0512. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/non-defining-method.stderr b/tests/ui/type-alias-impl-trait/non-defining-method.stderr index 22f173b5be9fb..02ad4dc49c5ff 100644 --- a/tests/ui/type-alias-impl-trait/non-defining-method.stderr +++ b/tests/ui/type-alias-impl-trait/non-defining-method.stderr @@ -10,11 +10,21 @@ note: for this opaque type LL | type Bar = impl Sized; | ^^^^^^^^^^ -error[E0792]: expected generic type parameter, found `u32` - --> $DIR/non-defining-method.rs:16:17 +error: item does not constrain `<() as Foo>::Bar::{opaque#0}` + --> $DIR/non-defining-method.rs:16:8 + | +LL | fn foo() -> Self::Bar {} + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/non-defining-method.rs:15:19 | LL | type Bar = impl Sized; - | - this generic parameter must be used with a generic type parameter + | ^^^^^^^^^^ +note: this use of `<() as Foo>::Bar` does not have unique universal generic arguments + --> $DIR/non-defining-method.rs:16:17 + | LL | fn foo() -> Self::Bar {} | ^^^^^^^^^^^^^^ diff --git a/tests/ui/type-alias-impl-trait/param_mismatch.stderr b/tests/ui/type-alias-impl-trait/param_mismatch.stderr index 07a8ce38f9808..b18790d5ebf12 100644 --- a/tests/ui/type-alias-impl-trait/param_mismatch.stderr +++ b/tests/ui/type-alias-impl-trait/param_mismatch.stderr @@ -1,12 +1,11 @@ -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/param_mismatch.rs:13:5 +error[E0275]: overflow evaluating the requirement `test::{opaque#0} == for<'a> fn(&'a str) -> &'a str {id}` + --> $DIR/param_mismatch.rs:12:21 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (s, id) - | ^^^^^^^ +LL | fn test(s: &str) -> (Opaque<'_>, impl Fn(&str) -> Opaque<'_>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`param_mismatch`) error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/param_mismatch2.stderr b/tests/ui/type-alias-impl-trait/param_mismatch2.stderr index 5c8a8af6501e9..7cab2cdd1064f 100644 --- a/tests/ui/type-alias-impl-trait/param_mismatch2.stderr +++ b/tests/ui/type-alias-impl-trait/param_mismatch2.stderr @@ -1,23 +1,11 @@ -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/param_mismatch2.rs:14:5 +error[E0275]: overflow evaluating the requirement `test::{opaque#0} == for<'a> fn(&'a str) -> &'a str {id}` + --> $DIR/param_mismatch2.rs:13:21 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (id, id) - | ^^^^^^^^ - -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/param_mismatch2.rs:14:5 - | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (id, id) - | ^^^^^^^^ +LL | fn test(s: &str) -> (impl Fn(&str) -> Opaque<'_>, impl Fn(&str) -> Opaque<'_>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`param_mismatch2`) -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/param_mismatch3.stderr b/tests/ui/type-alias-impl-trait/param_mismatch3.stderr index 76be07ce38f5e..de0e2f7f5425a 100644 --- a/tests/ui/type-alias-impl-trait/param_mismatch3.stderr +++ b/tests/ui/type-alias-impl-trait/param_mismatch3.stderr @@ -1,30 +1,19 @@ -error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/param_mismatch3.rs:14:5 +error[E0275]: overflow evaluating the requirement `test::{opaque#0} == for<'a, 'b> fn((&'a str, &'b str)) -> (_, _) {id2}` + --> $DIR/param_mismatch3.rs:13:14 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | id2 - | ^^^ - -error[E0792]: expected generic lifetime parameter, found `'b` - --> $DIR/param_mismatch3.rs:14:5 +LL | fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | id2 - | ^^^ + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`param_mismatch3`) -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/param_mismatch3.rs:27:5 +error[E0275]: overflow evaluating the requirement `test2::{opaque#0} == for<'a> fn(&'a str) -> &'a str {id}` + --> $DIR/param_mismatch3.rs:26:22 + | +LL | fn test2(s: &str) -> (impl Fn(&str) -> Opaque2<'_>, Opaque2<'_>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | type Opaque2<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (id, s) - | ^^^^^^^ + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`param_mismatch3`) -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr index 847f1cc6c2eb6..b8a9e88ccd236 100644 --- a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr +++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr @@ -1,9 +1,9 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-fn-tait.rs:15:6 +error[E0308]: mismatched types + --> $DIR/recursive-fn-tait.rs:17:5 | -LL | ) -> Diff { - | ^^^^ +LL | move |x: usize| m(n(x)) + | ^^^^^^^^^^^^^^^^^^^^^^^ recursive type with infinite-size name error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr index 837df7f5d4340..5bfe554cec04f 100644 --- a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr +++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr @@ -1,9 +1,17 @@ -error[E0720]: cannot resolve opaque type - --> $DIR/recursive-tait-conflicting-defn-2.rs:15:13 +error[E0308]: mismatched types + --> $DIR/recursive-tait-conflicting-defn-2.rs:17:5 | LL | fn bad() -> Op { - | ^^ + | -- expected `_` because of return type +LL | +LL | transform::() + | ^^^^^^^^^^^^^^^^^ recursive type with infinite-size name + | +help: try using a conversion method + | +LL | transform::().to_string() + | ++++++++++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr index c7a3381d61588..c4d13b38a4102 100644 --- a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr +++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr @@ -1,9 +1,40 @@ -error[E0720]: cannot resolve opaque type +warning: overflow evaluating the requirement `TestImpl == B>>>>>>>>>>` --> $DIR/recursive-tait-conflicting-defn.rs:25:22 | LL | fn make_option2() -> Option { | ^^^^^^^^^^^^^^^^ + | + = note: which requires `TestImpl::{opaque#0} == B>>>>>>>>>>` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: which requires `B>>>>>>>>>>: Test` + = note: and so on... + = help: consider adding a manual `impl` of auto traits like `Send` for intermediate types, if auto traits are involved + = help: or consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_tait_conflicting_defn`) + = note: this lint is attached to the whole crate and can't be disabled on a per-function basis + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #159228 + = note: `#[warn(recursion_depth_exceeding_limit)]` (part of `#[warn(future_incompatible)]`) on by default + +error[E0275]: overflow assigning `B>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `B>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/recursive-tait-conflicting-defn.rs:27:17 + | +LL | let inner = make_option().unwrap(); + | ^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_tait_conflicting_defn`) -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0720`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.stderr b/tests/ui/type-alias-impl-trait/self-referential-3.stderr index 7bc4c6def624d..2cdac0dcfe59d 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-3.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-3.stderr @@ -1,20 +1,18 @@ -error[E0277]: can't compare `&i32` with `Bar<'a, 'b>` - --> $DIR/self-referential-3.rs:6:31 +error: item does not constrain `Bar::{opaque#0}` + --> $DIR/self-referential-3.rs:6:4 | LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { - | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'a, 'b>` -LL | -LL | i - | - return type was inferred to be `&i32` here + | ^^^ | - = help: the trait `PartialEq>` is not implemented for `&i32` -help: the trait `PartialEq` is implemented for `i32` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - ::: $SRC_DIR/core/src/cmp.rs:LL:COL + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/self-referential-3.rs:3:20 | - = note: in this macro invocation - = note: this error originates in the macro `impl_partial_eq_for_primitive` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | type Bar<'a, 'b> = impl PartialEq> + std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `Bar<'_, '_> == _` -For more information about this error, try `rustc --explain E0277`. +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/self-referential-4.stderr b/tests/ui/type-alias-impl-trait/self-referential-4.stderr index 76c5611906d34..0a8d926a633ce 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-4.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-4.stderr @@ -1,51 +1,54 @@ -error[E0277]: can't compare `&i32` with `Bar<'b, 'static>` - --> $DIR/self-referential-4.rs:6:31 +error: item does not constrain `Bar::{opaque#0}` + --> $DIR/self-referential-4.rs:6:4 | LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { - | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'static>` -LL | i - | - return type was inferred to be `&i32` here + | ^^^ | - = help: the trait `PartialEq>` is not implemented for `&i32` -help: the trait `PartialEq` is implemented for `i32` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - ::: $SRC_DIR/core/src/cmp.rs:LL:COL + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/self-referential-4.rs:3:20 | - = note: in this macro invocation - = note: this error originates in the macro `impl_partial_eq_for_primitive` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | type Bar<'a, 'b> = impl PartialEq> + std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: can't compare `&i32` with `Foo<'static, 'b>` - --> $DIR/self-referential-4.rs:13:31 +error[E0275]: overflow evaluating the requirement `Bar<'_, '_> == _` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`self_referential_4`) + +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/self-referential-4.rs:13:4 | LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { - | ^^^^^^^^^^^ no implementation for `&i32 == Foo<'static, 'b>` -LL | i - | - return type was inferred to be `&i32` here + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/self-referential-4.rs:10:20 | - = help: the trait `PartialEq>` is not implemented for `&i32` -help: the trait `PartialEq` is implemented for `i32` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +LL | type Foo<'a, 'b> = impl PartialEq> + std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Foo<'_, '_> == _` | - = note: in this macro invocation - = note: this error originates in the macro `impl_partial_eq_for_primitive` (in Nightly builds, run with -Z macro-backtrace for more info) + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`self_referential_4`) -error[E0277]: can't compare `&i32` with `Moo<'static, 'a>` - --> $DIR/self-referential-4.rs:20:31 +error: item does not constrain `Moo::{opaque#0}` + --> $DIR/self-referential-4.rs:20:4 | LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { - | ^^^^^^^^^^^ no implementation for `&i32 == Moo<'static, 'a>` -LL | i - | - return type was inferred to be `&i32` here + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/self-referential-4.rs:17:20 | - = help: the trait `PartialEq>` is not implemented for `&i32` -help: the trait `PartialEq` is implemented for `i32` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - ::: $SRC_DIR/core/src/cmp.rs:LL:COL +LL | type Moo<'a, 'b> = impl PartialEq> + std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Moo<'_, '_> == _` | - = note: in this macro invocation - = note: this error originates in the macro `impl_partial_eq_for_primitive` (in Nightly builds, run with -Z macro-backtrace for more info) + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`self_referential_4`) -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/self-referential.stderr b/tests/ui/type-alias-impl-trait/self-referential.stderr index 62d85466cde1a..7b3dac4b1bc34 100644 --- a/tests/ui/type-alias-impl-trait/self-referential.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential.stderr @@ -1,54 +1,48 @@ -error[E0277]: can't compare `&i32` with `Bar<'b, 'a>` - --> $DIR/self-referential.rs:6:31 +error: item does not constrain `Bar::{opaque#0}` + --> $DIR/self-referential.rs:6:4 | LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { - | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'a>` -LL | -LL | i - | - return type was inferred to be `&i32` here - | - = help: the trait `PartialEq>` is not implemented for `&i32` -help: the trait `PartialEq` is implemented for `i32` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | - = note: in this macro invocation - = note: this error originates in the macro `impl_partial_eq_for_primitive` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/self-referential.rs:3:20 + | +LL | type Bar<'a, 'b> = impl PartialEq> + std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Bar<'_, '_> == _` -error[E0277]: can't compare `&i32` with `(i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)` - --> $DIR/self-referential.rs:14:31 +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/self-referential.rs:14:4 | LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { - | ^^^^^^^^^^^ no implementation for `&i32 == (i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)` -LL | -LL | (42, i) - | ------- return type was inferred to be `(i32, &i32)` here - | - = help: the trait `PartialEq<(i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)>` is not implemented for `&i32` -help: the trait `PartialEq` is implemented for `i32` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | - = note: in this macro invocation - = note: this error originates in the macro `impl_partial_eq_for_primitive` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/self-referential.rs:11:26 + | +LL | type Foo<'a, 'b> = (i32, impl PartialEq> + std::fmt::Debug); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)` - --> $DIR/self-referential.rs:22:31 +error[E0275]: overflow evaluating the requirement `Foo<'_, '_> == _` + +error: item does not constrain `Moo::{opaque#0}` + --> $DIR/self-referential.rs:22:4 | LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { - | ^^^^^^^^^^^ no implementation for `&i32 == (i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)` -LL | -LL | (42, i) - | ------- return type was inferred to be `(i32, &i32)` here - | - = help: the trait `PartialEq<(i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)>` is not implemented for `&i32` -help: the trait `PartialEq` is implemented for `i32` - --> $SRC_DIR/core/src/cmp.rs:LL:COL - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | - = note: in this macro invocation - = note: this error originates in the macro `impl_partial_eq_for_primitive` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/self-referential.rs:19:26 + | +LL | type Moo<'a, 'b> = (i32, impl PartialEq> + std::fmt::Debug); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Moo<'_, '_> == _` -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr index 12aa94386dcbb..0e98fa3816ca9 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fns.stderr @@ -1,15 +1,11 @@ -error: item does not constrain `TE::{opaque#0}` - --> $DIR/type-alias-impl-trait-fns.rs:20:4 +error[E0282]: type annotations needed + --> $DIR/type-alias-impl-trait-fns.rs:20:14 | LL | fn bla2() -> TE { - | ^^^^ + | ^^ cannot infer type | - = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` -note: this opaque type is supposed to be constrained - --> $DIR/type-alias-impl-trait-fns.rs:25:11 - | -LL | type TE = impl MyTrait; - | ^^^^^^^^^^^^ + = note: cannot infer type of hidden type of opaque error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr index 5f9c56f1ca9d0..2f9c90d783106 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-unconstrained-lifetime.stderr @@ -4,16 +4,15 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, LL | impl<'a, I: Iterator> Trait for (i32, I) { | ^^ unconstrained lifetime parameter -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/type-alias-impl-trait-unconstrained-lifetime.rs:14:9 +error[E0275]: overflow evaluating the requirement `<(i32, I) as Trait>::Associated == (i32, _)` + --> $DIR/type-alias-impl-trait-unconstrained-lifetime.rs:13:22 | -LL | impl<'a, I: Iterator> Trait for (i32, I) { - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | (0_i32, [0_i32].iter().copied()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn into(self) -> Self::Associated { + | ^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`type_alias_impl_trait_unconstrained_lifetime`) error: aborting due to 2 previous errors -Some errors have detailed explanations: E0207, E0792. +Some errors have detailed explanations: E0207, E0275. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr index ee8922b673e2f..8ed3ff842b051 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.stderr @@ -1,9 +1,18 @@ -error[E0275]: overflow evaluating the requirement `>::Output == Foo` - --> $DIR/type-alias-impl-trait-with-cycle-error-1.rs:6:21 +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/type-alias-impl-trait-with-cycle-error-1.rs:6:4 | LL | fn crash(x: Foo) -> Foo { - | ^^^ + | ^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/type-alias-impl-trait-with-cycle-error-1.rs:3:12 + | +LL | type Foo = impl Fn() -> Foo; + | ^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Foo == _` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr index 40bd6517c06d8..443e5b01bd996 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.stderr @@ -1,9 +1,18 @@ -error[E0275]: overflow evaluating the requirement `>::Item == Foo` - --> $DIR/type-alias-impl-trait-with-cycle-error-2.rs:9:21 +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/type-alias-impl-trait-with-cycle-error-2.rs:9:4 | LL | fn crash(x: Foo) -> Foo { - | ^^^ + | ^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/type-alias-impl-trait-with-cycle-error-2.rs:7:12 + | +LL | type Foo = impl Bar; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Foo == _` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr index f9e26fde1bda8..28b8f932a29d8 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.stderr @@ -1,9 +1,18 @@ -error[E0275]: overflow evaluating the requirement ` as FnOnce<()>>::Output == Foo<'a>` - --> $DIR/type-alias-impl-trait-with-cycle-error-3.rs:5:40 +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/type-alias-impl-trait-with-cycle-error-3.rs:5:4 | LL | fn crash<'a>(_: &'a (), x: Foo<'a>) -> Foo<'a> { - | ^^^^^^^ + | ^^^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/type-alias-impl-trait-with-cycle-error-3.rs:3:16 + | +LL | type Foo<'a> = impl Fn() -> Foo<'a>; + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Foo<'_> == _` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-4.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-4.stderr index 99646aa4d1b2c..515cdd2668e8f 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-4.stderr +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-4.stderr @@ -1,27 +1,46 @@ -error[E0275]: overflow evaluating the requirement `Ty: Id` +error[E0275]: overflow evaluating the requirement `Ty == _` --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:11:1 | LL | type Ty | ^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Ty == _` + --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:15:16 | -note: required by a bound on the type alias `Ty` - --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:13:9 +LL | fn define() -> Ty {} + | ^^ + +error[E0275]: overflow evaluating the requirement `Ty: Sized` + --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:15:16 | -LL | Ty: Id, - | ^^^^^^^^^^^^^^ required by this bound +LL | fn define() -> Ty {} + | ^^ + | + = note: the return type of a function must have a statically known size -error[E0275]: overflow evaluating the requirement `Ty: Id` +error[E0275]: overflow evaluating whether `Ty` is well-formed --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:15:16 | LL | fn define() -> Ty {} | ^^ + +error: unconstrained opaque type + --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:14:3 | -note: required by a bound on the type alias `Ty` - --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:13:9 +LL | = impl Sized; + | ^^^^^^^^^^ | -LL | Ty: Id, - | ^^^^^^^^^^^^^^ required by this bound + = note: `Ty` must be used in combination with a concrete type within the same crate + +error[E0271]: type mismatch resolving `Ty == ()` + --> $DIR/type-alias-impl-trait-with-cycle-error-4.rs:15:16 + | +LL | fn define() -> Ty {} + | ^^ types differ + +error[E0275]: overflow evaluating the requirement `Ty == _` -error: aborting due to 2 previous errors +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0275`. +Some errors have detailed explanations: E0271, E0275. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr index 549e3bc8dc146..907a06dd46162 100644 --- a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr +++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr @@ -1,10 +1,10 @@ -error[E0004]: non-exhaustive patterns: type `Tait` is non-empty +error[E0004]: non-exhaustive patterns: type `u8` is non-empty --> $DIR/unconstrained-due-to-bad-pattern.rs:9:15 | LL | match empty_opaque() {} | ^^^^^^^^^^^^^^ | - = note: the matched value is of type `Tait` + = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | LL ~ match empty_opaque() { diff --git a/tests/ui/type-alias-impl-trait/under-binder.stderr b/tests/ui/type-alias-impl-trait/under-binder.stderr index 0589f9ae11cd1..3433e37f22e61 100644 --- a/tests/ui/type-alias-impl-trait/under-binder.stderr +++ b/tests/ui/type-alias-impl-trait/under-binder.stderr @@ -1,12 +1,12 @@ -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/under-binder.rs:7:5 +error[E0282]: type annotations needed + --> $DIR/under-binder.rs:6:38 | -LL | type Opaque<'a> = impl Sized + 'a; - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | f - | ^ +LL | fn test(f: fn(u8)) -> fn(Opaque<'_>) { + | ______________________________________^ +LL | | f +LL | | } + | |_^ cannot infer type error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0792`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr index e05c3094d53a1..1ba49590811b2 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr +++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: Trait` is not satisfied - --> $DIR/underconstrained_generic.rs:23:5 + --> $DIR/underconstrained_generic.rs:22:1 | -LL | () - | ^^ the trait `Trait` is not implemented for `T` +LL | fn _defining_use() -> Converter { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | note: required for `()` to implement `ProofForConversion` --> $DIR/underconstrained_generic.rs:13:16 diff --git a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr index 6a1f2b49397a9..8efd9a8e9a964 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr +++ b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr @@ -1,20 +1,15 @@ -error[E0491]: in type `&'b &'a ()`, reference has a longer lifetime than the data it references - --> $DIR/underconstrained_lifetime.rs:20:5 +error[E0477]: the type `&'a ()` does not fulfill the required lifetime + --> $DIR/underconstrained_lifetime.rs:19:1 | -LL | x - | ^ +LL | fn _defining_use<'a, 'b>(x: &'b &'a ()) -> Converter<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'b` as defined here +note: type must outlive the lifetime `'b` as defined here --> $DIR/underconstrained_lifetime.rs:15:20 | LL | type Converter<'a, 'b> = impl ProofForConversion<'a, 'b>; | ^^ -note: but the referenced data is only valid for the lifetime `'a` as defined here - --> $DIR/underconstrained_lifetime.rs:15:16 - | -LL | type Converter<'a, 'b> = impl ProofForConversion<'a, 'b>; - | ^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0491`. +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr index b52ed3f43f482..c96861efe5f89 100644 --- a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr +++ b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/wf-check-fn-def.rs:14:5 + --> $DIR/wf-check-fn-def.rs:10:1 | -LL | mop // NOTE: no function pointer, but function zst item - | ^^^ the trait `Bar` is not implemented for `B` +LL | fn foo() -> FooFn { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` | note: required by a bound in `mop` --> $DIR/wf-check-fn-def.rs:11:15 diff --git a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr index 3fd1666214654..99eb373c68da4 100644 --- a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr +++ b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr @@ -1,30 +1,25 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/wf-in-associated-type.rs:41:13 + --> $DIR/wf-in-associated-type.rs:40:9 | LL | impl<'a, T> Trait<'a, T> for () { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... -... -LL | req - | ^^^ ...so that the type `&'a T` will meet its required lifetime bounds... - | -note: ...that is required by this bound - --> $DIR/wf-in-associated-type.rs:39:36 - | LL | type Opaque = impl Sized + 'a; - | ^^ +LL | fn constrain_opaque(req: &'a T) -> Self::Opaque { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `&'a T` will meet its required lifetime bounds + | help: consider adding an explicit lifetime bound | LL | impl<'a, T: 'a> Trait<'a, T> for () { | ++++ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/wf-in-associated-type.rs:41:13 + --> $DIR/wf-in-associated-type.rs:40:9 | LL | impl<'a, T> Trait<'a, T> for () { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... -... -LL | req - | ^^^ ...so that the reference type `&'a T` does not outlive the data it points at +LL | type Opaque = impl Sized + 'a; +LL | fn constrain_opaque(req: &'a T) -> Self::Opaque { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/type-alias-impl-trait/wf-nested.stderr b/tests/ui/type-alias-impl-trait/wf-nested.stderr index d7ac5146c1e72..25ed6d03f1fb2 100644 --- a/tests/ui/type-alias-impl-trait/wf-nested.stderr +++ b/tests/ui/type-alias-impl-trait/wf-nested.stderr @@ -1,11 +1,11 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/wf-nested.rs:30:35 + --> $DIR/wf-nested.rs:30:1 | LL | fn define() -> OuterOpaque1 {} - | ^^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -13,13 +13,13 @@ LL | fn define() -> OuterOpaque1 {} | +++++++++ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/wf-nested.rs:33:65 + --> $DIR/wf-nested.rs:33:1 | LL | fn define_rpit() -> impl Trait<&'static T, Out = impl Sized> {} - | ^^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -27,13 +27,13 @@ LL | fn define_rpit() -> impl Trait<&'static T, Out = impl Sized> {} | +++++++++ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/wf-nested.rs:42:47 + --> $DIR/wf-nested.rs:42:1 | LL | fn define_nested_rpit() -> OuterOpaque2 {} - | ^^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr index 57e40445c87cf..17a6b8986f1d6 100644 --- a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr +++ b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/wf_check_closures.rs:11:5 + --> $DIR/wf_check_closures.rs:10:1 | -LL | move || bar.bar() - | ^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` +LL | fn foo(bar: B) -> FooFn { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` | note: required by a bound in `foo` --> $DIR/wf_check_closures.rs:10:11 diff --git a/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.stderr b/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.stderr index a8e68a05253b9..1c985668d6c18 100644 --- a/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.stderr +++ b/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.stderr @@ -1,11 +1,15 @@ -error[E0275]: overflow normalizing the type alias `Arr2` +error[E0275]: overflow evaluating the requirement `Arr2 == _` --> $DIR/recursive-lazy-type-alias-ice-152633.rs:12:1 | LL | type Arr2 = [usize; ::ASSOC]; | ^^^^^^^^^ + +error[E0275]: overflow evaluating whether `[usize; ::ASSOC]` is well-formed + --> $DIR/recursive-lazy-type-alias-ice-152633.rs:12:1 | - = note: in case this is a recursive type alias, consider using a struct, enum, or union instead +LL | type Arr2 = [usize; ::ASSOC]; + | ^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/type-inference/direct-self-reference-occurs-check.stderr b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr index 6c522ffac1f7a..df6100eeddf69 100644 --- a/tests/ui/type-inference/direct-self-reference-occurs-check.stderr +++ b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr @@ -1,8 +1,10 @@ -error[E0275]: overflow assigning `Box<_>` to `_` +error[E0275]: overflow assigning `Box>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `Box>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/direct-self-reference-occurs-check.rs:7:18 | LL | f = Box::new(f); | ^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`direct_self_reference_occurs_check`) error: aborting due to 1 previous error diff --git a/tests/ui/type-inference/enum-self-reference-occurs-check.stderr b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr index 3239be51a1766..9e4732af156f7 100644 --- a/tests/ui/type-inference/enum-self-reference-occurs-check.stderr +++ b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr @@ -1,8 +1,10 @@ -error[E0275]: overflow assigning `Clam<_>` to `_` +error[E0275]: overflow assigning `Clam>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `Clam>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/enum-self-reference-occurs-check.rs:11:17 | LL | c = Clam::A(c); | ^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`enum_self_reference_occurs_check`) error: aborting due to 1 previous error diff --git a/tests/ui/type-inference/index-expr-ambiguous-type.stderr b/tests/ui/type-inference/index-expr-ambiguous-type.stderr index 1e2ea9ab32215..7785e6240e928 100644 --- a/tests/ui/type-inference/index-expr-ambiguous-type.stderr +++ b/tests/ui/type-inference/index-expr-ambiguous-type.stderr @@ -15,19 +15,11 @@ LL | let _foo = 0 + [1, 2, 3][bad_idx.into()]; - impl Add for i32; - impl Add<&i32> for i32; -error[E0283]: type annotations needed - --> $DIR/index-expr-ambiguous-type.rs:21:34 +error[E0284]: type annotations needed: cannot satisfy `_: '_` + --> $DIR/index-expr-ambiguous-type.rs:21:16 | LL | let _foo = [1, 2, 3][bad_idx.into()]; - | ^^^^ - | - = note: the type must implement `From` - = note: required for `u8` to implement `Into<_>` -help: try using a fully qualified path to specify the expected types - | -LL - let _foo = [1, 2, 3][bad_idx.into()]; -LL + let _foo = [1, 2, 3][>::into(bad_idx)]; - | + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `_: '_` error[E0369]: cannot add `_` to `bool` --> $DIR/index-expr-ambiguous-type.rs:32:21 @@ -57,14 +49,12 @@ LL | let _foo = 1u32 << [0u8][bad_idx.into()]; = note: cannot satisfy `>::Output == _` = note: cannot satisfy `u32: Shl<_>` -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/index-expr-ambiguous-type.rs:50:45 | LL | let _foo = String::new() + [""][bad_idx.into()]; | ^^^^ | - = note: the type must implement `From` - = note: required for `u8` to implement `Into<_>` help: try using a fully qualified path to specify the expected types | LL - let _foo = String::new() + [""][bad_idx.into()]; @@ -73,5 +63,5 @@ LL + let _foo = String::new() + [""][>::into(bad_idx)]; error: aborting due to 7 previous errors -Some errors have detailed explanations: E0282, E0283, E0284, E0369. +Some errors have detailed explanations: E0282, E0284, E0369. For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/type-inference/infinite-type-occurs-check.stderr b/tests/ui/type-inference/infinite-type-occurs-check.stderr index 9cb8bb917962e..bcba5af4486f0 100644 --- a/tests/ui/type-inference/infinite-type-occurs-check.stderr +++ b/tests/ui/type-inference/infinite-type-occurs-check.stderr @@ -1,8 +1,10 @@ -error[E0275]: overflow assigning `Box<_>` to `_` +error[E0275]: overflow assigning `Box>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to `Box>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/infinite-type-occurs-check.rs:9:9 | LL | g = f; | ^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`infinite_type_occurs_check`) error: aborting due to 1 previous error diff --git a/tests/ui/type-inference/issue-30225.stderr b/tests/ui/type-inference/issue-30225.stderr index cd2d9e2bea853..b4988ad1fb3c5 100644 --- a/tests/ui/type-inference/issue-30225.stderr +++ b/tests/ui/type-inference/issue-30225.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-30225.rs:31:9 | LL | u = v; // mark $0 and $1 in a subtype relationship - | ^ expected `A`, found `B` + | ^ expected `B`, found `A` error: aborting due to 1 previous error diff --git a/tests/ui/type-inference/send-with-unspecified-type.stderr b/tests/ui/type-inference/send-with-unspecified-type.stderr index 0d7daed44c0d9..1ff9c348b8703 100644 --- a/tests/ui/type-inference/send-with-unspecified-type.stderr +++ b/tests/ui/type-inference/send-with-unspecified-type.stderr @@ -1,9 +1,27 @@ -error[E0282]: type annotations needed +error[E0283]: type annotations needed --> $DIR/send-with-unspecified-type.rs:13:27 | +LL | spawn(move || { + | ----- required by a bound introduced by this call LL | tx.send(Foo{ foo: PhantomData }); | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `PhantomData` | + = note: the type must implement `Send` +note: required because it appears within the type `PhantomData<_>` + --> $SRC_DIR/core/src/marker.rs:LL:COL +note: required because it appears within the type `Foo<_>` + --> $DIR/send-with-unspecified-type.rs:7:16 + | +LL | struct Foo {foo: PhantomData} + | ^^^^^^^^^^^^^^^^^^^ required by this field + = note: required for `std::sync::mpsc::Sender>` to implement `Send` +note: required because `tx` is used within this closure + --> $DIR/send-with-unspecified-type.rs:13:9 + | +LL | tx.send(Foo{ foo: PhantomData }); + | ^^ +note: required by a bound in `spawn` + --> $SRC_DIR/std/src/thread/functions.rs:LL:COL help: consider specifying a concrete type for the type parameter `T` | LL | tx.send(Foo{ foo: PhantomData:: }); @@ -11,4 +29,4 @@ LL | tx.send(Foo{ foo: PhantomData:: }); error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/type-inference/swap-with-unspecified-type.stderr b/tests/ui/type-inference/swap-with-unspecified-type.stderr index eaaed559ebf16..169a7ecd5bd0c 100644 --- a/tests/ui/type-inference/swap-with-unspecified-type.stderr +++ b/tests/ui/type-inference/swap-with-unspecified-type.stderr @@ -1,9 +1,9 @@ -error[E0282]: type annotations needed - --> $DIR/swap-with-unspecified-type.rs:7:13 +error[E0284]: type annotations needed: cannot satisfy `_: '_` + --> $DIR/swap-with-unspecified-type.rs:7:20 | LL | unsafe {swap::<&mut _>(transmute(&a), transmute(&b))}; - | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `swap` + | ^^^^^^ cannot satisfy `_: '_` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr b/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr index 1d88e2ce8546c..048af587d3389 100644 --- a/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr +++ b/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr @@ -1,14 +1,15 @@ -error[E0282]: type annotations needed +error[E0284]: type annotations needed: cannot satisfy `_: '_` --> $DIR/type-inference-none-in-generic-ref.rs:8:5 | LL | S { o: &None }; - | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `S` + | ^ cannot satisfy `_: '_` | -help: consider specifying a concrete type for the type parameter `T` +note: required by a bound in `S` + --> $DIR/type-inference-none-in-generic-ref.rs:3:17 | -LL | S:: { o: &None }; - | ++++++++++++++ +LL | struct S<'a, T: 'a> { + | ^^ required by this bound in `S` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/type/pattern_types/derives_fail.stderr b/tests/ui/type/pattern_types/derives_fail.stderr index a6814d8cba2a0..6f5041e0bd046 100644 --- a/tests/ui/type/pattern_types/derives_fail.stderr +++ b/tests/ui/type/pattern_types/derives_fail.stderr @@ -19,14 +19,14 @@ LL | struct Nanoseconds(NanoI32); note: required by a bound in `std::cmp::AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL -error[E0277]: `pattern_type!(i32 is 0..=999999999)` doesn't implement `Debug` +error[E0277]: `&pattern_type!(i32 is 0..=999999999)` doesn't implement `Debug` --> $DIR/derives_fail.rs:11:20 | LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)] | ----- in this derive macro expansion LL | #[repr(transparent)] LL | struct Nanoseconds(NanoI32); - | ^^^^^^^ the trait `Debug` is not implemented for `pattern_type!(i32 is 0..=999999999)` + | ^^^^^^^ within `&pattern_type!(i32 is 0..=999999999)`, the trait `Debug` is not implemented for `&pattern_type!(i32 is 0..=999999999)` error[E0277]: the trait bound `pattern_type!(i32 is 0..=999999999): Ord` is not satisfied --> $DIR/derives_fail.rs:11:20 diff --git a/tests/ui/type/type-check/issue-40294.stderr b/tests/ui/type/type-check/issue-40294.stderr index 178ea69563a0a..7a522d963667e 100644 --- a/tests/ui/type/type-check/issue-40294.stderr +++ b/tests/ui/type/type-check/issue-40294.stderr @@ -1,17 +1,3 @@ -error[E0283]: type annotations needed: cannot satisfy `&'a T: Foo` - --> $DIR/issue-40294.rs:6:19 - | -LL | where &'a T : Foo, - | ^^^ - | -note: multiple `impl`s or `where` clauses satisfying `&'a T: Foo` found - --> $DIR/issue-40294.rs:6:19 - | -LL | where &'a T : Foo, - | ^^^ -LL | &'b T : Foo - | ^^^ - error[E0283]: type annotations needed: cannot satisfy `&T: Foo` --> $DIR/issue-40294.rs:9:7 | @@ -26,6 +12,6 @@ LL | where &'a T : Foo, LL | &'b T : Foo | ^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/typeck/associated-type-ice-recovery-66353.stderr b/tests/ui/typeck/associated-type-ice-recovery-66353.stderr index 30740f66dcd90..8bae27d77ae14 100644 --- a/tests/ui/typeck/associated-type-ice-recovery-66353.stderr +++ b/tests/ui/typeck/associated-type-ice-recovery-66353.stderr @@ -10,6 +10,18 @@ help: this trait has no implementations, consider adding one LL | trait _A { | ^^^^^^^^ +error[E0277]: the trait bound `(): _A` is not satisfied + --> $DIR/associated-type-ice-recovery-66353.rs:13:5 + | +LL | _Func::< <() as _A>::AssocT >::func(()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/associated-type-ice-recovery-66353.rs:8:1 + | +LL | trait _A { + | ^^^^^^^^ + error[E0277]: the trait bound `(): _Func<_>` is not satisfied --> $DIR/associated-type-ice-recovery-66353.rs:13:41 | @@ -24,6 +36,6 @@ help: this trait has no implementations, consider adding one LL | trait _Func { | ^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/typeck/bad-index-modulo-higher-ranked-regions.stderr b/tests/ui/typeck/bad-index-modulo-higher-ranked-regions.stderr index 93c370fd893e3..14baede693176 100644 --- a/tests/ui/typeck/bad-index-modulo-higher-ranked-regions.stderr +++ b/tests/ui/typeck/bad-index-modulo-higher-ranked-regions.stderr @@ -1,9 +1,25 @@ -error[E0608]: cannot index into a value of type `Map<[usize; 1], {closure@$DIR/bad-index-modulo-higher-ranked-regions.rs:23:32: 23:45}>` - --> $DIR/bad-index-modulo-higher-ranked-regions.rs:23:55 +error[E0277]: expected an `FnOnce(&[usize; 1], usize)` closure, found `{closure@$DIR/bad-index-modulo-higher-ranked-regions.rs:23:32: 23:45}` + --> $DIR/bad-index-modulo-higher-ranked-regions.rs:23:5 | LL | Map { inner: [0_usize], f: |_, i: usize| 1_usize }[0]; - | ^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&[usize; 1], usize)` closure, found `{closure@$DIR/bad-index-modulo-higher-ranked-regions.rs:23:32: 23:45}` + | +help: the trait `for<'a> FnOnce(&'a [usize; 1], usize)` is not implemented for closure `{closure@$DIR/bad-index-modulo-higher-ranked-regions.rs:23:32: 23:45}` + --> $DIR/bad-index-modulo-higher-ranked-regions.rs:23:32 + | +LL | Map { inner: [0_usize], f: |_, i: usize| 1_usize }[0]; + | ^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'a> fn(&'a _, _)` + found a closure with signature `fn(&_, _)` +note: required for `Map<[usize; 1], {closure@$DIR/bad-index-modulo-higher-ranked-regions.rs:23:32: 23:45}>` to implement `Index` + --> $DIR/bad-index-modulo-higher-ranked-regions.rs:10:17 + | +LL | impl Index for Map + | ^^^^^^^^^^ ^^^^^^^^^ +... +LL | F: FnOnce(&T, Idx) -> Idx, + | --- unsatisfied trait bound introduced here error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0608`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/typeck/derive-sugg-arg-arity.stderr b/tests/ui/typeck/derive-sugg-arg-arity.stderr index 029d8dfdfc79a..cdb85f9a7b1af 100644 --- a/tests/ui/typeck/derive-sugg-arg-arity.stderr +++ b/tests/ui/typeck/derive-sugg-arg-arity.stderr @@ -2,16 +2,14 @@ error[E0599]: the associated function or constant `partial_cmp` exists for struc --> $DIR/derive-sugg-arg-arity.rs:5:23 | LL | pub struct A; - | ------------ associated function or constant `partial_cmp` not found for this struct because it doesn't satisfy `A: Iterator` or `A: PartialOrd<_>` + | ------------ associated function or constant `partial_cmp` not found for this struct because it doesn't satisfy `A: Iterator`, `A: PartialOrd<_>` or `A: PartialOrd` ... LL | _ => match A::partial_cmp() {}, | ^^^^^^^^^^^ associated function or constant cannot be called on `A` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: - `A: PartialOrd<_>` - which is required by `&A: PartialOrd<&_>` - `A: PartialOrd<_>` - which is required by `&mut A: PartialOrd<&mut _>` + `A: PartialOrd` + which is required by `A: PartialOrd<_>` `A: Iterator` which is required by `&mut A: Iterator` note: the trait `Iterator` must be implemented diff --git a/tests/ui/typeck/index-out-of-bounds-on-partial-cmp-ice-114056.stderr b/tests/ui/typeck/index-out-of-bounds-on-partial-cmp-ice-114056.stderr index 47e0d2d90357a..4e929556e1ad2 100644 --- a/tests/ui/typeck/index-out-of-bounds-on-partial-cmp-ice-114056.stderr +++ b/tests/ui/typeck/index-out-of-bounds-on-partial-cmp-ice-114056.stderr @@ -2,14 +2,14 @@ error[E0599]: the method `partial_cmp` exists for reference `&P`, but its tra --> $DIR/index-out-of-bounds-on-partial-cmp-ice-114056.rs:7:14 | LL | struct P(Q); - | ----------- doesn't satisfy `P: Iterator` or `P: PartialOrd<_>` + | ----------- doesn't satisfy `P: Iterator`, `P: PartialOrd<_>` or `P: PartialOrd` ... LL | self.partial_cmp(()) | ^^^^^^^^^^^ method cannot be called on `&P` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: - `P: PartialOrd<_>` - which is required by `&P: PartialOrd<&_>` + `P: PartialOrd` + which is required by `P: PartialOrd<_>` `&P: Iterator` which is required by `&mut &P: Iterator` `P: Iterator` diff --git a/tests/ui/typeck/issue-18937.stderr b/tests/ui/typeck/issue-18937.stderr index 0575751a89624..9ea272ac3ee76 100644 --- a/tests/ui/typeck/issue-18937.stderr +++ b/tests/ui/typeck/issue-18937.stderr @@ -1,14 +1,17 @@ -error[E0276]: impl has stricter requirements than trait +error[E0310]: the parameter type `F` may not live long enough --> $DIR/issue-18937.rs:20:31 | -LL | / fn foo(&mut self, f: F) -LL | | where F: fmt::Debug + 'a, -LL | | Self: Sized; - | |__________________________- definition of `foo` from trait -... -LL | where F: fmt::Debug + 'static, - | ^^^^^^^ impl has extra requirement `F: 'static` +LL | where F: fmt::Debug + 'static, + | ^^^^^^^ + | | + | the parameter type `F` must be valid for the static lifetime... + | ...so that the type `F` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | where F: fmt::Debug + 'static + 'static, + | +++++++++ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0276`. +For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/typeck/issue-31173.stderr b/tests/ui/typeck/issue-31173.stderr index d3935c51d1880..91ed045600e60 100644 --- a/tests/ui/typeck/issue-31173.stderr +++ b/tests/ui/typeck/issue-31173.stderr @@ -36,7 +36,7 @@ LL | .collect(); = note: the following trait bounds were not satisfied: `, {closure@$DIR/issue-31173.rs:7:21: 7:25}> as Iterator>::Item = &_` which is required by `Cloned, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator` - `Cloned, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator` + `, {closure@$DIR/issue-31173.rs:7:21: 7:25}> as Iterator>::Item = &_` which is required by `&mut Cloned, {closure@$DIR/issue-31173.rs:7:21: 7:25}>>: Iterator` error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/main-termination-lifetime-issue-148421.stderr b/tests/ui/typeck/main-termination-lifetime-issue-148421.stderr index 2703d276e41f7..8eaf38da02589 100644 --- a/tests/ui/typeck/main-termination-lifetime-issue-148421.stderr +++ b/tests/ui/typeck/main-termination-lifetime-issue-148421.stderr @@ -1,16 +1,11 @@ -error: implementation of `IsStatic` is not general enough +error[E0478]: lifetime bound not satisfied --> $DIR/main-termination-lifetime-issue-148421.rs:17:14 | LL | fn main() -> Thing { Thing } - | ^^^^^ implementation of `IsStatic` is not general enough + | ^^^^^ | - = note: `IsStatic` would have to be implemented for the type `&'0 ()`, for any lifetime `'0`... - = note: ...but `IsStatic` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1` -note: required for `Thing` to implement `Termination` - --> $DIR/main-termination-lifetime-issue-148421.rs:13:6 - | -LL | impl Termination for Thing where for<'a> &'a (): IsStatic { - | ^^^^^^^^^^^ ^^^^^ -------- unsatisfied trait bound introduced here + = note: but lifetime parameter must outlive the static lifetime error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index be734b2800bde..d4e2d2bd6b1f5 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -4,11 +4,6 @@ error[E0277]: the trait bound `::Base: Functor` is not satisfie LL | input.fmap(f1).fmap(f2) | ^^^^ the trait `Functor` is not implemented for `::Base` | -note: the method call chain might not have had the expected associated types - --> $DIR/method-chain-gats.rs:13:29 - | -LL | fn fmap2(input: T, f1: impl Fn(A) -> B, f2: impl Fn(B) -> C) -> T::Base - | ^ `Base::Base` is `::Base<_>` here note: required by a bound in `Functor::fmap` --> $DIR/method-chain-gats.rs:10:24 | diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index 541de25749e38..1d0cd95adb947 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -16,27 +16,19 @@ help: change the self-receiver type to match the trait LL | fn values(&self) -> Self::Values { | + -error[E0631]: type mismatch in function arguments +error[E0277]: expected an `FnOnce(T)` closure, found `for<'a> fn(&'a _) -> <_ as Insertable>::Values {<_ as Insertable>::values}` --> $DIR/mismatched-map-under-self.rs:12:18 | -LL | fn values(&self) -> Self::Values; - | --------------------------------- found signature defined here -... LL | self.map(Insertable::values).unwrap_or_default() - | --- ^^^^^^^^^^^^^^^^^^ expected due to this + | --- ^^^^^^^^^^^^^^^^^^ expected an `FnOnce(T)` closure, found `for<'a> fn(&'a _) -> <_ as Insertable>::Values {<_ as Insertable>::values}` | | | required by a bound introduced by this call | - = note: expected function signature `fn(T) -> _` - found function signature `fn(&_) -> _` + = help: the trait `FnOnce(T)` is not implemented for fn item `for<'a> fn(&'a _) -> <_ as Insertable>::Values {<_ as Insertable>::values}` note: required by a bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL -help: consider wrapping the function in a closure - | -LL | self.map(|arg0: T| Insertable::values(&arg0)).unwrap_or_default() - | +++++++++ +++++++ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0053, E0631. +Some errors have detailed explanations: E0053, E0277. For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/typeck/self-param-in-fn-item-cast-to-fn-trait.stderr b/tests/ui/typeck/self-param-in-fn-item-cast-to-fn-trait.stderr index f6c2479e1f8e9..ee758f5bc6b52 100644 --- a/tests/ui/typeck/self-param-in-fn-item-cast-to-fn-trait.stderr +++ b/tests/ui/typeck/self-param-in-fn-item-cast-to-fn-trait.stderr @@ -6,5 +6,18 @@ LL | fn baz(&self) {} | = note: associated functions are those in `impl` or `trait` definitions -error: aborting due to 1 previous error +error[E0277]: the trait bound `&for<'a> fn(&'a {type error}) {baz}: CoerceUnsized<&dyn Fn(i32)>` is not satisfied in `for<'a> fn(&'a {type error}) {baz}` + --> $DIR/self-param-in-fn-item-cast-to-fn-trait.rs:6:13 + | +LL | let _ = &baz as &dyn Fn(i32); + | ^^^^ within `for<'a> fn(&'a {type error}) {baz}`, the trait `Fn(i32)` is not implemented for fn item `for<'a> fn(&'a {type error}) {baz}` + | + = note: expected a closure with signature `fn(i32)` + found a closure with signature `fn(&{type error})` + = note: required because it appears within the type `for<'a> fn(&'a {type error}) {baz}` + = note: required for `&for<'a> fn(&'a {type error}) {baz}` to implement `CoerceUnsized<&dyn Fn(i32)>` + = note: required for the cast from `&for<'a> fn(&'a {type error}) {baz}` to `&dyn Fn(i32)` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/typeck/type-inference-for-associated-types-69683.stderr b/tests/ui/typeck/type-inference-for-associated-types-69683.stderr index 4e4c4fc1358f6..0fe896ee60854 100644 --- a/tests/ui/typeck/type-inference-for-associated-types-69683.stderr +++ b/tests/ui/typeck/type-inference-for-associated-types-69683.stderr @@ -5,14 +5,18 @@ LL | 0u16.foo(b); | ^^^ | = note: cannot satisfy `>::Array == [u8; 3]` -note: multiple `impl`s satisfying `u8: Element<_>` found - --> $DIR/type-inference-for-associated-types-69683.rs:6:1 - | -LL | impl Element<()> for T { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | impl, S> Element<[S; 3]> for T { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try using a fully qualified path to specify the expected types + | +LL - 0u16.foo(b); +LL + >::foo(0u16, b); + | + +error[E0275]: overflow evaluating the requirement `u8: Element<_>` + --> $DIR/type-inference-for-associated-types-69683.rs:31:10 + | +LL | 0u16.foo(b); + | ^^^ + | note: required by a bound in `Foo::foo` --> $DIR/type-inference-for-associated-types-69683.rs:16:9 | @@ -23,12 +27,14 @@ LL | u8: Element, LL | { LL | fn foo(self, x: >::Array); | -help: try using a fully qualified path to specify the expected types - | -LL - 0u16.foo(b); -LL + >::foo(0u16, b); + +error[E0275]: overflow evaluating the requirement `u16: Foo<_>` + --> $DIR/type-inference-for-associated-types-69683.rs:31:10 | +LL | 0u16.foo(b); + | ^^^ -error: aborting due to 1 previous error +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0284`. +Some errors have detailed explanations: E0275, E0284. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr index 7b5f7cd9f7033..325b09395002b 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -44,77 +44,69 @@ LL | fn bar(self: &Bar, x: isize) -> isize { = note: type of `self` must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} - | ^^^^^^^ lifetime mismatch + | ^^^^^^^ | - = note: expected reference `&'a Bar<_>` - found reference `&Bar<_>` -note: the anonymous lifetime defined here... +note: lifetime parameter instantiated with the anonymous lifetime defined here --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} | ^^^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} - | ^^^^^^^ lifetime mismatch + | ^^^^^^^ | - = note: expected reference `&'a Bar<_>` - found reference `&Bar<_>` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined here +note: but lifetime parameter must outlive the anonymous lifetime defined here --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} | ^^^^^^^ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/ufcs-explicit-self-bad.rs:40:21 | LL | fn dummy3(self: &&Bar) {} - | ^^^^^^^^ lifetime mismatch + | ^^^^^^^^ | - = note: expected reference `&'a Bar<_>` - found reference `&Bar<_>` -note: the anonymous lifetime defined here... +note: lifetime parameter instantiated with the anonymous lifetime defined here --> $DIR/ufcs-explicit-self-bad.rs:40:22 | LL | fn dummy3(self: &&Bar) {} | ^^^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined here +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -error[E0308]: mismatched `self` parameter type +error[E0478]: lifetime bound not satisfied --> $DIR/ufcs-explicit-self-bad.rs:40:21 | LL | fn dummy3(self: &&Bar) {} - | ^^^^^^^^ lifetime mismatch + | ^^^^^^^^ | - = note: expected reference `&'a Bar<_>` - found reference `&Bar<_>` -note: the lifetime `'a` as defined here... +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined here +note: but lifetime parameter must outlive the anonymous lifetime defined here --> $DIR/ufcs-explicit-self-bad.rs:40:22 | LL | fn dummy3(self: &&Bar) {} @@ -140,5 +132,5 @@ LL | println!("{} {}", bar.foo(2), bar.bar(2)); error: aborting due to 11 previous errors -Some errors have detailed explanations: E0053, E0307, E0308, E0599, E0610. +Some errors have detailed explanations: E0053, E0307, E0478, E0599, E0610. For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.stderr b/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.stderr index a31d99f45d590..7f9a57dc82a4c 100644 --- a/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.stderr +++ b/tests/ui/unboxed-closures/fn-traits-hrtb-coercion.stderr @@ -9,6 +9,57 @@ LL | let _: for<'a> fn(&'a str) -> Str<'a> = Str; = note: expected fn pointer `for<'a> fn(&'a _) -> Str<'a>` found struct constructor `fn(&_) -> Str<'_> {Str::<'_>}` -error: aborting due to 1 previous error +error[E0277]: expected an `FnOnce(&'x str)` closure, found `fn(&str) -> Str<'_> {Str::<'_>}` + --> $DIR/fn-traits-hrtb-coercion.rs:34:10 + | +LL | test(Str); + | ---- ^^^ the trait `for<'x> FnOnce(&'x str)` is not implemented for `fn(&str) -> Str<'_> {Str::<'_>}` + | | + | required by a bound introduced by this call + | + = note: the trait bound `for<'x> fn(&str) -> Str<'_> {Str::<'_>}: FnOnce(&'x str)` is not satisfied +note: required by a bound in `test` + --> $DIR/fn-traits-hrtb-coercion.rs:6:12 + | +LL | fn test FnOnce<(&'x str,)>>(_: F) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test` +help: consider borrowing here + | +LL | test(&Str); + | + +LL | test(&mut Str); + | ++++ + +error[E0277]: expected an `FnOnce(&'x str)` closure, found `Compose fn(&'a str) -> Str<'a> {mk_str}, {closure@$DIR/fn-traits-hrtb-coercion.rs:37:26: 37:29}>` + --> $DIR/fn-traits-hrtb-coercion.rs:37:10 + | +LL | test(Compose(mk_str, |_| {})); + | ---- ^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&'x str)` closure, found `Compose fn(&'a str) -> Str<'a> {mk_str}, {closure@$DIR/fn-traits-hrtb-coercion.rs:37:26: 37:29}>` + | | + | required by a bound introduced by this call + | +help: the trait `for<'x> FnOnce(&'x str)` is not implemented for `Compose fn(&'a str) -> Str<'a> {mk_str}, {closure@$DIR/fn-traits-hrtb-coercion.rs:37:26: 37:29}>` + --> $DIR/fn-traits-hrtb-coercion.rs:8:1 + | +LL | struct Compose(F, G); + | ^^^^^^^^^^^^^^^^^^^^ + = note: expected a closure with signature `for<'x> fn(&'x _)` + found a closure with signature `fn(&_)` +note: this is a known limitation of the trait solver that will be lifted in the future + --> $DIR/fn-traits-hrtb-coercion.rs:37:10 + | +LL | test(Compose(mk_str, |_| {})); + | -----^^^^^^^^^^^^^^^^^^^^^^^- + | | | + | | the trait solver is unable to infer the generic types that should be inferred from this argument + | add turbofish arguments to this call to specify the types manually, even if it's redundant +note: required by a bound in `test` + --> $DIR/fn-traits-hrtb-coercion.rs:6:12 + | +LL | fn test FnOnce<(&'x str,)>>(_: F) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/unboxed-closures/issue-30906.stderr b/tests/ui/unboxed-closures/issue-30906.stderr index 252ee8d85da9d..e90a792629bfb 100644 --- a/tests/ui/unboxed-closures/issue-30906.stderr +++ b/tests/ui/unboxed-closures/issue-30906.stderr @@ -1,15 +1,10 @@ -error: implementation of `FnOnce` is not general enough +error: higher-ranked lifetime error --> $DIR/issue-30906.rs:18:5 | LL | test(Compose(f, |_| {})); | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... - --> $DIR/issue-30906.rs:3:12 - | -LL | fn test FnOnce<(&'x str,)>>(_: F) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test` - = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` + = note: could not prove `for<'x> Compose T, {closure@$DIR/issue-30906.rs:18:21: 18:24}>: FnOnce(&'x str)` error: aborting due to 1 previous error diff --git a/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr b/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr index 488dff646793c..fa673bec0c1a0 100644 --- a/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr +++ b/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr @@ -7,14 +7,19 @@ LL | fn a>(f: F) {} note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -error[E0308]: mismatched types - --> $DIR/non-tupled-arg-mismatch.rs:7:5 +error[E0277]: expected an `Fn` closure, found `{closure@$DIR/non-tupled-arg-mismatch.rs:7:7: 7:17}` + --> $DIR/non-tupled-arg-mismatch.rs:7:7 | LL | a(|_: usize| {}); - | ^^^^^^^^^^^^^^^^ types differ + | - ^^^^^^^^^^^^^ expected an `Fn` closure, found `{closure@$DIR/non-tupled-arg-mismatch.rs:7:7: 7:17}` + | | + | required by a bound introduced by this call | - = note: expected trait `Fn` - found trait `Fn(usize)` +help: the trait `Fn` is not implemented for closure `{closure@$DIR/non-tupled-arg-mismatch.rs:7:7: 7:17}` + --> $DIR/non-tupled-arg-mismatch.rs:7:7 + | +LL | a(|_: usize| {}); + | ^^^^^^^^^^ note: required by a bound in `a` --> $DIR/non-tupled-arg-mismatch.rs:3:9 | @@ -23,5 +28,5 @@ LL | fn a>(f: F) {} error: aborting due to 2 previous errors -Some errors have detailed explanations: E0059, E0308. +Some errors have detailed explanations: E0059, E0277. For more information about an error, try `rustc --explain E0059`. diff --git a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr index 01b581cadaa4f..0b6811605def1 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr @@ -1,13 +1,16 @@ -error[E0644]: closure/coroutine type that references itself +error[E0277]: expected an `FnOnce(Option<{closure@$DIR/unboxed-closure-no-cyclic-sig.rs:8:7: 8:10}>)` closure, found `{closure@$DIR/unboxed-closure-no-cyclic-sig.rs:8:7: 8:10}` --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7 | LL | g(|_| { }); - | ^^^ recursive type with infinite-size name + | - ^^^^^^^^ expected an `FnOnce(Option<{closure@$DIR/unboxed-closure-no-cyclic-sig.rs:8:7: 8:10}>)` closure, found `{closure@$DIR/unboxed-closure-no-cyclic-sig.rs:8:7: 8:10}` + | | + | required by a bound introduced by this call | - = note: closures cannot capture themselves or take themselves as argument; - this error may be the result of a recent compiler bug-fix, - see issue #46062 - for more information +help: the trait `FnOnce(Option<{closure@$DIR/unboxed-closure-no-cyclic-sig.rs:8:7: 8:10}>)` is not implemented for closure `{closure@$DIR/unboxed-closure-no-cyclic-sig.rs:8:7: 8:10}` + --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7 + | +LL | g(|_| { }); + | ^^^ note: required by a bound in `g` --> $DIR/unboxed-closure-no-cyclic-sig.rs:5:24 | @@ -16,4 +19,4 @@ LL | fn g(_: F) where F: FnOnce(Option) {} error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0644`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/union/issue-81199.stderr b/tests/ui/union/issue-81199.stderr index a36aa4bf98c46..e6c72300f1149 100644 --- a/tests/ui/union/issue-81199.stderr +++ b/tests/ui/union/issue-81199.stderr @@ -27,7 +27,33 @@ help: consider further restricting type parameter `T` with trait `Pointee` LL | union PtrRepr { | +++++++++ -error: aborting due to 2 previous errors +error[E0277]: the size for values of type `PtrComponents` cannot be known at compilation time + --> $DIR/issue-81199.rs:7:17 + | +LL | components: PtrComponents, + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: the trait `Sized` is not implemented for `PtrComponents` + --> $DIR/issue-81199.rs:13:1 + | +LL | struct PtrComponents { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: no field of a union may have a dynamically sized type + = help: change the field's type to have a statically known size +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | union PtrRepr where PtrComponents: Sized { + | +++++++++++++++++++++++++++++ +help: borrowed types always have a statically known size + | +LL | components: &PtrComponents, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | components: Box>, + | ++++ + + +error: aborting due to 3 previous errors Some errors have detailed explanations: E0277, E0740. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/unsafe-binders/discriminant-for-variant.stderr b/tests/ui/unsafe-binders/discriminant-for-variant.stderr index ed1a38ae14e40..7f880ecacd036 100644 --- a/tests/ui/unsafe-binders/discriminant-for-variant.stderr +++ b/tests/ui/unsafe-binders/discriminant-for-variant.stderr @@ -5,6 +5,8 @@ LL | const None: Option Option>> = None; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<(dyn Send + 'static)>` | = note: required for `Option>` to implement `Copy` +note: required because it appears within the type `Option>` + --> $SRC_DIR/core/src/option.rs:LL:COL error[E0277]: the trait bound `Box<(dyn Send + 'static)>: Copy` is not satisfied --> $DIR/discriminant-for-variant.rs:3:54 @@ -13,6 +15,8 @@ LL | const None: Option Option>> = None; | ^^^^ the trait `Copy` is not implemented for `Box<(dyn Send + 'static)>` | = note: required for `Option>` to implement `Copy` +note: required because it appears within the type `Option>` + --> $SRC_DIR/core/src/option.rs:LL:COL error: aborting due to 2 previous errors diff --git a/tests/ui/unsafe-binders/layout-invariant.stderr b/tests/ui/unsafe-binders/layout-invariant.stderr index 8eb00897c8520..4d8a90932dfd2 100644 --- a/tests/ui/unsafe-binders/layout-invariant.stderr +++ b/tests/ui/unsafe-binders/layout-invariant.stderr @@ -5,6 +5,8 @@ LL | const None: Option Option Adt<'a>>> = None; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `unsafe<'a> Adt<'a>` | = note: required for `Option Adt<'a>>` to implement `Copy` +note: required because it appears within the type `Option Adt<'a>>` + --> $SRC_DIR/core/src/option.rs:LL:COL error[E0277]: the trait bound `unsafe<'a> Adt<'a>: Copy` is not satisfied --> $DIR/layout-invariant.rs:9:59 @@ -13,6 +15,8 @@ LL | const None: Option Option Adt<'a>>> = None; | ^^^^ the trait `Copy` is not implemented for `unsafe<'a> Adt<'a>` | = note: required for `Option Adt<'a>>` to implement `Copy` +note: required because it appears within the type `Option Adt<'a>>` + --> $SRC_DIR/core/src/option.rs:LL:COL error: aborting due to 2 previous errors diff --git a/tests/ui/unsafe-binders/move-out-of-non-copy.stderr b/tests/ui/unsafe-binders/move-out-of-non-copy.stderr index 4598742c92b43..f20ed6e319668 100644 --- a/tests/ui/unsafe-binders/move-out-of-non-copy.stderr +++ b/tests/ui/unsafe-binders/move-out-of-non-copy.stderr @@ -1,9 +1,10 @@ -error[E0277]: the trait bound `T: Copy` is not satisfied +error[E0277]: the trait bound `T: Copy` is not satisfied in `T` --> $DIR/move-out-of-non-copy.rs:10:13 | LL | fn id(x: unsafe<> T) -> T { - | ^^^^^^^^^^ the trait `Copy` is not implemented for `T` + | ^^^^^^^^^^ within `T`, the trait `Copy` is not implemented for `T` | + = note: required because it appears within the type `T` help: consider restricting type parameter `T` with trait `Copy` | LL | fn id(x: unsafe<> T) -> T { diff --git a/tests/ui/unsized/issue-30355.stderr b/tests/ui/unsized/issue-30355.stderr index cfbcd0aea901d..c9fa8a75ae7aa 100644 --- a/tests/ui/unsized/issue-30355.stderr +++ b/tests/ui/unsized/issue-30355.stderr @@ -8,6 +8,20 @@ LL | &X(*Y) = note: all function arguments must have a statically known size = help: unsized fn params are gated as an unstable feature -error: aborting due to 1 previous error +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/issue-30355.rs:5:6 + | +LL | &X(*Y) + | ^^^^^ doesn't have a size known at compile-time + | + = help: within `X`, the trait `Sized` is not implemented for `[u8]` +note: required because it appears within the type `X` + --> $DIR/issue-30355.rs:1:14 + | +LL | pub struct X([u8]); + | ^^^^ required by this field + = note: the return type of a function must have a statically known size + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsized/issue-75707.stderr b/tests/ui/unsized/issue-75707.stderr index 7bdb65500a9fc..b62a16e0fe46b 100644 --- a/tests/ui/unsized/issue-75707.stderr +++ b/tests/ui/unsized/issue-75707.stderr @@ -1,10 +1,10 @@ -error[E0277]: the trait bound `MyCall: Callback` is not satisfied +error[E0277]: the trait bound `MyCall: Callback` is not satisfied in `dyn Processing` --> $DIR/issue-75707.rs:15:9 | LL | f::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | -help: the trait `Callback` is not implemented for `MyCall` +help: within `dyn Processing`, the trait `Callback` is not implemented for `MyCall` --> $DIR/issue-75707.rs:14:5 | LL | struct MyCall; @@ -14,6 +14,7 @@ help: this trait has no implementations, consider adding one | LL | pub trait Callback { | ^^^^^^^^^^^^^^^^^^ + = note: required because it appears within the type `dyn Processing` note: required by a bound in `f` --> $DIR/issue-75707.rs:9:9 | diff --git a/tests/ui/unsized/unsized-enum.stderr b/tests/ui/unsized/unsized-enum.stderr index 5a30d7fab65a7..aed02d072ebdc 100644 --- a/tests/ui/unsized/unsized-enum.stderr +++ b/tests/ui/unsized/unsized-enum.stderr @@ -24,6 +24,32 @@ LL - fn foo2() { not_sized::>() } LL + fn foo2() { not_sized::>() } | -error: aborting due to 1 previous error +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/unsized-enum.rs:6:24 + | +LL | fn foo2() { not_sized::>() } + | - ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | +note: required by an implicit `Sized` bound in `Foo` + --> $DIR/unsized-enum.rs:4:10 + | +LL | enum Foo { FooSome(U), FooNone } + | ^ required by the implicit `Sized` requirement on this type parameter in `Foo` +help: you could relax the implicit `Sized` bound on `U` if it were used through indirection like `&U` or `Box` + --> $DIR/unsized-enum.rs:4:10 + | +LL | enum Foo { FooSome(U), FooNone } + | ^ - ...if indirection were used here: `Box` + | | + | this could be changed to `U: ?Sized`... +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn foo2() { not_sized::>() } +LL + fn foo2() { not_sized::>() } + | + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsized/unsized-enum2.stderr b/tests/ui/unsized/unsized-enum2.stderr index e790e74b41b00..6b6fed79090f6 100644 --- a/tests/ui/unsized/unsized-enum2.stderr +++ b/tests/ui/unsized/unsized-enum2.stderr @@ -170,6 +170,98 @@ help: the `Box` type always has a statically known size and allocates its conten LL | VH{u: isize, x: Box<[u32]>}, | ++++ + +error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time + --> $DIR/unsized-enum2.rs:43:8 + | +LL | VI(Path1), + | ^^^^^ doesn't have a size known at compile-time + | + = help: within `Path1`, the trait `Sized` is not implemented for `(dyn PathHelper1 + 'static)` +note: required because it appears within the type `Path1` + --> $DIR/unsized-enum2.rs:16:14 + | +LL | struct Path1(dyn PathHelper1); + | ^^^^^^^^^^^^^^^ required by this field + = note: no field of an enum variant may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | VI(&Path1), + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | VI(Box), + | ++++ + + +error[E0277]: the size for values of type `(dyn PathHelper2 + 'static)` cannot be known at compilation time + --> $DIR/unsized-enum2.rs:45:11 + | +LL | VJ{x: Path2}, + | ^^^^^ doesn't have a size known at compile-time + | + = help: within `Path2`, the trait `Sized` is not implemented for `(dyn PathHelper2 + 'static)` +note: required because it appears within the type `Path2` + --> $DIR/unsized-enum2.rs:17:14 + | +LL | struct Path2(dyn PathHelper2); + | ^^^^^^^^^^^^^^^ required by this field + = note: no field of an enum variant may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | VJ{x: &Path2}, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | VJ{x: Box}, + | ++++ + + +error[E0277]: the size for values of type `(dyn PathHelper3 + 'static)` cannot be known at compilation time + --> $DIR/unsized-enum2.rs:47:15 + | +LL | VK(isize, Path3), + | ^^^^^ doesn't have a size known at compile-time + | + = help: within `Path3`, the trait `Sized` is not implemented for `(dyn PathHelper3 + 'static)` +note: required because it appears within the type `Path3` + --> $DIR/unsized-enum2.rs:18:14 + | +LL | struct Path3(dyn PathHelper3); + | ^^^^^^^^^^^^^^^ required by this field + = note: no field of an enum variant may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | VK(isize, &Path3), + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | VK(isize, Box), + | ++++ + + +error[E0277]: the size for values of type `(dyn PathHelper4 + 'static)` cannot be known at compilation time + --> $DIR/unsized-enum2.rs:49:21 + | +LL | VL{u: isize, x: Path4}, + | ^^^^^ doesn't have a size known at compile-time + | + = help: within `Path4`, the trait `Sized` is not implemented for `(dyn PathHelper4 + 'static)` +note: required because it appears within the type `Path4` + --> $DIR/unsized-enum2.rs:19:14 + | +LL | struct Path4(dyn PathHelper4); + | ^^^^^^^^^^^^^^^ required by this field + = note: no field of an enum variant may have a dynamically sized type + = help: change the field's type to have a statically known size +help: borrowed types always have a statically known size + | +LL | VL{u: isize, x: &Path4}, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | VL{u: isize, x: Box}, + | ++++ + + error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time --> $DIR/unsized-enum2.rs:53:8 | @@ -314,98 +406,6 @@ help: the `Box` type always has a statically known size and allocates its conten LL | VT{u: isize, x: Box<<&'static [i32] as Deref>::Target>}, | ++++ + -error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:43:8 - | -LL | VI(Path1), - | ^^^^^ doesn't have a size known at compile-time - | - = help: within `Path1`, the trait `Sized` is not implemented for `(dyn PathHelper1 + 'static)` -note: required because it appears within the type `Path1` - --> $DIR/unsized-enum2.rs:16:14 - | -LL | struct Path1(dyn PathHelper1); - | ^^^^^^^^^^^^^^^ required by this field - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | VI(&Path1), - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | VI(Box), - | ++++ + - -error[E0277]: the size for values of type `(dyn PathHelper2 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:45:11 - | -LL | VJ{x: Path2}, - | ^^^^^ doesn't have a size known at compile-time - | - = help: within `Path2`, the trait `Sized` is not implemented for `(dyn PathHelper2 + 'static)` -note: required because it appears within the type `Path2` - --> $DIR/unsized-enum2.rs:17:14 - | -LL | struct Path2(dyn PathHelper2); - | ^^^^^^^^^^^^^^^ required by this field - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | VJ{x: &Path2}, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | VJ{x: Box}, - | ++++ + - -error[E0277]: the size for values of type `(dyn PathHelper3 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:47:15 - | -LL | VK(isize, Path3), - | ^^^^^ doesn't have a size known at compile-time - | - = help: within `Path3`, the trait `Sized` is not implemented for `(dyn PathHelper3 + 'static)` -note: required because it appears within the type `Path3` - --> $DIR/unsized-enum2.rs:18:14 - | -LL | struct Path3(dyn PathHelper3); - | ^^^^^^^^^^^^^^^ required by this field - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | VK(isize, &Path3), - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | VK(isize, Box), - | ++++ + - -error[E0277]: the size for values of type `(dyn PathHelper4 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:49:21 - | -LL | VL{u: isize, x: Path4}, - | ^^^^^ doesn't have a size known at compile-time - | - = help: within `Path4`, the trait `Sized` is not implemented for `(dyn PathHelper4 + 'static)` -note: required because it appears within the type `Path4` - --> $DIR/unsized-enum2.rs:19:14 - | -LL | struct Path4(dyn PathHelper4); - | ^^^^^^^^^^^^^^^ required by this field - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | VL{u: isize, x: &Path4}, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | VL{u: isize, x: Box}, - | ++++ + - error: aborting due to 20 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsized/unsized-fn-param.stderr b/tests/ui/unsized/unsized-fn-param.stderr index 0de3dbbb55725..7070caeb141bf 100644 --- a/tests/ui/unsized/unsized-fn-param.stderr +++ b/tests/ui/unsized/unsized-fn-param.stderr @@ -1,49 +1,53 @@ -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `&str: CoerceUnsized<&dyn AsRef>` is not satisfied in `str` --> $DIR/unsized-fn-param.rs:11:11 | LL | foo11("bar", &"baz"); - | ^^^^^ doesn't have a size known at compile-time + | ^^^^^ within `str`, the trait `Sized` is not implemented for `str` | - = help: the trait `Sized` is not implemented for `str` + = note: `str` is considered to contain a `[u8]` slice for auto trait purposes + = note: required for `&str` to implement `CoerceUnsized<&dyn AsRef>` = note: required for the cast from `&'static str` to `&dyn AsRef` help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef` | LL | foo11(&"bar", &"baz"); | + -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `&str: CoerceUnsized<&dyn AsRef>` is not satisfied in `str` --> $DIR/unsized-fn-param.rs:13:19 | LL | foo12(&"bar", "baz"); - | ^^^^^ doesn't have a size known at compile-time + | ^^^^^ within `str`, the trait `Sized` is not implemented for `str` | - = help: the trait `Sized` is not implemented for `str` + = note: `str` is considered to contain a `[u8]` slice for auto trait purposes + = note: required for `&str` to implement `CoerceUnsized<&dyn AsRef>` = note: required for the cast from `&'static str` to `&dyn AsRef` help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef` | LL | foo12(&"bar", &"baz"); | + -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `&str: CoerceUnsized<&dyn AsRef>` is not satisfied in `str` --> $DIR/unsized-fn-param.rs:16:11 | LL | foo21("bar", &"baz"); - | ^^^^^ doesn't have a size known at compile-time + | ^^^^^ within `str`, the trait `Sized` is not implemented for `str` | - = help: the trait `Sized` is not implemented for `str` + = note: `str` is considered to contain a `[u8]` slice for auto trait purposes + = note: required for `&str` to implement `CoerceUnsized<&dyn AsRef>` = note: required for the cast from `&'static str` to `&dyn AsRef` help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef` | LL | foo21(&"bar", &"baz"); | + -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `&str: CoerceUnsized<&dyn AsRef>` is not satisfied in `str` --> $DIR/unsized-fn-param.rs:18:19 | LL | foo22(&"bar", "baz"); - | ^^^^^ doesn't have a size known at compile-time + | ^^^^^ within `str`, the trait `Sized` is not implemented for `str` | - = help: the trait `Sized` is not implemented for `str` + = note: `str` is considered to contain a `[u8]` slice for auto trait purposes + = note: required for `&str` to implement `CoerceUnsized<&dyn AsRef>` = note: required for the cast from `&'static str` to `&dyn AsRef` help: consider borrowing the value, since `&&'static str` can be coerced into `&dyn AsRef` | diff --git a/tests/ui/unsized/unsized-struct.stderr b/tests/ui/unsized/unsized-struct.stderr index 81c70eb8c61b1..257f365d5c49a 100644 --- a/tests/ui/unsized/unsized-struct.stderr +++ b/tests/ui/unsized/unsized-struct.stderr @@ -24,6 +24,32 @@ LL - fn foo2() { not_sized::>() } LL + fn foo2() { not_sized::>() } | +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/unsized-struct.rs:6:24 + | +LL | fn foo2() { not_sized::>() } + | - ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `Sized` + | +note: required by an implicit `Sized` bound in `Foo` + --> $DIR/unsized-struct.rs:4:12 + | +LL | struct Foo { data: T } + | ^ required by the implicit `Sized` requirement on this type parameter in `Foo` +help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` + --> $DIR/unsized-struct.rs:4:12 + | +LL | struct Foo { data: T } + | ^ - ...if indirection were used here: `Box` + | | + | this could be changed to `T: ?Sized`... +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn foo2() { not_sized::>() } +LL + fn foo2() { not_sized::>() } + | + error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/unsized-struct.rs:13:35 | @@ -48,6 +74,6 @@ LL - fn bar2() { is_sized::>() } LL + fn bar2() { is_sized::>() } | -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsized/unsized6.stderr b/tests/ui/unsized/unsized6.stderr index 2dcdd3c3c0be9..b6513745f953d 100644 --- a/tests/ui/unsized/unsized6.stderr +++ b/tests/ui/unsized/unsized6.stderr @@ -1,3 +1,19 @@ +error[E0277]: the size for values of type `X` cannot be known at compilation time + --> $DIR/unsized6.rs:7:12 + | +LL | fn f1(x: &X) { + | - this type parameter needs to be `Sized` +LL | let _: W; // <-- this is OK, no bindings created, no initializer. +LL | let _: (isize, (X, isize)); + | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = note: only the last element of a tuple may have a dynamically sized type +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn f1(x: &X) { +LL + fn f1(x: &X) { + | + error[E0277]: the size for values of type `Y` cannot be known at compilation time --> $DIR/unsized6.rs:9:9 | @@ -18,22 +34,6 @@ help: consider borrowing here LL | let y: &Y; | + -error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:7:12 - | -LL | fn f1(x: &X) { - | - this type parameter needs to be `Sized` -LL | let _: W; // <-- this is OK, no bindings created, no initializer. -LL | let _: (isize, (X, isize)); - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = note: only the last element of a tuple may have a dynamically sized type -help: consider removing the `?Sized` bound to make the type parameter `Sized` - | -LL - fn f1(x: &X) { -LL + fn f1(x: &X) { - | - error[E0277]: the size for values of type `Z` cannot be known at compilation time --> $DIR/unsized6.rs:11:12 | diff --git a/tests/ui/unstable-feature-bound/unstable_feature_bound_on_trait.fail.stderr b/tests/ui/unstable-feature-bound/unstable_feature_bound_on_trait.fail.stderr index cd0fdf7e3ed29..2c5cd47aebf50 100644 --- a/tests/ui/unstable-feature-bound/unstable_feature_bound_on_trait.fail.stderr +++ b/tests/ui/unstable-feature-bound/unstable_feature_bound_on_trait.fail.stderr @@ -2,18 +2,16 @@ error: unstable feature `foo` is used without being enabled. --> $DIR/unstable_feature_bound_on_trait.rs:28:5 | LL | Foo::bar(); - | ^^^^^^^^^^ + | ^^^ | = help: The feature can be enabled by marking the current item with `#[unstable_feature_bound(foo)]` -note: required by a bound in `Bar::bar` - --> $DIR/unstable_feature_bound_on_trait.rs:16:1 +note: required for `Foo` to implement `Bar` + --> $DIR/unstable_feature_bound_on_trait.rs:23:6 | LL | #[unstable_feature_bound(foo)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Bar::bar` -LL | trait Bar { -LL | #[stable(feature = "a", since = "1.1.1" )] -LL | fn bar() {} - | + | ------------------------------ unsatisfied trait bound introduced here +LL | impl Bar for Foo { + | ^^^ ^^^ error: aborting due to 1 previous error diff --git a/tests/ui/wf/closure-trait-ice-in-wfcheck-diagnostics.stderr b/tests/ui/wf/closure-trait-ice-in-wfcheck-diagnostics.stderr index 7457f76eb39f6..4642536e59869 100644 --- a/tests/ui/wf/closure-trait-ice-in-wfcheck-diagnostics.stderr +++ b/tests/ui/wf/closure-trait-ice-in-wfcheck-diagnostics.stderr @@ -18,6 +18,17 @@ LL | | for<'a> <() as FnOnce<&'a i32>>::Output: Tr, | = help: the trait `for<'a> FnOnce<&'a i32>` is not implemented for `()` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/closure-trait-ice-in-wfcheck-diagnostics.rs:16:5 + | +LL | / { +LL | | } + | |_____^ expected associated type, found `()` + | + = note: expected associated type `impl Sized` + found unit type `()` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/wf/hir-wf-canonicalized.stderr b/tests/ui/wf/hir-wf-canonicalized.stderr index 51db0e39de084..0a21a9fee4531 100644 --- a/tests/ui/wf/hir-wf-canonicalized.stderr +++ b/tests/ui/wf/hir-wf-canonicalized.stderr @@ -15,35 +15,12 @@ help: this trait has no implementations, consider adding one LL | trait Foo { | ^^^^^^^^^ -error[E0277]: the trait bound `(dyn Callback, Output = ()> + 'static): Foo` is not satisfied +error: the type `Box<(dyn Callback<(dyn Callback> + 'static)> + 'static)>` is not well-formed --> $DIR/hir-wf-canonicalized.rs:10:15 | LL | callback: Box>>>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(dyn Callback, Output = ()> + 'static)` - | -help: this trait has no implementations, consider adding one - --> $DIR/hir-wf-canonicalized.rs:3:1 - | -LL | trait Foo { - | ^^^^^^^^^ - -error[E0277]: the size for values of type `(dyn Callback, Output = ()> + 'static)` cannot be known at compilation time - --> $DIR/hir-wf-canonicalized.rs:10:15 - | -LL | callback: Box>>>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Callback, Output = ()> + 'static)` -note: required by an implicit `Sized` bound in `Bar` - --> $DIR/hir-wf-canonicalized.rs:9:16 - | -LL | struct Bar<'a, T> { - | ^ required by the implicit `Sized` requirement on this type parameter in `Bar` -help: consider relaxing the implicit `Sized` restriction - | -LL | struct Bar<'a, T: ?Sized> { - | ++++++++ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr b/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr index dc2e8147a159c..7073c4b72d30d 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr +++ b/tests/ui/wf/hir-wf-check-erase-regions.nll.stderr @@ -7,6 +7,7 @@ LL | type IntoIter = std::iter::Flatten>; = help: the trait `Iterator` is not implemented for `&'a T` help: the trait `Iterator` is implemented for `&mut I` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + = note: required for `&'a T` to implement `IntoIterator` = note: required for `Flatten>` to implement `Iterator` note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL @@ -20,7 +21,7 @@ LL | type IntoIter = std::iter::Flatten>; = help: the trait `Iterator` is not implemented for `&'a T` help: the trait `Iterator` is implemented for `&mut I` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - = note: required for `&'a T` to implement `IntoIterator` + = note: required for ` as Iterator>::Item` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL @@ -33,7 +34,7 @@ LL | fn into_iter(self) -> Self::IntoIter { = help: the trait `Iterator` is not implemented for `&'a T` help: the trait `Iterator` is implemented for `&mut I` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - = note: required for `&'a T` to implement `IntoIterator` + = note: required for ` as Iterator>::Item` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL diff --git a/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr b/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr index dc2e8147a159c..7073c4b72d30d 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr +++ b/tests/ui/wf/hir-wf-check-erase-regions.polonius.stderr @@ -7,6 +7,7 @@ LL | type IntoIter = std::iter::Flatten>; = help: the trait `Iterator` is not implemented for `&'a T` help: the trait `Iterator` is implemented for `&mut I` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + = note: required for `&'a T` to implement `IntoIterator` = note: required for `Flatten>` to implement `Iterator` note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL @@ -20,7 +21,7 @@ LL | type IntoIter = std::iter::Flatten>; = help: the trait `Iterator` is not implemented for `&'a T` help: the trait `Iterator` is implemented for `&mut I` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - = note: required for `&'a T` to implement `IntoIterator` + = note: required for ` as Iterator>::Item` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL @@ -33,7 +34,7 @@ LL | fn into_iter(self) -> Self::IntoIter { = help: the trait `Iterator` is not implemented for `&'a T` help: the trait `Iterator` is implemented for `&mut I` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - = note: required for `&'a T` to implement `IntoIterator` + = note: required for ` as Iterator>::Item` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL diff --git a/tests/ui/wf/ice-wf-missing-span-in-error-130012.stderr b/tests/ui/wf/ice-wf-missing-span-in-error-130012.stderr index 357e504bd5eb9..9bcf24a51f300 100644 --- a/tests/ui/wf/ice-wf-missing-span-in-error-130012.stderr +++ b/tests/ui/wf/ice-wf-missing-span-in-error-130012.stderr @@ -26,16 +26,6 @@ error[E0582]: binding for associated type `Assoc` references lifetime `'b`, whic LL | impl Fun> MyTrait for F {} | ^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/ice-wf-missing-span-in-error-130012.rs:14:50 - | -LL | impl Fun> MyTrait for F {} - | ^ lifetime mismatch - | - = note: expected reference `&()` - found reference `&'b ()` - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0308, E0582. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0582`. diff --git a/tests/ui/wf/issue-103573.stderr b/tests/ui/wf/issue-103573.stderr index 3129f2a8c3415..b5bbd9a631a17 100644 --- a/tests/ui/wf/issue-103573.stderr +++ b/tests/ui/wf/issue-103573.stderr @@ -9,6 +9,12 @@ help: consider further restricting the associated type LL | fn g<'a>(_: &< as TraitB>::TypeB as TraitA>::TypeA) where <>::TypeC<'a> as TraitB>::TypeB: TraitA; | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -error: aborting due to 1 previous error +error: the type `&<<>::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA` is not well-formed + --> $DIR/issue-103573.rs:18:17 + | +LL | fn g<'a>(_: &< as TraitB>::TypeB as TraitA>::TypeA); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/wf/issue-96810.stderr b/tests/ui/wf/issue-96810.stderr index 3f87d3e0786fb..03d6275b94416 100644 --- a/tests/ui/wf/issue-96810.stderr +++ b/tests/ui/wf/issue-96810.stderr @@ -14,6 +14,32 @@ help: consider restricting type parameter `K` with trait `Tr` LL | struct Hoge { | ++++ -error: aborting due to 1 previous error +error[E0277]: the size for values of type `S` cannot be known at compilation time + --> $DIR/issue-96810.rs:8:8 + | +LL | s: S, + | ^^^^ doesn't have a size known at compile-time + | +help: the trait `Sized` is not implemented for `S` + --> $DIR/issue-96810.rs:1:1 + | +LL | struct S(T::Assoc); + | ^^^^^^^^^^^^^^^ + = note: only the last field of a struct may have a dynamically sized type + = help: change the field's type to have a statically known size +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | struct Hoge where S: Sized { + | +++++++++++++++++ +help: borrowed types always have a statically known size + | +LL | s: &S, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | s: Box>, + | ++++ + + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/wf/wf-impl-associated-type-region.stderr b/tests/ui/wf/wf-impl-associated-type-region.stderr index 86e35b86fb131..5b0b90889aa8b 100644 --- a/tests/ui/wf/wf-impl-associated-type-region.stderr +++ b/tests/ui/wf/wf-impl-associated-type-region.stderr @@ -4,7 +4,7 @@ error[E0309]: the parameter type `T` may not live long enough LL | impl<'a, T> Foo<'a> for T { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... LL | type Bar = &'a T; - | ^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at + | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/wf/wf-in-fn-type-static.stderr b/tests/ui/wf/wf-in-fn-type-static.stderr index 45ad9fba0ce73..7c8613d7277b3 100644 --- a/tests/ui/wf/wf-in-fn-type-static.stderr +++ b/tests/ui/wf/wf-in-fn-type-static.stderr @@ -5,7 +5,7 @@ LL | x: fn() -> &'static T | ^^^^^^^^^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -19,7 +19,7 @@ LL | x: fn(&'static T) | ^^^^^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/wf/wf-in-obj-type-static.stderr b/tests/ui/wf/wf-in-obj-type-static.stderr index 9e837b10e284d..d82409b2b5cb6 100644 --- a/tests/ui/wf/wf-in-obj-type-static.stderr +++ b/tests/ui/wf/wf-in-obj-type-static.stderr @@ -5,7 +5,7 @@ LL | x: dyn Object<&'static T> | ^^^^^^^^^^^^^^^^^^^^^^ | | | the parameter type `T` must be valid for the static lifetime... - | ...so that the reference type `&'static T` does not outlive the data it points at + | ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr index f2989ae97b54b..333b0f14ae9a9 100644 --- a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr +++ b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr @@ -4,7 +4,7 @@ error[E0309]: the parameter type `T` may not live long enough LL | impl<'a, T> Trait<'a, T> for usize { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... LL | type Out = &'a fn(T); - | ^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at + | ^^^^^^^^ ...so that the type `fn(T)` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | @@ -17,7 +17,7 @@ error[E0309]: the parameter type `T` may not live long enough LL | impl<'a, T> Trait<'a, T> for u32 { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... LL | type Out = &'a dyn Baz; - | ^^^^^^^^ ...so that the reference type `&'a (dyn Baz + 'a)` does not outlive the data it points at + | ^^^^^^^^ ...so that the type `(dyn Baz + 'a)` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr index 3d06648765462..25c689ea3883a 100644 --- a/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr +++ b/tests/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr @@ -15,6 +15,12 @@ help: this trait has no implementations, consider adding one LL | pub trait Allocator { type Buffer; } | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: the type `Matrix<::Buffer>` is not well-formed + --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:28:12 + | +LL | struct Foo(Matrix<::Buffer>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/wf/wf-trait-associated-type-region.stderr b/tests/ui/wf/wf-trait-associated-type-region.stderr index 9589e1d785342..5172e15b9b427 100644 --- a/tests/ui/wf/wf-trait-associated-type-region.stderr +++ b/tests/ui/wf/wf-trait-associated-type-region.stderr @@ -5,7 +5,7 @@ LL | trait SomeTrait<'a> { | -- the associated type `>::Type1` must be valid for the lifetime `'a` as defined here... LL | type Type1; LL | type Type2 = &'a Self::Type1; - | ^^^^^^^^^^ ...so that the reference type `&'a >::Type1` does not outlive the data it points at + | ^^^^^^^^^^ ...so that the type `>::Type1` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/wf/wf-where-clauses-pre-normalization.stderr b/tests/ui/wf/wf-where-clauses-pre-normalization.stderr index a7836cae5db26..ff2b4e60bf1d6 100644 --- a/tests/ui/wf/wf-where-clauses-pre-normalization.stderr +++ b/tests/ui/wf/wf-where-clauses-pre-normalization.stderr @@ -5,7 +5,7 @@ LL | pub fn repro<'a, T>() | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... LL | where LL | as Data>::Elem: Sized, - | ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at + | ^^^^^ ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/where-clauses/ignore-err-clauses.stderr b/tests/ui/where-clauses/ignore-err-clauses.stderr index 222b162cd482c..82a61d953c520 100644 --- a/tests/ui/where-clauses/ignore-err-clauses.stderr +++ b/tests/ui/where-clauses/ignore-err-clauses.stderr @@ -4,30 +4,6 @@ error[E0425]: cannot find type `UUU` in this scope LL | UUU: Copy, | ^^^ not found in this scope -error[E0382]: use of moved value: `x` - --> $DIR/ignore-err-clauses.rs:9:9 - | -LL | fn dbl(x: T) -> ::Output - | - move occurs because `x` has type `T`, which does not implement the `Copy` trait -... -LL | x + x - | ----^ - | | | - | | value used here after move - | `x` moved due to usage in operator - | -help: if `T` implemented `Clone`, you could clone the value - --> $DIR/ignore-err-clauses.rs:3:8 - | -LL | fn dbl(x: T) -> ::Output - | ^ consider constraining this type parameter with `Clone` -... -LL | x + x - | - you could clone this value -note: calling this operator moves the left-hand side - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0382, E0425. -For more information about an error, try `rustc --explain E0382`. +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/where-clauses/where-for-self-2.stderr b/tests/ui/where-clauses/where-for-self-2.stderr index 1b172f2a57f3c..a9b7500f9929c 100644 --- a/tests/ui/where-clauses/where-for-self-2.stderr +++ b/tests/ui/where-clauses/where-for-self-2.stderr @@ -1,17 +1,25 @@ -error: implementation of `Bar` is not general enough - --> $DIR/where-for-self-2.rs:23:5 +error[E0277]: the trait bound `for<'a> &'a u32: Bar` is not satisfied + --> $DIR/where-for-self-2.rs:23:9 | LL | foo(&X); - | ^^^^^^^ + | --- ^^ the trait `for<'a> Bar` is not implemented for `&'a u32` + | | + | required by a bound introduced by this call | -note: `&'0 u32` must implement `Bar`, for any lifetime `'0`... +help: the trait `Bar` is not implemented for `&'a _` + but it is implemented for `&'static _` + --> $DIR/where-for-self-2.rs:12:1 + | +LL | impl Bar for &'static u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `foo` --> $DIR/where-for-self-2.rs:18:20 | LL | fn foo(x: &T) LL | where LL | for<'a> &'a T: Bar, | ^^^ required by this bound in `foo` - = note: ...but `Bar` is actually implemented for the type `&'static u32` error: aborting due to 1 previous error +For more information about this error, try `rustc --explain E0277`.