Skip to content

Commit

Permalink
Rollup merge of rust-lang#95989 - rust-lang:notriddle/issue-82446, r=…
Browse files Browse the repository at this point in the history
…compiler-errors

diagnostics: regression test for spurrious "help: store this in the heap"

Closes rust-lang#82446
  • Loading branch information
Dylan-DPC authored Apr 13, 2022
2 parents 77fd84b + 7228e9b commit ebbfd2c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/ui/box/issue-82446.rs
Original file line number Diff line number Diff line change
@@ -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() {}
12 changes: 12 additions & 0 deletions src/test/ui/box/issue-82446.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit ebbfd2c

Please sign in to comment.