mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
62ba3e70a1
The previous output was unintuitive to users.
65 lines
2 KiB
Text
65 lines
2 KiB
Text
error[E0033]: type `&dyn T` cannot be dereferenced
|
|
--> $DIR/destructure-trait-ref.rs:26:9
|
|
|
|
|
LL | let &x = &1isize as &dyn T;
|
|
| ^^ type `&dyn T` cannot be dereferenced
|
|
|
|
error[E0033]: type `&dyn T` cannot be dereferenced
|
|
--> $DIR/destructure-trait-ref.rs:27:10
|
|
|
|
|
LL | let &&x = &(&1isize as &dyn T);
|
|
| ^^ type `&dyn T` cannot be dereferenced
|
|
|
|
error[E0033]: type `Box<dyn T>` cannot be dereferenced
|
|
--> $DIR/destructure-trait-ref.rs:28:9
|
|
|
|
|
LL | let box x = Box::new(1isize) as Box<dyn T>;
|
|
| ^^^^^ type `Box<dyn T>` cannot be dereferenced
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/destructure-trait-ref.rs:32:10
|
|
|
|
|
LL | let &&x = &1isize as &dyn T;
|
|
| ^^ ----------------- this expression has type `&dyn T`
|
|
| |
|
|
| expected `dyn T`, found `&_`
|
|
|
|
|
= note: expected trait object `dyn T`
|
|
found reference `&_`
|
|
help: consider removing `&` from the pattern
|
|
|
|
|
LL - let &&x = &1isize as &dyn T;
|
|
LL + let &x = &1isize as &dyn T;
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/destructure-trait-ref.rs:36:11
|
|
|
|
|
LL | let &&&x = &(&1isize as &dyn T);
|
|
| ^^ -------------------- this expression has type `&&dyn T`
|
|
| |
|
|
| expected `dyn T`, found `&_`
|
|
|
|
|
= note: expected trait object `dyn T`
|
|
found reference `&_`
|
|
help: consider removing `&` from the pattern
|
|
|
|
|
LL - let &&&x = &(&1isize as &dyn T);
|
|
LL + let &&x = &(&1isize as &dyn T);
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/destructure-trait-ref.rs:40:13
|
|
|
|
|
LL | let box box x = Box::new(1isize) as Box<dyn T>;
|
|
| ^^^^^ ------------------------------ this expression has type `Box<dyn T>`
|
|
| |
|
|
| expected `dyn T`, found `Box<_>`
|
|
|
|
|
= note: expected trait object `dyn T`
|
|
found struct `Box<_>`
|
|
|
|
error: aborting due to 6 previous errors
|
|
|
|
Some errors have detailed explanations: E0033, E0308.
|
|
For more information about an error, try `rustc --explain E0033`.
|