From 40b2e512eb3dcc66a042638cac9104ed0f6be85c Mon Sep 17 00:00:00 2001 From: "Panashe M. Fundira" Date: Mon, 8 Aug 2016 16:37:44 -0400 Subject: [PATCH] Update E0033 to the new error format --- src/librustc_typeck/check/_match.rs | 8 +++++--- src/test/compile-fail/E0033.rs | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index fe68690d4e974..ab2d9226aa822 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -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", 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 } } diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs index 946600013f33d..fe75b6b1f0f1b 100644 --- a/src/test/compile-fail/E0033.rs +++ b/src/test/compile-fail/E0033.rs @@ -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 }