Skip to content

Commit

Permalink
Rollup merge of rust-lang#35526 - munyari:e0033, r=jonathandturner
Browse files Browse the repository at this point in the history
Update E0033 to the new error format

Part of rust-lang#35233

Addresses rust-lang#35498
"r? @jonathandturner
  • Loading branch information
eddyb authored Aug 14, 2016
2 parents 9f87b1f + 80beeb3 commit 45c3b4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
if let ty::TyTrait(..) = mt.ty.sty {
// This is "x = SomeTrait" being reduced from
// "let &x = &SomeTrait" or "let box x = Box<SomeTrait>", an error.
span_err!(self.tcx.sess, span, E0033,
"type `{}` cannot be dereferenced",
self.ty_to_string(expected));
let type_str = self.ty_to_string(expected);
struct_span_err!(self.tcx.sess, span, E0033,
"type `{}` cannot be dereferenced", type_str)
.span_label(span, &format!("type `{}` cannot be dereferenced", type_str))
.emit();
return false
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/test/compile-fail/E0033.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ trait SomeTrait {
fn main() {
let trait_obj: &SomeTrait = SomeTrait; //~ ERROR E0425
//~^ ERROR E0038
let &invalid = trait_obj; //~ ERROR E0033
//~| method `foo` has no receiver
//~| NOTE the trait `SomeTrait` cannot be made into an object

let &invalid = trait_obj;
//~^ ERROR E0033
//~| NOTE type `&SomeTrait` cannot be dereferenced
}

0 comments on commit 45c3b4c

Please sign in to comment.