Updated E0423 to new format

This commit is contained in:
Knight 2016-08-22 13:57:37 +08:00
parent a4c6307a15
commit 8fdc531446
4 changed files with 11 additions and 4 deletions

View File

@ -336,12 +336,14 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
err
}
ResolutionError::StructVariantUsedAsFunction(path_name) => {
struct_span_err!(resolver.session,
let mut err = struct_span_err!(resolver.session,
span,
E0423,
"`{}` is the name of a struct or struct variant, but this expression \
uses it like a function name",
path_name)
path_name);
err.span_label(span, &format!("struct called like a function"));
err
}
ResolutionError::SelfNotAvailableInStaticMethod => {
struct_span_err!(resolver.session,

View File

@ -12,4 +12,5 @@ fn main () {
struct Foo { a: bool };
let f = Foo(); //~ ERROR E0423
//~^ struct called like a function
}

View File

@ -13,5 +13,7 @@ enum Foo {
}
fn main() {
let f = Foo::Variant(42); //~ ERROR uses it like a function
let f = Foo::Variant(42);
//~^ ERROR uses it like a function
//~| struct called like a function
}

View File

@ -13,5 +13,7 @@ enum Homura {
}
fn main() {
let homura = Homura::Madoka; //~ ERROR uses it like a function
let homura = Homura::Madoka;
//~^ ERROR uses it like a function
//~| struct called like a function
}