Skip to content

Commit

Permalink
Rollup merge of rust-lang#35858 - shyaamsundhar:patch-1, r=GuillaumeG…
Browse files Browse the repository at this point in the history
…omez

E0435, E0437 & E0438 New Error Format

Part of rust-lang#35801 , rust-lang#35802 and rust-lang#35803
r? @GuillaumeGomez

Hi! Please review the changes.
  • Loading branch information
Jonathan Turner authored Aug 22, 2016
2 parents ca86803 + 738b91e commit 631fe3b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
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 @@ -442,10 +446,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

0 comments on commit 631fe3b

Please sign in to comment.