Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions tests/ui/abi/bad-custom.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ }`
Expand Down
1 change: 1 addition & 0 deletions tests/ui/allocator/159445-unsize-pin-box.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ help: the following other types implement trait `StaticAllocator`
|
= note: `std::alloc::Global`
= note: required for `Box<i32, BadAlloc>` to implement `PinSafePointer`
= note: required for `Pin<Box<i32, BadAlloc>>` to implement `CoerceUnsized<Pin<Box<dyn Any, BadAlloc>>>`
= note: required for the cast from `Pin<Box<i32, BadAlloc>>` to `Pin<Box<(dyn Any + 'static), BadAlloc>>`

error: aborting due to 1 previous error
Expand Down
Original file line number Diff line number Diff line change
@@ -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`.
17 changes: 15 additions & 2 deletions tests/ui/associated-consts/associated-const-in-trait.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
| ^^^^^^^^^^^
Comment on lines +33 to +43

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we silenced these kind of errors (that are already implied by others)


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`.
Original file line number Diff line number Diff line change
@@ -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; <A as Foo>::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; <A as Foo>::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; <A as Foo>::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`.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
|
LL | const _: Ty::Pr<String> = 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: Copy> = T;
| ^^^^ required by this bound in `Ty::Pr`
Comment on lines -19 to -25

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we lose these? We don't carry an appropriate obligation cause code?


error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ error[E0277]: the trait bound `Vec<()>: Copy` is not satisfied
|
LL | let _: Ty::Pr<Vec<()>>;
| ^^^^^^^^^^^^^^^ 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: Copy> = T;
| ^^^^ required by this bound in `Ty::Pr`

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@ LL |
LL ~ impl<'a> Foo<fn(&()), 'a> {
|

error[E0308]: mismatched types
error[E0271]: type mismatch resolving `Foo<fn(&())>::Assoc == &()`
--> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:11
|
LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ

error[E0271]: type mismatch resolving `Foo<fn(&())>::Assoc == &()`
--> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:8
|
= note: expected struct `Foo<for<'a> fn(&'a ())>`
found struct `Foo<for<'a> fn(&'a ())>`
LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
| ^ types differ

error: higher-ranked subtype error
error[E0271]: type mismatch resolving `Foo<fn(&())>::Assoc == &()`
--> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:1
|
LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::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`.
39 changes: 9 additions & 30 deletions tests/ui/associated-inherent-types/issue-109789.stderr
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
error[E0308]: mismatched types
error[E0271]: type mismatch resolving `Foo<fn(&())>::Assoc == u32`
--> $DIR/issue-109789.rs:18:11
|
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected struct `Foo<fn(&'static ())>`
found struct `Foo<for<'a> fn(&'a ())>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ

error[E0308]: mismatched types
error: the type `Foo<for<'a> fn(&'a ())>::Assoc` is not well-formed
--> $DIR/issue-109789.rs:18:11
|
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected struct `Foo<fn(&'static ())>`
found struct `Foo<for<'a> 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<for<'a> fn(&'a ())>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: higher-ranked subtype error
--> $DIR/issue-109789.rs:18:1
|
LL | fn bar(_: Foo<for<'a> 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<fn(&())>::Assoc == u32`
--> $DIR/issue-109789.rs:18:11
|
LL | fn bar(_: Foo<for<'a> 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`.
11 changes: 9 additions & 2 deletions tests/ui/associated-inherent-types/issue-111879-0.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
error: overflow evaluating associated type `Carrier<'b>::Focus<i32>`
error[E0275]: overflow evaluating the requirement `for<'b> Carrier<'b>::Focus<i32> == _`
--> $DIR/issue-111879-0.rs:9:5
|
LL | pub type Focus<T> = &'a mut for<'b> fn(Carrier<'b>::Focus<i32>);
| ^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error
error[E0275]: overflow evaluating whether `&'a mut for<'b> fn(Carrier<'b>::Focus<i32>)` is well-formed
--> $DIR/issue-111879-0.rs:9:5
|
LL | pub type Focus<T> = &'a mut for<'b> fn(Carrier<'b>::Focus<i32>);
| ^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0275`.
13 changes: 4 additions & 9 deletions tests/ui/associated-inherent-types/regionck-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
12 changes: 5 additions & 7 deletions tests/ui/associated-inherent-types/regionck-2.stderr
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -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>::T`
--> $DIR/unsatisfied-bounds-inferred-type.rs:6:9
|
LL | impl<T: Copy> S<T> {
| ^^^^ required by this bound in `S<T>::T`
LL | type T = T;
|

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
|
LL | let _: S::<String>::X;
| ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
note: required by a bound in `S<T>::X`
--> $DIR/unsatisfied-bounds-where-clause-on-assoc-ty.rs:9:12
|
LL | impl<T> S<T> {
LL | type X = ()
LL | where
LL | T: Copy;
| ^^^^ required by this bound in `S<T>::X`

error: aborting due to 1 previous error

Expand Down
26 changes: 6 additions & 20 deletions tests/ui/associated-type-bounds/duplicate-bound-err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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::</* Type */>()
Expand All @@ -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::</* Type */>()
Expand All @@ -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::</* Type */>()
Expand Down Expand Up @@ -84,9 +87,6 @@ error[E0277]: `*const ()` cannot be sent between threads safely
|
LL | fn mismatch() -> impl Iterator<Item: Copy, Item: Send> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
LL |
LL | iter::empty::<*const ()>()
| -------------------------- return type was inferred to be `std::iter::Empty<*const ()>` here
Comment on lines -87 to -89

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that recovering the "point at the return expression(s)" logic in the new solver should be doable? Might possibly need replacing some obligation cause codes so that appropriate info is tracked though.

|
= help: the trait `Send` is not implemented for `*const ()`

Expand All @@ -95,32 +95,18 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
|
LL | fn mismatch_2() -> impl Iterator<Item: Copy, Item: Send> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
LL |
LL | iter::empty::<String>()
| ----------------------- return type was inferred to be `std::iter::Empty<String>` here

error[E0271]: expected `IntoIter<u32, 1>` to be an iterator that yields `i32`, but it yields `u32`
--> $DIR/duplicate-bound-err.rs:103:17
|
LL | fn foo() -> impl Iterator<Item = i32, Item = u32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
...
LL | [2u32].into_iter()
| ------------------ return type was inferred to be `std::array::IntoIter<u32, 1>` here
|
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<Item = u32>` to be an iterator that yields `i32`, but it yields `u32`
error[E0284]: type annotations needed: cannot satisfy `<impl Iterator<Item = u32> as Iterator>::Item == i32`
--> $DIR/duplicate-bound-err.rs:103:17
|
LL | fn foo() -> impl Iterator<Item = i32, Item = u32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<impl Iterator<Item = u32> as Iterator>::Item == i32`
Comment on lines +105 to +109

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, unfortunate.

|
note: required by a bound in `Trait3::foo::{anon_assoc#0}`
--> $DIR/duplicate-bound-err.rs:99:31
Expand Down Expand Up @@ -273,5 +259,5 @@ LL | fn uncallable_rtn(_: impl Trait<foo(..): Trait<ASSOC = 3>, foo(..): Trait<A

error: aborting due to 25 previous errors

Some errors have detailed explanations: E0271, E0277, E0282, E0719.
Some errors have detailed explanations: E0271, E0277, E0282, E0284, E0719.
For more information about an error, try `rustc --explain E0271`.
Loading
Loading