Rollup merge of #35526 - munyari:e0033, r=jonathandturner

Update E0033 to the new error format

Part of #35233

Addresses #35498
"r? @jonathandturner
This commit is contained in:
Jonathan Turner 2016-08-22 15:34:19 -07:00 committed by GitHub
commit f46438c71a
2 changed files with 14 additions and 6 deletions

View file

@ -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
}
}

View file

@ -13,7 +13,13 @@ trait SomeTrait {
}
fn main() {
let trait_obj: &SomeTrait = SomeTrait; //~ ERROR E0425
//~^ ERROR E0038
let &invalid = trait_obj; //~ ERROR E0033
let trait_obj: &SomeTrait = SomeTrait;
//~^ ERROR E0425
//~| ERROR E0038
//~| 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
}