diff options
| author | Michael Howell <michael@notriddle.com> | 2022-04-12 12:14:32 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-04-12 12:15:40 -0700 |
| commit | 7228e9b098a27f48a87bec067b01e2000fdccb2d (patch) | |
| tree | 6543688a30ef805ba5085531d55d92aa5fd9d396 /src | |
| parent | 327caac4d01aef74d6577b87c295270608be09fa (diff) | |
| download | rust-7228e9b098a27f48a87bec067b01e2000fdccb2d.tar.gz rust-7228e9b098a27f48a87bec067b01e2000fdccb2d.zip | |
regression test for spurrious "help: store this in the heap"
Closes #82446
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/box/issue-82446.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/box/issue-82446.stderr | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/box/issue-82446.rs b/src/test/ui/box/issue-82446.rs new file mode 100644 index 00000000000..2960f7fbc21 --- /dev/null +++ b/src/test/ui/box/issue-82446.rs @@ -0,0 +1,15 @@ +// https://github.com/rust-lang/rust/issues/82446 +// Spurious 'help: store this in the heap' regression test +trait MyTrait {} + +struct Foo { + val: Box<dyn MyTrait> +} + +fn make_it(val: &Box<dyn MyTrait>) { + Foo { + val //~ ERROR [E0308] + }; +} + +fn main() {} diff --git a/src/test/ui/box/issue-82446.stderr b/src/test/ui/box/issue-82446.stderr new file mode 100644 index 00000000000..0374737957e --- /dev/null +++ b/src/test/ui/box/issue-82446.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-82446.rs:11:9 + | +LL | val + | ^^^ expected struct `Box`, found reference + | + = note: expected struct `Box<(dyn MyTrait + 'static)>` + found reference `&Box<(dyn MyTrait + 'static)>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. |
