File tree 3 files changed +27
-1
lines changed
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -54,4 +54,14 @@ impl Read for ImplementsDefault {
54
54
55
55
fn issue_9621_dyn_trait() {
56
56
let _: Box<dyn Read> = Box::<ImplementsDefault>::default();
57
+ issue_10089();
58
+ }
59
+
60
+ fn issue_10089() {
61
+ let _closure = || {
62
+ #[derive(Default)]
63
+ struct WeirdPathed;
64
+
65
+ let _ = Box::<WeirdPathed>::default();
66
+ };
57
67
}
Original file line number Diff line number Diff line change @@ -54,4 +54,14 @@ impl Read for ImplementsDefault {
54
54
55
55
fn issue_9621_dyn_trait ( ) {
56
56
let _: Box < dyn Read > = Box :: new ( ImplementsDefault :: default ( ) ) ;
57
+ issue_10089 ( ) ;
58
+ }
59
+
60
+ fn issue_10089 ( ) {
61
+ let _closure = || {
62
+ #[ derive( Default ) ]
63
+ struct WeirdPathed ;
64
+
65
+ let _ = Box :: new ( WeirdPathed :: default ( ) ) ;
66
+ } ;
57
67
}
Original file line number Diff line number Diff line change @@ -84,5 +84,11 @@ error: `Box::new(_)` of default value
84
84
LL | let _: Box<dyn Read> = Box::new(ImplementsDefault::default());
85
85
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`
86
86
87
- error: aborting due to 14 previous errors
87
+ error: `Box::new(_)` of default value
88
+ --> $DIR/box_default.rs:65:17
89
+ |
90
+ LL | let _ = Box::new(WeirdPathed::default());
91
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<WeirdPathed>::default()`
92
+
93
+ error: aborting due to 15 previous errors
88
94
You can’t perform that action at this time.
0 commit comments