Skip to content

Commit 2b4c4df

Browse files
authored
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
2 parents 633c391 + 7228e9b commit 2b4c4df

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/test/ui/box/issue-82446.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// https://github.com/rust-lang/rust/issues/82446
2+
// Spurious 'help: store this in the heap' regression test
3+
trait MyTrait {}
4+
5+
struct Foo {
6+
val: Box<dyn MyTrait>
7+
}
8+
9+
fn make_it(val: &Box<dyn MyTrait>) {
10+
Foo {
11+
val //~ ERROR [E0308]
12+
};
13+
}
14+
15+
fn main() {}

src/test/ui/box/issue-82446.stderr

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-82446.rs:11:9
3+
|
4+
LL | val
5+
| ^^^ expected struct `Box`, found reference
6+
|
7+
= note: expected struct `Box<(dyn MyTrait + 'static)>`
8+
found reference `&Box<(dyn MyTrait + 'static)>`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)