Closed
Description
This code compiles with recent Nightly:
#![feature(self_in_typedefs)]
enum Tree { Empty, Node(Box<Self>, i32, Box<Self>) }
fn main() {}
If I remove the feature, on Nightly:
enum Tree { Empty, Node(Box<Self>, i32, Box<Self>) }
fn main() {}
It gives error messages but no suggestion to add the self_in_typedefs feature:
error[E0411]: cannot find type `Self` in this scope
--> ...\test.rs:1:29
|
1 | enum Tree { Empty, Node(Box<Self>, i32, Box<Self>) }
| ^^^^ `Self` is only available in traits and impls
error[E0411]: cannot find type `Self` in this scope
--> ...\test.rs:1:45
|
1 | enum Tree { Empty, Node(Box<Self>, i32, Box<Self>) }
| ^^^^ `Self` is only available in traits and impls
error: aborting due to 2 previous errors
For some other features Rustc gives such help:
enum Tree { Empty, Node(Box<Tree>, i32, Box<Tree>) }
fn main() {
let t = Tree::Node(box Tree::Empty, 0, box Tree::Empty);
}
error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #49733)
--> ...\test.rs:3:24
|
3 | let t = Tree::Node(box Tree::Empty, 0, box Tree::Empty);
| ^^^^^^^^^^^^^^^
|
= help: add #![feature(box_syntax)] to the crate attributes to enable