From b9762f8b8c5576fec873132876c4ea0f624e486c Mon Sep 17 00:00:00 2001 From: "Panashe M. Fundira" Date: Mon, 8 Aug 2016 16:37:44 -0400 Subject: [PATCH 1/3] 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 5f255cc1fb730..db161379920e3 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 } From 80beeb35744f97d65759fec662043cbe34857e8b Mon Sep 17 00:00:00 2001 From: "Panashe M. Fundira" Date: Thu, 11 Aug 2016 14:03:38 -0400 Subject: [PATCH 2/3] Add additional error note --- src/test/compile-fail/E0033.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs index fe75b6b1f0f1b..8a1cd2ef4b71c 100644 --- a/src/test/compile-fail/E0033.rs +++ b/src/test/compile-fail/E0033.rs @@ -16,6 +16,7 @@ fn main() { 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 From a37e90a8c9945083f58e608ebe9414e5fdb53333 Mon Sep 17 00:00:00 2001 From: "Panashe M. Fundira" Date: Sun, 14 Aug 2016 19:48:55 -0400 Subject: [PATCH 3/3] Make E0033 tests fit in 100 cols --- src/test/compile-fail/E0033.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs index 8a1cd2ef4b71c..d320bcd4d0f55 100644 --- a/src/test/compile-fail/E0033.rs +++ b/src/test/compile-fail/E0033.rs @@ -13,10 +13,11 @@ trait SomeTrait { } fn main() { - 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 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