diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-13 05:54:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-13 05:54:13 +0200 |
| commit | 2b4c4dfcfdf2e2cc5a17e4165c81399460b3644a (patch) | |
| tree | 7d1d325394278ae705321e6e2b323b2c9eab06a4 | |
| parent | 633c391225b26d68010897e30f90a6acc3e97431 (diff) | |
| parent | 7228e9b098a27f48a87bec067b01e2000fdccb2d (diff) | |
| download | rust-2b4c4dfcfdf2e2cc5a17e4165c81399460b3644a.tar.gz rust-2b4c4dfcfdf2e2cc5a17e4165c81399460b3644a.zip | |
Rollup merge of #95989 - rust-lang:notriddle/issue-82446, r=compiler-errors
diagnostics: regression test for spurrious "help: store this in the heap" Closes #82446
| -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`. |
