Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E0435, E0437 & E0438 New Error Format #35858

Merged
merged 1 commit into from
Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,24 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
err
}
ResolutionError::TypeNotMemberOfTrait(type_, trait_) => {
struct_span_err!(resolver.session,
let mut err = struct_span_err!(resolver.session,
span,
E0437,
"type `{}` is not a member of trait `{}`",
type_,
trait_)
trait_);
err.span_label(span, &format!("not a member of trait `Foo`"));
err
}
ResolutionError::ConstNotMemberOfTrait(const_, trait_) => {
struct_span_err!(resolver.session,
let mut err = struct_span_err!(resolver.session,
span,
E0438,
"const `{}` is not a member of trait `{}`",
const_,
trait_)
trait_);
err.span_label(span, &format!("not a member of trait `Foo`"));
err
}
ResolutionError::VariableNotBoundInPattern(variable_name, from, to) => {
struct_span_err!(resolver.session,
Expand Down Expand Up @@ -438,10 +442,12 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
closure form instead")
}
ResolutionError::AttemptToUseNonConstantValueInConstant => {
struct_span_err!(resolver.session,
let mut err = struct_span_err!(resolver.session,
span,
E0435,
"attempt to use a non-constant value in a constant")
"attempt to use a non-constant value in a constant");
err.span_label(span, &format!("non-constant used with constant"));
err
}
ResolutionError::BindingShadowsSomethingUnacceptable(what_binding, name, binding) => {
let shadows_what = PathResolution::new(binding.def().unwrap()).kind_name();
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0435.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
fn main () {
let foo = 42u32;
const FOO : u32 = foo; //~ ERROR E0435
//~| NOTE non-constant used with constant
}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0437.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ trait Foo {}

impl Foo for i32 {
type Bar = bool; //~ ERROR E0437
//~| NOTE not a member of trait `Foo`
}

fn main () {
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0438.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trait Foo {}

impl Foo for i32 {
const BAR: bool = true; //~ ERROR E0438
//~| NOTE not a member of trait `Foo`
}

fn main () {
Expand Down