]> git.lizzy.rs Git - rust.git/commitdiff
Improve invalid recursive types diagnostic
authorSimonas Kazlauskas <git@kazlauskas.me>
Sun, 26 Jul 2015 22:10:43 +0000 (01:10 +0300)
committerSimonas Kazlauskas <git@kazlauskas.me>
Tue, 28 Jul 2015 22:57:24 +0000 (01:57 +0300)
17 files changed:
src/librustc_typeck/check/mod.rs
src/librustc_typeck/diagnostics.rs
src/test/compile-fail/infinite-tag-type-recursion.rs
src/test/compile-fail/issue-17431-1.rs
src/test/compile-fail/issue-17431-2.rs
src/test/compile-fail/issue-17431-3.rs
src/test/compile-fail/issue-17431-4.rs
src/test/compile-fail/issue-17431-5.rs
src/test/compile-fail/issue-17431-6.rs
src/test/compile-fail/issue-17431-7.rs
src/test/compile-fail/issue-2718-a.rs
src/test/compile-fail/issue-3008-1.rs
src/test/compile-fail/issue-3008-2.rs
src/test/compile-fail/issue-3008-3.rs
src/test/compile-fail/issue-3779.rs
src/test/compile-fail/recursive-enum.rs
src/test/compile-fail/type-recursive.rs

index add46f7efb9ec8224ee6ca4e429712f168485a56..96f6f5eb566a3ddf5e3210394c4747c21fa8720f 100644 (file)
@@ -4273,10 +4273,8 @@ pub fn check_representable(tcx: &ty::ctxt,
     // caught by case 1.
     match rty.is_representable(tcx, sp) {
       ty::SelfRecursive => {
-        span_err!(tcx.sess, sp, E0072,
-            "illegal recursive {} type; \
-             wrap the inner value in a box to make it representable",
-            designation);
+        span_err!(tcx.sess, sp, E0072, "invalid recursive {} type", designation);
+        tcx.sess.fileline_help(sp, "wrap the inner value in a box to make it representable");
         return false
       }
       ty::Representable | ty::ContainsRecursive => (),
index 73ee3bbbe5b0132bee84908897f8add77eee573e..07ec9154332c3d81d337817bf06a2b099882f5fe 100644 (file)
@@ -778,7 +778,7 @@ fn main() {
 Consider the following erroneous definition of a type for a list of bytes:
 
 ```
-// error, illegal recursive struct type
+// error, invalid recursive struct type
 struct ListNode {
     head: u8,
     tail: Option<ListNode>,
@@ -2345,7 +2345,7 @@ struct Foo<'a, T: 'a> {
     E0241,
     E0242, // internal error looking up a definition
     E0245, // not a trait
-    E0246, // illegal recursive type
+    E0246, // invalid recursive type
     E0247, // found module name used as a type
     E0248, // found value name used as a type
     E0319, // trait impls for defaulted traits allowed just for structs/enums
index a57c015d684b6c8510e94c647b19163a36c6e978..7dbf75feda054df0431062e7da43ee49ff609017 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-// error-pattern: illegal recursive enum type; wrap the inner value in a box
+// error-pattern: invalid recursive enum type
 
 enum mlist { cons(isize, mlist), nil, }
 
index 896a9c06873e97c877b7a392c27834283ce7a169..bd3f2835058700942b137a968c78ea7d1945cce0 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct Foo { foo: Option<Option<Foo>> }
-//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive struct type
 
 impl Foo { fn bar(&self) {} }
 
index 886fe8d771a8cda13d0e30ed4e74e34f660a56f5..4e1c0d6571d168567fddf88b66746bef322ddd63 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 struct Baz { q: Option<Foo> }
-//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive struct type
 
 struct Foo { q: Option<Baz> }
-//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive struct type
 
 impl Foo { fn bar(&self) {} }
 
index c1c450935f6cb6e90ec33b477a2e17f3010c73a8..07c5f106456d121f781b3e7f540966ca286cb281 100644 (file)
@@ -11,7 +11,7 @@
 use std::sync::Mutex;
 
 struct Foo { foo: Mutex<Option<Foo>> }
-//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive struct type
 
 impl Foo { fn bar(&self) {} }
 
index 22aaa796ad0f4a0d62186527181140e6d98c7f60..74952d9ca2b38f39ab5c4afed213e080fc647106 100644 (file)
@@ -11,7 +11,7 @@
 use std::marker;
 
 struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
-//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive struct type
 
 impl<T> Foo<T> { fn bar(&self) {} }
 
index cc9cc2e3c035c7ae6e4adb14e7ad9be7bb08414d..157b5ed434e9f23dad91c26f3959228bdbea3bc4 100644 (file)
@@ -12,7 +12,7 @@
 
 struct Foo { foo: Bar<Foo> }
 struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
-//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive struct type
 
 impl Foo { fn foo(&self) {} }
 
index 8eac295353d27a367c8d99d339498d98c1f5b331..b2037378d3787532c7065ac5673c021b8e4ee4d4 100644 (file)
@@ -11,7 +11,7 @@
 use std::sync::Mutex;
 
 enum Foo { X(Mutex<Option<Foo>>) }
-//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive enum type
 
 impl Foo { fn bar(self) {} }
 
index c64c040aa44cba1b3227384e04e697233af056ef..9ad81e030aaf0eab8fe16065481a0fb36cb3f7b7 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 enum Foo { Voo(Option<Option<Foo>>) }
-//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive enum type
 
 impl Foo { fn bar(&self) {} }
 
index 3ba8dd4fefef0109ac6682c5823343a6a8ae9036..37daf76c0b953c8534ab59b784a8971227e1c016 100644 (file)
@@ -16,7 +16,7 @@ mod pingpong {
     use send_packet;
     pub type ping = send_packet<pong>;
     pub struct pong(send_packet<ping>);
-    //~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+    //~^ ERROR invalid recursive struct type
 }
 
 fn main() {}
index d2d7d800470fe8a22cd3e8734055cc4a65e13238..eb6842083263594a8561127d689079d957419cb6 100644 (file)
@@ -10,7 +10,7 @@
 
 enum foo { foo_(bar) }
 enum bar { bar_none, bar_some(bar) }
-//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive enum type
 
 fn main() {
 }
index 2f1fa6780ab0c969a3ff8dd5acd4a7f23f383f3d..f934e0771c2ab39c998829b7cc50be27e20a3087 100644 (file)
@@ -12,7 +12,7 @@
 
 enum foo { foo_(bar) }
 struct bar { x: bar }
-//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive struct type
 
 fn main() {
 }
index af6cee1f10749f4aeb366fdfb7f6f6a04fedaed4..f8756b83f23a642d52e82394a32a5ec5acac48f3 100644 (file)
@@ -12,7 +12,7 @@
 
 enum E1 { V1(E2<E1>), }
 enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
-//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
+//~^ ERROR invalid recursive enum type
 
 impl E1 { fn foo(&self) {} }
 
index 19a7ed05bf4424ebe3d3a1df70c91731cceb0e16..66d8fb40cd120c94adf1eb04944d2ebb58175542 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct S {
-    //~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
+    //~^ ERROR invalid recursive struct type
     element: Option<S>
 }
 
index 119f6dae9e55681da6e82b9fbf1d259ad7965789..33dcbdf74d2269fa63740a14d6229ae5fb7fbab6 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern: illegal recursive enum type
+// error-pattern: invalid recursive enum type
 
 enum list<T> { cons(T, list<T>), nil }
 
index b972934d0604cde3980302472e87e05f4f01ea60..3b08d900733c5e219ac4e3d038d25bd19b032270 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:illegal recursive struct type
+// error-pattern:invalid recursive struct type
 struct t1 {
     foo: isize,
     foolish: t1