diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0073.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0073.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0073.md b/compiler/rustc_error_codes/src/error_codes/E0073.md new file mode 100644 index 000000000..a5aea86ff --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0073.md @@ -0,0 +1,19 @@ +#### Note: this error code is no longer emitted by the compiler. + +You cannot define a struct (or enum) `Foo` that requires an instance of `Foo` +in order to make a new `Foo` value. This is because there would be no way a +first instance of `Foo` could be made to initialize another instance! + +Here's an example of a struct that has this problem: + +``` +struct Foo { x: Box<Foo> } // error +``` + +One fix is to use `Option`, like so: + +``` +struct Foo { x: Option<Box<Foo>> } +``` + +Now it's possible to create at least one instance of `Foo`: `Foo { x: None }`. |