Continue evaluating after missing for
in impl Trait for Foo
This commit is contained in:
parent
d8610b31ec
commit
5d2f31cddc
@ -6055,7 +6055,13 @@ impl<'a> Parser<'a> {
|
||||
Some(ty_second) => {
|
||||
// impl Trait for Type
|
||||
if !has_for {
|
||||
self.span_err(missing_for_span, "missing `for` in a trait impl");
|
||||
self.struct_span_err(missing_for_span, "missing `for` in a trait impl")
|
||||
.span_suggestion_short_with_applicability(
|
||||
missing_for_span,
|
||||
"add `for` here",
|
||||
" for ".to_string(),
|
||||
Applicability::MachineApplicable,
|
||||
).emit();
|
||||
}
|
||||
|
||||
let ty_first = ty_first.into_inner();
|
||||
|
@ -2,13 +2,13 @@ error: missing `for` in a trait impl
|
||||
--> $DIR/impl-parsing.rs:6:11
|
||||
|
|
||||
LL | impl Trait Type {} //~ ERROR missing `for` in a trait impl
|
||||
| ^
|
||||
| ^ help: add `for` here
|
||||
|
||||
error: missing `for` in a trait impl
|
||||
--> $DIR/impl-parsing.rs:7:11
|
||||
|
|
||||
LL | impl Trait .. {} //~ ERROR missing `for` in a trait impl
|
||||
| ^
|
||||
| ^ help: add `for` here
|
||||
|
||||
error: expected a trait, found type
|
||||
--> $DIR/impl-parsing.rs:8:6
|
||||
|
@ -1,3 +1,10 @@
|
||||
impl A .. {} //~ ERROR
|
||||
trait A {}
|
||||
|
||||
impl A .. {}
|
||||
//~^ ERROR missing `for` in a trait impl
|
||||
//~| ERROR `impl Trait for .. {}` is an obsolete syntax
|
||||
|
||||
impl A usize {}
|
||||
//~^ ERROR missing `for` in a trait impl
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,8 +1,22 @@
|
||||
error: missing `for` in a trait impl
|
||||
--> $DIR/issue-27255.rs:1:7
|
||||
--> $DIR/issue-27255.rs:3:7
|
||||
|
|
||||
LL | impl A .. {} //~ ERROR
|
||||
| ^
|
||||
LL | impl A .. {}
|
||||
| ^ help: add `for` here
|
||||
|
||||
error: aborting due to previous error
|
||||
error: missing `for` in a trait impl
|
||||
--> $DIR/issue-27255.rs:7:7
|
||||
|
|
||||
LL | impl A usize {}
|
||||
| ^^^^^^ help: add `for` here
|
||||
|
||||
error: `impl Trait for .. {}` is an obsolete syntax
|
||||
--> $DIR/issue-27255.rs:3:1
|
||||
|
|
||||
LL | impl A .. {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= help: use `auto trait Trait {}` instead
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user