Skip to content

Commit 60e94f6

Browse files
committed
add test output and bless
1 parent c8a97d9 commit 60e94f6

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

tests/ui/lint/recursive_default_impl.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ struct Foo{
55

66
impl 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+
}
+3-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
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-
71
error: recursive default impl
8-
--> $DIR/recursive_default_impl.rs:6:5
2+
--> $DIR/recursive_default_impl.rs:7:5
93
|
104
LL | fn default() -> Self {
115
| ^^^^^^^^^^^^^^^^^^^^ will result in infinite recursion
12-
LL | Self {
6+
...
137
LL | ..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`.

0 commit comments

Comments
 (0)