]> git.lizzy.rs Git - rust.git/blob - src/test/ui/infinite/infinite-tag-type-recursion.stderr
On recursive ADT, provide indirection structured suggestion
[rust.git] / src / test / ui / infinite / infinite-tag-type-recursion.stderr
1 error[E0072]: recursive type `MList` has infinite size
2   --> $DIR/infinite-tag-type-recursion.rs:1:1
3    |
4 LL | enum MList { Cons(isize, MList), Nil }
5    | ^^^^^^^^^^               ----- recursive without indirection
6    | |
7    | recursive type has infinite size
8    |
9 help: insert some indirection to make `MList` representable
10    |
11 LL | enum MList { Cons(isize, Box<MList>), Nil }
12    |                          ^^^^     ^
13 LL | enum MList { Cons(isize, Rc<MList>), Nil }
14    |                          ^^^     ^
15 LL | enum MList { Cons(isize, &MList), Nil }
16    |                          ^
17
18 error[E0391]: cycle detected when computing drop-check constraints for `MList`
19   --> $DIR/infinite-tag-type-recursion.rs:1:1
20    |
21 LL | enum MList { Cons(isize, MList), Nil }
22    | ^^^^^^^^^^
23    |
24    = note: ...which again requires computing drop-check constraints for `MList`, completing the cycle
25    = note: cycle used when computing dropck types for `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, value: MList } }`
26
27 error: aborting due to 2 previous errors
28
29 Some errors have detailed explanations: E0072, E0391.
30 For more information about an error, try `rustc --explain E0072`.