Skip to content

Commit 384d387

Browse files
Harmonize use of leaf and root obligation in trait error reporting
1 parent cfdb617 commit 384d387

File tree

12 files changed

+74
-64
lines changed

12 files changed

+74
-64
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `&'static u32: Defaulted` is not satisfied
22
--> $DIR/typeck-default-trait-impl-precedence.rs:19:20
33
|
44
LL | is_defaulted::<&'static u32>();
5-
| ^^^^^^^^^^^^ the trait `Signed` is not implemented for `&'static u32`, which is required by `&'static u32: Defaulted`
5+
| ^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32`, which is required by `&'static u32: Defaulted`
66
|
77
note: required for `&'static u32` to implement `Defaulted`
88
--> $DIR/typeck-default-trait-impl-precedence.rs:10:19

tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `i32: Baz<Self>` is not satisfied
22
--> $DIR/assume-gat-normalization-for-nested-goals.rs:9:30
33
|
44
LL | type Bar<T>: Baz<Self> = i32;
5-
| ^^^ the trait `Eq<i32>` is not implemented for `i32`, which is required by `i32: Baz<Self>`
5+
| ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`, which is required by `i32: Baz<Self>`
66
|
77
note: required for `i32` to implement `Baz<Self>`
88
--> $DIR/assume-gat-normalization-for-nested-goals.rs:16:23

tests/ui/kindck/kindck-send-object.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: `&'static (dyn Dummy + 'static)` cannot be sent between threads sa
44
LL | assert_send::<&'static (dyn Dummy + 'static)>();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'static (dyn Dummy + 'static)` cannot be sent between threads safely
66
|
7-
= help: the trait `Sync` is not implemented for `&'static (dyn Dummy + 'static)`, which is required by `&'static (dyn Dummy + 'static): Send`
7+
= help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)`, which is required by `&'static (dyn Dummy + 'static): Send`
88
= note: required for `&'static (dyn Dummy + 'static)` to implement `Send`
99
note: required by a bound in `assert_send`
1010
--> $DIR/kindck-send-object.rs:5:18

tests/ui/kindck/kindck-send-object1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: `&'a (dyn Dummy + 'a)` cannot be sent between threads safely
44
LL | assert_send::<&'a dyn Dummy>();
55
| ^^^^^^^^^^^^^ `&'a (dyn Dummy + 'a)` cannot be sent between threads safely
66
|
7-
= help: the trait `Sync` is not implemented for `&'a (dyn Dummy + 'a)`, which is required by `&'a (dyn Dummy + 'a): Send`
7+
= help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)`, which is required by `&'a (dyn Dummy + 'a): Send`
88
= note: required for `&'a (dyn Dummy + 'a)` to implement `Send`
99
note: required by a bound in `assert_send`
1010
--> $DIR/kindck-send-object1.rs:5:18

tests/ui/kindck/kindck-send-object2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: `&'static (dyn Dummy + 'static)` cannot be sent between threads sa
44
LL | assert_send::<&'static dyn Dummy>();
55
| ^^^^^^^^^^^^^^^^^^ `&'static (dyn Dummy + 'static)` cannot be sent between threads safely
66
|
7-
= help: the trait `Sync` is not implemented for `&'static (dyn Dummy + 'static)`, which is required by `&'static (dyn Dummy + 'static): Send`
7+
= help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)`, which is required by `&'static (dyn Dummy + 'static): Send`
88
= note: required for `&'static (dyn Dummy + 'static)` to implement `Send`
99
note: required by a bound in `assert_send`
1010
--> $DIR/kindck-send-object2.rs:3:18

tests/ui/suggestions/suggest-remove-refs-5.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: `&mut &mut &mut &mut Vec<i32>` is not an iterator
44
LL | for _ in &mut &mut v {}
55
| ^^^^^^^^^^^ `&mut &mut &mut &mut Vec<i32>` is not an iterator
66
|
7-
= help: the trait `Iterator` is not implemented for `&mut &mut &mut &mut Vec<i32>`, which is required by `&mut &mut &mut &mut Vec<i32>: IntoIterator`
7+
= help: the trait `Iterator` is not implemented for `Vec<i32>`, which is required by `&mut &mut &mut &mut Vec<i32>: IntoIterator`
88
= note: required for `&mut Vec<i32>` to implement `Iterator`
99
= note: 3 redundant requirements hidden
1010
= note: required for `&mut &mut &mut &mut Vec<i32>` to implement `Iterator`
@@ -21,7 +21,7 @@ error[E0277]: `&mut &mut &mut [u8; 1]` is not an iterator
2121
LL | for _ in &mut v {}
2222
| ^^^^^^ `&mut &mut &mut [u8; 1]` is not an iterator
2323
|
24-
= help: the trait `Iterator` is not implemented for `&mut &mut &mut [u8; 1]`, which is required by `&mut &mut &mut [u8; 1]: IntoIterator`
24+
= help: the trait `Iterator` is not implemented for `[u8; 1]`, which is required by `&mut &mut &mut [u8; 1]: IntoIterator`
2525
= note: required for `&mut [u8; 1]` to implement `Iterator`
2626
= note: 2 redundant requirements hidden
2727
= note: required for `&mut &mut &mut [u8; 1]` to implement `Iterator`

tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
44
LL | is_send(foo());
55
| ^^^^^ future returned by `foo` is not `Send`
66
|
7-
= help: the trait `Sync` is not implemented for `impl Future<Output = ()>`, which is required by `impl Future<Output = ()>: Send`
7+
= help: the trait `Sync` is not implemented for `NotSync`, which is required by `impl Future<Output = ()>: Send`
88
note: future is not `Send` as this value is used across an await
99
--> $DIR/auto-with-drop_tracking_mir.rs:16:11
1010
|

tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `(): Foo` is not satisfied
44
LL | needs_foo::<()>();
55
| ^^ the trait `Bar` is not implemented for `()`, which is required by `(): Foo`
66
|
7+
help: this trait has no implementations, consider adding one
8+
--> $DIR/point-at-failing-nested.rs:4:1
9+
|
10+
LL | trait Bar {}
11+
| ^^^^^^^^^
712
note: required for `()` to implement `Foo`
813
--> $DIR/point-at-failing-nested.rs:9:12
914
|

tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ LL | needs_foo(());
66
| |
77
| required by a bound introduced by this call
88
|
9+
help: this trait has no implementations, consider adding one
10+
--> $DIR/where-clause-doesnt-apply.rs:2:1
11+
|
12+
LL | trait Bar {}
13+
| ^^^^^^^^^
914
note: required for `()` to implement `Foo`
1015
--> $DIR/where-clause-doesnt-apply.rs:4:9
1116
|

tests/ui/traits/suggest-dereferences/root-obligation.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied
22
--> $DIR/root-obligation.rs:6:38
33
|
44
LL | .filter(|c| "aeiou".contains(c))
5-
| -------- ^ the trait `Fn(char)` is not implemented for `&char`, which is required by `&char: Pattern<'_>`
5+
| -------- ^ the trait `Fn(char)` is not implemented for `char`, which is required by `&char: Pattern<'_>`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/transmutability/references/unsafecell.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: `&u8` cannot be safely transmuted into `&UnsafeCell<u8>`
22
--> $DIR/unsafecell.rs:27:50
33
|
44
LL | assert::is_maybe_transmutable::<&'static u8, &'static UnsafeCell<u8>>();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `&'static UnsafeCell<u8>`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `UnsafeCell<u8>`
66
|
77
note: required by a bound in `is_maybe_transmutable`
88
--> $DIR/unsafecell.rs:12:14
@@ -17,7 +17,7 @@ error[E0277]: `&UnsafeCell<u8>` cannot be safely transmuted into `&UnsafeCell<u8
1717
--> $DIR/unsafecell.rs:29:62
1818
|
1919
LL | assert::is_maybe_transmutable::<&'static UnsafeCell<u8>, &'static UnsafeCell<u8>>();
20-
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `&'static UnsafeCell<u8>`
20+
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Freeze` is not implemented for `UnsafeCell<u8>`
2121
|
2222
note: required by a bound in `is_maybe_transmutable`
2323
--> $DIR/unsafecell.rs:12:14

0 commit comments

Comments
 (0)