Skip to content

Commit bf0623e

Browse files
Don't suggest dyn as parameter to add
1 parent 950b47f commit bf0623e

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

Diff for: compiler/rustc_resolve/src/late/diagnostics.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,11 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
20652065
path: &[Segment],
20662066
) -> Option<(Span, &'static str, String, Applicability)> {
20672067
let (ident, span) = match path {
2068-
[segment] if !segment.has_generic_args && segment.ident.name != kw::SelfUpper => {
2068+
[segment]
2069+
if !segment.has_generic_args
2070+
&& segment.ident.name != kw::SelfUpper
2071+
&& segment.ident.name != kw::Dyn =>
2072+
{
20692073
(segment.ident.to_string(), segment.ident.span)
20702074
}
20712075
_ => return None,

Diff for: src/tools/clippy/tests/ui/crashes/ice-6252.stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ error[E0412]: cannot find type `VAL` in this scope
1717
--> $DIR/ice-6252.rs:10:63
1818
|
1919
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
20-
| - ^^^ not found in this scope
21-
| |
22-
| help: you might be missing a type parameter: `, VAL`
20+
| ^^^ not found in this scope
21+
|
22+
help: you might be missing a type parameter
23+
|
24+
LL | impl<N, M, VAL> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
25+
| +++++
2326

2427
error[E0046]: not all trait items implemented, missing: `VAL`
2528
--> $DIR/ice-6252.rs:10:1

Diff for: tests/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

Diff for: tests/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)