Skip to content

Commit

Permalink
Update lib.rs
Browse files Browse the repository at this point in the history
Update lib.rs
Update lib.rs
Update E0438.rs
Update E0437.rs
Update E0435.rs
  • Loading branch information
shyamsundarb-arch committed Aug 21, 2016
1 parent 99867ee commit 738b91e
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 @@ -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

0 comments on commit 738b91e

Please sign in to comment.