You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 79adcd1
Browse filesBrowse the repository at this point in the historyBrowse files
Rollup merge of #150424 - xonx4l:suggest_param_env_shadowing, r=lcnr
diagnostics: add note when param-env shadows global impl
This PR adds a diagnostics note when param-env shadows global impl as discussed in #149910
It adds a note explaining that the definition is hidden by the generic bound.
r?lcnr
"the associated type `{}` is defined as `{}` in the implementation, \
312
+
but the where-bound `{}` shadows this definition\n\
313
+
see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information",
Copy file name to clipboardExpand all lines: tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ LL | const N: C::M = 4u8;
6
6
|
7
7
= note: expected associated type `<C as O>::M`
8
8
found type `u8`
9
+
= note: the associated type `<C as O>::M` is defined as `u8` in the implementation, but the where-bound `C` shadows this definition
10
+
see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
9
11
help: consider constraining the associated type `<C as O>::M` to `u8`
= help: consider constraining the associated type `<A2<T> as Tr>::Ty` to `u8` or calling a method that returns `<A2<T> as Tr>::Ty`
77
77
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
78
+
= note: the associated type `<A2<T> as Tr>::Ty` is defined as `u8` in the implementation, but the where-bound `A2<T>` shadows this definition
79
+
see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
= note: expected associated type `<B2<T> as Tr>::Ty`
91
93
found type `bool`
94
+
= note: the associated type `<B2<T> as Tr>::Ty` is defined as `bool` in the implementation, but the where-bound `B2<T>` shadows this definition
95
+
see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
92
96
93
97
error[E0308]: mismatched types
94
98
--> $DIR/defaults-specialization.rs:87:32
@@ -121,6 +125,8 @@ help: a method is available that returns `<B<()> as Tr>::Ty`
= note: the associated type `<B<()> as Tr>::Ty` is defined as `bool` in the implementation, but the where-bound `B<()>` shadows this definition
129
+
see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
124
130
125
131
error[E0308]: mismatched types
126
132
--> $DIR/defaults-specialization.rs:89:33
@@ -153,6 +159,8 @@ help: a method is available that returns `<B2<()> as Tr>::Ty`
= note: the associated type `<B2<()> as Tr>::Ty` is defined as `bool` in the implementation, but the where-bound `B2<()>` shadows this definition
163
+
see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
156
164
157
165
error: aborting due to 9 previous errors; 1 warning emitted
| - -------- expected `<T as Trait>::Assoc` because of return type
6
+
| |
7
+
| found this type parameter
8
+
LL | x
9
+
| ^ expected associated type, found type parameter `T`
10
+
|
11
+
= note: expected associated type `<T as Trait>::Assoc`
12
+
found type parameter `T`
13
+
= note: the associated type `<T as Trait>::Assoc` is defined as `T` in the implementation, but the where-bound `T` shadows this definition
14
+
see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
0 commit comments