mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
regression test for spurrious "help: store this in the heap"
Closes #82446
This commit is contained in:
parent
327caac4d0
commit
7228e9b098
15
src/test/ui/box/issue-82446.rs
Normal file
15
src/test/ui/box/issue-82446.rs
Normal file
@ -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
src/test/ui/box/issue-82446.stderr
Normal file
12
src/test/ui/box/issue-82446.stderr
Normal file
@ -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`.
|
Loading…
Reference in New Issue
Block a user