Skip to content

Commit

Permalink
Rollup merge of rust-lang#35841 - kyrias:new-error-E0424, r=Guillaume…
Browse files Browse the repository at this point in the history
…Gomez

Update E0424 to the new error format

Fixes rust-lang#35797.
Part of rust-lang#35233.

r? @GuillaumeGomez
  • Loading branch information
Jonathan Turner authored Aug 22, 2016
2 parents ae83225 + ff44f08 commit cc51d1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,13 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
err
}
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 } => {
Expand Down
5 changes: 4 additions & 1 deletion src/test/compile-fail/E0424.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ impl Foo {
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?
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-2356.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ impl cat {
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");
}
}
Expand Down

0 comments on commit cc51d1c

Please sign in to comment.