]> git.lizzy.rs Git - rust.git/commitdiff
Update E0038 to the new error format
authorPanashe M. Fundira <fundirap@gmail.com>
Mon, 8 Aug 2016 22:54:16 +0000 (18:54 -0400)
committerPanashe M. Fundira <fundirap@gmail.com>
Tue, 9 Aug 2016 17:59:00 +0000 (13:59 -0400)
src/librustc/traits/error_reporting.rs
src/test/compile-fail/E0038.rs
src/test/compile-fail/issue-20692.rs
src/test/compile-fail/issue-26056.rs
src/test/compile-fail/object-safety-generics.rs
src/test/compile-fail/object-safety-mentions-Self.rs
src/test/compile-fail/object-safety-sized.rs
src/test/compile-fail/object-safety-supertrait-mentions-Self.rs

index 9950560b13a5a7cda70ccd0d38ccc2fedf6a6c46..4725272d2b69ae51d762663297639665d3c46d3a 100644 (file)
@@ -670,10 +670,15 @@ pub fn report_object_safety_error(self,
         let mut err = match warning_node_id {
             Some(_) => None,
             None => {
-                Some(struct_span_err!(
-                    self.sess, span, E0038,
-                    "the trait `{}` cannot be made into an object",
-                    self.item_path_str(trait_def_id)))
+                let trait_str = self.item_path_str(trait_def_id);
+                let mut db = struct_span_err!(
+                            self.sess, span, E0038,
+                            "the trait `{}` cannot be made into an object",
+                            trait_str);
+                db.span_label(span,
+                              &format!("the trait `{}` cannot be made \
+                              into an object", trait_str));
+                Some(db)
             }
         };
 
index 26d2f339763aa6c91639202dd6d118b8c0d14f23..6cf3f1ebf19e4526d1c8b6b37fe6af2a9b4bd894 100644 (file)
@@ -12,7 +12,10 @@ trait Trait {
     fn foo(&self) -> Self;
 }
 
-fn call_foo(x: Box<Trait>) { //~ ERROR E0038
+fn call_foo(x: Box<Trait>) {
+    //~^ ERROR E0038
+    //~| NOTE the trait `Trait` cannot be made into an object
+    //~| NOTE method `foo` references the `Self` type in its arguments or return type
     let y = x.foo();
 }
 
index 1c9e588cb2cd18c051d904b69947ff8c549c4b41..3e44053875552cbf8fbc194c2939969c89a65365 100644 (file)
@@ -15,10 +15,12 @@ fn f<T: Array>(x: &T) {
     //~^ ERROR `Array` cannot be made into an object
     //~| NOTE the trait cannot require that `Self : Sized`
     //~| NOTE requirements on the impl of `std::ops::CoerceUnsized<&Array>`
+    //~| NOTE the trait `Array` cannot be made into an object
     as
     &Array;
     //~^ ERROR `Array` cannot be made into an object
     //~| NOTE the trait cannot require that `Self : Sized`
+    //~| NOTE the trait `Array` cannot be made into an object
 }
 
 fn main() {}
index 4e9cbc4f283b4e12a2d3b950e99dfce3505f177f..ded685152d49b63c83a0371c41e6cabcc301e369 100644 (file)
@@ -28,6 +28,7 @@ impl<K> Map for K {
 fn main() {
     let _ = &()
         as &Map<Key=u32,MapValue=u32>;
-    //~^ ERROR the trait `Map` cannot be made into an object
+    //~^ ERROR E0038
     //~| NOTE the trait cannot use `Self` as a type parameter
+    //~| NOTE the trait `Map` cannot be made into an object
 }
index 5097e3d7b10d4735cdc961e4b86d418b7a34fba0..6174d45b898d6971e00405c141930ba98590622c 100644 (file)
@@ -24,12 +24,14 @@ fn bar<T>(&self, t: T)
 fn make_bar<T:Bar>(t: &T) -> &Bar {
         //~^ ERROR E0038
         //~| NOTE method `bar` has generic type parameters
+        //~| NOTE the trait `Bar` cannot be made into an object
     t
 }
 
 fn make_bar_explicit<T:Bar>(t: &T) -> &Bar {
     //~^ ERROR E0038
-    //~^^ NOTE method `bar` has generic type parameters
+    //~| NOTE method `bar` has generic type parameters
+    //~| NOTE the trait `Bar` cannot be made into an object
     t as &Bar
 }
 
index edd31c1f79649fe98c89f8bc6b5e80f61c0a69eb..d85614fa5b538845359fa196638ff58dea68f82e 100644 (file)
@@ -27,12 +27,14 @@ trait Quux {
 fn make_bar<T:Bar>(t: &T) -> &Bar {
         //~^ ERROR E0038
         //~| NOTE method `bar` references the `Self` type in its arguments or return type
+        //~| NOTE the trait `Bar` cannot be made into an object
     loop { }
 }
 
 fn make_baz<T:Baz>(t: &T) -> &Baz {
         //~^ ERROR E0038
         //~| NOTE method `bar` references the `Self` type in its arguments or return type
+        //~| NOTE the trait `Baz` cannot be made into an object
     t
 }
 
index 501d61d20fed124453edb3b2bad2050c71f7d273..accd7fa87ac29bf435af31c3f2307f7995625b61 100644 (file)
@@ -18,6 +18,7 @@ trait Bar : Sized {
 fn make_bar<T:Bar>(t: &T) -> &Bar {
         //~^ ERROR E0038
         //~| NOTE the trait cannot require that `Self : Sized`
+        //~| NOTE the trait `Bar` cannot be made into an object
     t
 }
 
index 0a79ec30e4b942445b96da9bc08f970a4b023f01..74d1ad62f14c3be3fb4d8c0d0c21bb4a77c652e7 100644 (file)
@@ -25,6 +25,7 @@ fn make_bar<T:Bar<u32>>(t: &T) -> &Bar<u32> {
 fn make_baz<T:Baz>(t: &T) -> &Baz {
     //~^ ERROR E0038
     //~| NOTE the trait cannot use `Self` as a type parameter in the supertrait listing
+    //~| NOTE the trait `Baz` cannot be made into an object
     t
 }