Update E0033 to the new error format

This commit is contained in:
Panashe M. Fundira 2016-08-08 16:37:44 -04:00
parent 695b3d8279
commit b9762f8b8c
No known key found for this signature in database
GPG Key ID: ABD6E90F51BF74B5
2 changed files with 10 additions and 4 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

@ -15,5 +15,9 @@ trait SomeTrait {
fn main() {
let trait_obj: &SomeTrait = SomeTrait; //~ ERROR E0425
//~^ ERROR E0038
let &invalid = trait_obj; //~ ERROR E0033
//~| method `foo` has no receiver
let &invalid = trait_obj;
//~^ ERROR E0033
//~| NOTE type `&SomeTrait` cannot be dereferenced
}