improve error note
This commit is contained in:
parent
5bfdcc1ab1
commit
88d60941da
7 changed files with 7 additions and 7 deletions
|
@ -1828,7 +1828,7 @@ impl<'a> Parser<'a> {
|
||||||
let mut err = self.struct_span_err(self.prev_span,
|
let mut err = self.struct_span_err(self.prev_span,
|
||||||
"unexpected `self` argument in function");
|
"unexpected `self` argument in function");
|
||||||
err.span_label(self.prev_span,
|
err.span_label(self.prev_span,
|
||||||
"`self` is only valid as the first argument of a trait function");
|
"`self` is only valid as the first argument of an associated function");
|
||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn a(&self) { }
|
fn a(&self) { }
|
||||||
//~^ ERROR unexpected `self` argument in function
|
//~^ ERROR unexpected `self` argument in function
|
||||||
//~| NOTE `self` is only valid as the first argument of a trait function
|
//~| NOTE `self` is only valid as the first argument of an associated function
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -2,7 +2,7 @@ error: unexpected `self` argument in function
|
||||||
--> $DIR/bare-fn-start.rs:1:7
|
--> $DIR/bare-fn-start.rs:1:7
|
||||||
|
|
|
|
||||||
LL | fn a(&self) { }
|
LL | fn a(&self) { }
|
||||||
| ^^^^ `self` is only valid as the first argument of a trait function
|
| ^^^^ `self` is only valid as the first argument of an associated function
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fn b(foo: u32, &mut self) { }
|
fn b(foo: u32, &mut self) { }
|
||||||
//~^ ERROR unexpected `self` argument in function
|
//~^ ERROR unexpected `self` argument in function
|
||||||
//~| NOTE `self` is only valid as the first argument of a trait function
|
//~| NOTE `self` is only valid as the first argument of an associated function
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -2,7 +2,7 @@ error: unexpected `self` argument in function
|
||||||
--> $DIR/bare-fn.rs:1:21
|
--> $DIR/bare-fn.rs:1:21
|
||||||
|
|
|
|
||||||
LL | fn b(foo: u32, &mut self) { }
|
LL | fn b(foo: u32, &mut self) { }
|
||||||
| ^^^^ `self` is only valid as the first argument of a trait function
|
| ^^^^ `self` is only valid as the first argument of an associated function
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ struct Foo {}
|
||||||
impl Foo {
|
impl Foo {
|
||||||
fn c(foo: u32, self) {}
|
fn c(foo: u32, self) {}
|
||||||
//~^ ERROR unexpected `self` argument in function
|
//~^ ERROR unexpected `self` argument in function
|
||||||
//~| NOTE `self` is only valid as the first argument of a trait function
|
//~| NOTE `self` is only valid as the first argument of an associated function
|
||||||
|
|
||||||
fn good(&mut self, foo: u32) {}
|
fn good(&mut self, foo: u32) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ error: unexpected `self` argument in function
|
||||||
--> $DIR/trait-fn.rs:4:20
|
--> $DIR/trait-fn.rs:4:20
|
||||||
|
|
|
|
||||||
LL | fn c(foo: u32, self) {}
|
LL | fn c(foo: u32, self) {}
|
||||||
| ^^^^ `self` is only valid as the first argument of a trait function
|
| ^^^^ `self` is only valid as the first argument of an associated function
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue