Skip to content

Commit 21ff605

Browse files
Don't suggest dyn as parameter to add
1 parent 04f3e16 commit 21ff605

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

compiler/rustc_resolve/src/late/diagnostics.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,11 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
20542054
path: &[Segment],
20552055
) -> Option<(Span, &'static str, String, Applicability)> {
20562056
let (ident, span) = match path {
2057-
[segment] if !segment.has_generic_args && segment.ident.name != kw::SelfUpper => {
2057+
[segment]
2058+
if !segment.has_generic_args
2059+
&& segment.ident.name != kw::SelfUpper
2060+
&& segment.ident.name != kw::Dyn =>
2061+
{
20582062
(segment.ident.to_string(), segment.ident.span)
20592063
}
20602064
_ => return None,

src/test/ui/issues/issue-86756.stderr

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ error[E0412]: cannot find type `dyn` in this scope
1111
|
1212
LL | eq::<dyn, Foo>
1313
| ^^^ not found in this scope
14-
|
15-
help: you might be missing a type parameter
16-
|
17-
LL | fn eq<A, B, dyn>() {
18-
| +++++
1914

2015
warning: trait objects without an explicit `dyn` are deprecated
2116
--> $DIR/issue-86756.rs:5:15

src/test/ui/parser/dyn-trait-compatibility.stderr

-15
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,12 @@ error[E0412]: cannot find type `dyn` in this scope
2727
|
2828
LL | type A2 = dyn<dyn, dyn>;
2929
| ^^^ not found in this scope
30-
|
31-
help: you might be missing a type parameter
32-
|
33-
LL | type A2<dyn> = dyn<dyn, dyn>;
34-
| +++++
3530

3631
error[E0412]: cannot find type `dyn` in this scope
3732
--> $DIR/dyn-trait-compatibility.rs:5:20
3833
|
3934
LL | type A2 = dyn<dyn, dyn>;
4035
| ^^^ not found in this scope
41-
|
42-
help: you might be missing a type parameter
43-
|
44-
LL | type A2<dyn> = dyn<dyn, dyn>;
45-
| +++++
4636

4737
error[E0412]: cannot find type `dyn` in this scope
4838
--> $DIR/dyn-trait-compatibility.rs:9:11
@@ -55,11 +45,6 @@ error[E0412]: cannot find type `dyn` in this scope
5545
|
5646
LL | type A3 = dyn<<dyn as dyn>::dyn>;
5747
| ^^^ not found in this scope
58-
|
59-
help: you might be missing a type parameter
60-
|
61-
LL | type A3<dyn> = dyn<<dyn as dyn>::dyn>;
62-
| +++++
6348

6449
error: aborting due to 8 previous errors
6550

0 commit comments

Comments
 (0)