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 8, 2023
1 parent 04f3e16 commit 21ff605
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 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 @@ -2054,7 +2054,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
5 changes: 0 additions & 5 deletions src/test/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 src/test/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 21ff605

Please sign in to comment.