// 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 => (),
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>,
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
// 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, }
// 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) {} }
// 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) {} }
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) {} }
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) {} }
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) {} }
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) {} }
// 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) {} }
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() {}
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() {
}
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() {
}
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) {} }
// 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>
}
// 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 }
// 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