Rollup merge of #35841 - kyrias:new-error-E0424, r=GuillaumeGomez
Update E0424 to the new error format Fixes #35797. Part of #35233. r? @GuillaumeGomez
This commit is contained in:
commit
cc51d1c21d
@ -346,11 +346,13 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
|
|||||||
err
|
err
|
||||||
}
|
}
|
||||||
ResolutionError::SelfNotAvailableInStaticMethod => {
|
ResolutionError::SelfNotAvailableInStaticMethod => {
|
||||||
struct_span_err!(resolver.session,
|
let mut err = struct_span_err!(resolver.session,
|
||||||
span,
|
span,
|
||||||
E0424,
|
E0424,
|
||||||
"`self` is not available in a static method. Maybe a `self` \
|
"`self` is not available in a static method");
|
||||||
argument is missing?")
|
err.span_label(span, &format!("not available in static method"));
|
||||||
|
err.note(&format!("maybe a `self` argument is missing?"));
|
||||||
|
err
|
||||||
}
|
}
|
||||||
ResolutionError::UnresolvedName { path, message: msg, context, is_static_method,
|
ResolutionError::UnresolvedName { path, message: msg, context, is_static_method,
|
||||||
is_field, def } => {
|
is_field, def } => {
|
||||||
|
@ -14,7 +14,10 @@ impl Foo {
|
|||||||
fn bar(self) {}
|
fn bar(self) {}
|
||||||
|
|
||||||
fn foo() {
|
fn foo() {
|
||||||
self.bar(); //~ ERROR E0424
|
self.bar();
|
||||||
|
//~^ ERROR `self` is not available in a static method [E0424]
|
||||||
|
//~| NOTE not available in static method
|
||||||
|
//~| NOTE maybe a `self` argument is missing?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,9 @@ impl cat {
|
|||||||
impl cat {
|
impl cat {
|
||||||
fn meow() {
|
fn meow() {
|
||||||
if self.whiskers > 3 {
|
if self.whiskers > 3 {
|
||||||
//~^ ERROR: `self` is not available in a static method. Maybe a `self` argument is missing?
|
//~^ ERROR `self` is not available in a static method [E0424]
|
||||||
|
//~| NOTE not available in static method
|
||||||
|
//~| NOTE maybe a `self` argument is missing?
|
||||||
println!("MEOW");
|
println!("MEOW");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user