path_name)
}
ResolutionError::SelfNotAvailableInStaticMethod => {
- struct_span_err!(resolver.session,
+ let mut err = struct_span_err!(resolver.session,
span,
E0424,
- "`self` is not available in a static method. Maybe a `self` \
- argument is missing?")
+ "`self` is not available in a static method");
+ 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,
is_field, def } => {
fn bar(self) {}
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?
}
}
impl cat {
fn meow() {
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");
}
}