File tree Expand file tree Collapse file tree 4 files changed +35
-8
lines changed
Expand file tree Collapse file tree 4 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -6055,7 +6055,13 @@ impl<'a> Parser<'a> {
60556055 Some ( ty_second) => {
60566056 // impl Trait for Type
60576057 if !has_for {
6058- self . span_err ( missing_for_span, "missing `for` in a trait impl" ) ;
6058+ self . struct_span_err ( missing_for_span, "missing `for` in a trait impl" )
6059+ . span_suggestion_short_with_applicability (
6060+ missing_for_span,
6061+ "add `for` here" ,
6062+ " for " . to_string ( ) ,
6063+ Applicability :: MachineApplicable ,
6064+ ) . emit ( ) ;
60596065 }
60606066
60616067 let ty_first = ty_first. into_inner ( ) ;
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ error: missing `for` in a trait impl
22 --> $DIR/impl-parsing.rs:6:11
33 |
44LL | impl Trait Type {} //~ ERROR missing `for` in a trait impl
5- | ^
5+ | ^ help: add `for` here
66
77error: missing `for` in a trait impl
88 --> $DIR/impl-parsing.rs:7:11
99 |
1010LL | impl Trait .. {} //~ ERROR missing `for` in a trait impl
11- | ^
11+ | ^ help: add `for` here
1212
1313error: expected a trait, found type
1414 --> $DIR/impl-parsing.rs:8:6
Original file line number Diff line number Diff line change 1- impl A .. { } //~ ERROR
1+ trait A { }
2+
3+ impl A .. { }
4+ //~^ ERROR missing `for` in a trait impl
5+ //~| ERROR `impl Trait for .. {}` is an obsolete syntax
6+
7+ impl A usize { }
8+ //~^ ERROR missing `for` in a trait impl
29
310fn main ( ) { }
Original file line number Diff line number Diff line change 11error: missing `for` in a trait impl
2- --> $DIR/issue-27255.rs:1 :7
2+ --> $DIR/issue-27255.rs:3 :7
33 |
4- LL | impl A .. {} //~ ERROR
5- | ^
4+ LL | impl A .. {}
5+ | ^ help: add `for` here
66
7- error: aborting due to previous error
7+ error: missing `for` in a trait impl
8+ --> $DIR/issue-27255.rs:7:7
9+ |
10+ LL | impl A usize {}
11+ | ^^^^^^ help: add `for` here
12+
13+ error: `impl Trait for .. {}` is an obsolete syntax
14+ --> $DIR/issue-27255.rs:3:1
15+ |
16+ LL | impl A .. {}
17+ | ^^^^^^^^^^^^
18+ |
19+ = help: use `auto trait Trait {}` instead
20+
21+ error: aborting due to 3 previous errors
822
You can’t perform that action at this time.
0 commit comments