Skip to content

Commit

Permalink
Don't suggest dyn as parameter to add
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jan 12, 2023
1 parent 950b47f commit bf0623e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
6 changes: 5 additions & 1 deletion compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,11 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
path: &[Segment],
) -> Option<(Span, &'static str, String, Applicability)> {
let (ident, span) = match path {
[segment] if !segment.has_generic_args && segment.ident.name != kw::SelfUpper => {
[segment]
if !segment.has_generic_args
&& segment.ident.name != kw::SelfUpper
&& segment.ident.name != kw::Dyn =>
{
(segment.ident.to_string(), segment.ident.span)
}
_ => return None,
Expand Down
9 changes: 6 additions & 3 deletions src/tools/clippy/tests/ui/crashes/ice-6252.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ error[E0412]: cannot find type `VAL` in this scope
--> $DIR/ice-6252.rs:10:63
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| - ^^^ not found in this scope
| |
| help: you might be missing a type parameter: `, VAL`
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | impl<N, M, VAL> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| +++++

error[E0046]: not all trait items implemented, missing: `VAL`
--> $DIR/ice-6252.rs:10:1
Expand Down
5 changes: 0 additions & 5 deletions tests/ui/issues/issue-86756.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ error[E0412]: cannot find type `dyn` in this scope
|
LL | eq::<dyn, Foo>
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | fn eq<A, B, dyn>() {
| +++++

warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-86756.rs:5:15
Expand Down
15 changes: 0 additions & 15 deletions tests/ui/parser/dyn-trait-compatibility.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,12 @@ error[E0412]: cannot find type `dyn` in this scope
|
LL | type A2 = dyn<dyn, dyn>;
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | type A2<dyn> = dyn<dyn, dyn>;
| +++++

error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:5:20
|
LL | type A2 = dyn<dyn, dyn>;
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | type A2<dyn> = dyn<dyn, dyn>;
| +++++

error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:9:11
Expand All @@ -55,11 +45,6 @@ error[E0412]: cannot find type `dyn` in this scope
|
LL | type A3 = dyn<<dyn as dyn>::dyn>;
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | type A3<dyn> = dyn<<dyn as dyn>::dyn>;
| +++++

error: aborting due to 8 previous errors

Expand Down

0 comments on commit bf0623e

Please sign in to comment.