add a test against #100898

This commit is contained in:
Andre Bogus 2023-01-08 20:25:42 +01:00
parent cf1d3d0370
commit d23dce54ec
3 changed files with 27 additions and 1 deletions

View file

@ -54,4 +54,14 @@ impl Read for ImplementsDefault {
fn issue_9621_dyn_trait() {
let _: Box<dyn Read> = Box::<ImplementsDefault>::default();
issue_10089();
}
fn issue_10089() {
let _closure = || {
#[derive(Default)]
struct WeirdPathed;
let _ = Box::<WeirdPathed>::default();
};
}

View file

@ -54,4 +54,14 @@ impl Read for ImplementsDefault {
fn issue_9621_dyn_trait() {
let _: Box<dyn Read> = Box::new(ImplementsDefault::default());
issue_10089();
}
fn issue_10089() {
let _closure = || {
#[derive(Default)]
struct WeirdPathed;
let _ = Box::new(WeirdPathed::default());
};
}

View file

@ -84,5 +84,11 @@ error: `Box::new(_)` of default value
LL | let _: Box<dyn Read> = Box::new(ImplementsDefault::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`
error: aborting due to 14 previous errors
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:65:17
|
LL | let _ = Box::new(WeirdPathed::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<WeirdPathed>::default()`
error: aborting due to 15 previous errors