File tree 2 files changed +13
-11
lines changed
2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,18 @@ struct Foo{
5
5
6
6
impl Default for Foo {
7
7
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
8
12
Self {
9
13
..Default :: default ( )
10
- //~^ ERROR: recursive default impl
14
+ //~^ NOTE: recursive call site
15
+
11
16
}
12
17
}
13
18
}
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
-
7
1
error: recursive default impl
8
- --> $DIR/recursive_default_impl.rs:6 :5
2
+ --> $DIR/recursive_default_impl.rs:7 :5
9
3
|
10
4
LL | fn default() -> Self {
11
5
| ^^^^^^^^^^^^^^^^^^^^ will result in infinite recursion
12
- LL | Self {
6
+ ...
13
7
LL | ..Default::default()
14
8
| ------------------ recursive call site
15
9
|
16
10
= help: ..default() in the Default impl does not apply a default for each struct field
17
11
= note: `#[deny(recursive_default_impl)]` on by default
18
12
19
- error: aborting due to 2 previous errors
13
+ error: aborting due to 1 previous error
20
14
21
- For more information about this error, try `rustc --explain E0601`.
You can’t perform that action at this time.
0 commit comments