]> git.lizzy.rs Git - rust.git/commitdiff
improve error message for WF Tuples
authorAriel Ben-Yehuda <ariel.byd@gmail.com>
Fri, 22 Apr 2016 14:26:31 +0000 (17:26 +0300)
committerAriel Ben-Yehuda <ariel.byd@gmail.com>
Tue, 3 May 2016 15:30:10 +0000 (18:30 +0300)
src/librustc/traits/error_reporting.rs
src/test/compile-fail/unsized3.rs
src/test/compile-fail/unsized6.rs

index d02dfcd9ea7999d549933db40bf21ecb747a7692..98812f4e00fcc8cc942b34c115443e1b31ed6c3c 100644 (file)
@@ -768,6 +768,10 @@ fn note_obligation_cause_code<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
             err.fileline_note(
                 cause_span,
                 "tuple elements must have `Sized` type");
+
+            err.fileline_warn(
+                cause_span,
+                "this is a new restriction added in rustc 1.10");
         }
         ObligationCauseCode::ProjectionWf(data) => {
             err.note(&format!("required so that the projection `{}` is well-formed",
index 1d93645fc847f6c3dfcd6750f7dc3271c7771035..d5f2cf65a69f2b87c1e5f023c63676d7817db1c8 100644 (file)
@@ -60,7 +60,9 @@ fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) {
 fn f9<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
     f5(&(*x1, 34));
     //~^ ERROR `X: std::marker::Sized` is not satisfied
-    //~^^ ERROR `X: std::marker::Sized` is not satisfied
+    //~| WARNING this is a new restriction added in rustc 1.10
+    //~^^^ ERROR `X: std::marker::Sized` is not satisfied
+    //~| WARNING this is a new restriction added in rustc 1.10
 }
 
 fn f10<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
index e18ccfee96c7da7994b4f4aec09576a28f89e796..ba9a8a4f294f9b44d735d29a497dceea3a621b69 100644 (file)
@@ -15,12 +15,15 @@ trait T {}
 fn f1<X: ?Sized>(x: &X) {
     let _: X; // <-- this is OK, no bindings created, no initializer.
     let _: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfied
+    //~| WARNING this is a new restriction added in rustc 1.10
     let y: X; //~ERROR `X: std::marker::Sized` is not satisfied
     let y: (isize, (X, usize)); //~ERROR `X: std::marker::Sized` is not satisfied
+    //~| WARNING this is a new restriction added in rustc 1.10
 }
 fn f2<X: ?Sized + T>(x: &X) {
     let y: X; //~ERROR `X: std::marker::Sized` is not satisfied
     let y: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfied
+    //~| WARNING this is a new restriction added in rustc 1.10
 }
 
 fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {