File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,18 @@ struct Foo{
55
66impl Default for Foo {
77 fn default ( ) -> Self {
8+ //~^ ERROR: recursive default impl
9+ //~| NOTE: will result in infinite recursion
10+ //~| HELP: ..default() in the Default impl does not apply a default for each struct field
11+ //~| NOTE: `#[deny(recursive_default_impl)]` on by default
812 Self {
913 ..Default :: default ( )
10- //~^ ERROR: recursive default impl
14+ //~^ NOTE: recursive call site
15+
1116 }
1217 }
1318}
19+
20+ fn main ( ) {
21+ let _ = Foo :: default ( ) ;
22+ }
Original file line number Diff line number Diff line change 1- error[E0601]: `main` function not found in crate `recursive_default_impl`
2- --> $DIR/recursive_default_impl.rs:12:2
3- |
4- LL | }
5- | ^ consider adding a `main` function to `$DIR/recursive_default_impl.rs`
6-
71error: recursive default impl
8- --> $DIR/recursive_default_impl.rs:6 :5
2+ --> $DIR/recursive_default_impl.rs:7 :5
93 |
104LL | fn default() -> Self {
115 | ^^^^^^^^^^^^^^^^^^^^ will result in infinite recursion
12- LL | Self {
6+ ...
137LL | ..Default::default()
148 | ------------------ recursive call site
159 |
1610 = help: ..default() in the Default impl does not apply a default for each struct field
1711 = note: `#[deny(recursive_default_impl)]` on by default
1812
19- error: aborting due to 2 previous errors
13+ error: aborting due to 1 previous error
2014
21- For more information about this error, try `rustc --explain E0601`.
You can’t perform that action at this time.
0 commit comments