Files
rust/tests/ui/traits/trait-object-destructure.stderr

66 lines
2.1 KiB
Plaintext
Raw Normal View History

2018-08-08 14:28:26 +02:00
error[E0033]: type `&dyn T` cannot be dereferenced
2025-06-08 19:09:38 +05:00
--> $DIR/trait-object-destructure.rs:21:9
2018-08-08 14:28:26 +02:00
|
2019-05-28 14:46:13 -04:00
LL | let &x = &1isize as &dyn T;
2018-08-08 14:28:26 +02:00
| ^^ type `&dyn T` cannot be dereferenced
error[E0033]: type `&dyn T` cannot be dereferenced
2025-06-08 19:09:38 +05:00
--> $DIR/trait-object-destructure.rs:22:10
2018-08-08 14:28:26 +02:00
|
2019-05-28 14:46:13 -04:00
LL | let &&x = &(&1isize as &dyn T);
2018-08-08 14:28:26 +02:00
| ^^ type `&dyn T` cannot be dereferenced
error[E0033]: type `Box<dyn T>` cannot be dereferenced
2025-06-08 19:09:38 +05:00
--> $DIR/trait-object-destructure.rs:23:9
2018-08-08 14:28:26 +02:00
|
LL | let box x = Box::new(1isize) as Box<dyn T>;
| ^^^^^ type `Box<dyn T>` cannot be dereferenced
2018-08-08 14:28:26 +02:00
error[E0308]: mismatched types
2025-06-08 19:09:38 +05:00
--> $DIR/trait-object-destructure.rs:26:10
2018-08-08 14:28:26 +02:00
|
2019-05-28 14:46:13 -04:00
LL | let &&x = &1isize as &dyn T;
2020-02-25 05:53:21 +01:00
| ^^ ----------------- this expression has type `&dyn T`
| |
| expected `dyn T`, found `&_`
2018-08-08 14:28:26 +02:00
|
2019-11-14 14:08:08 -08:00
= 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;
2022-06-15 14:15:54 +03:00
|
2018-08-08 14:28:26 +02:00
error[E0308]: mismatched types
2025-06-08 19:09:38 +05:00
--> $DIR/trait-object-destructure.rs:27:11
2018-08-08 14:28:26 +02:00
|
2019-05-28 14:46:13 -04:00
LL | let &&&x = &(&1isize as &dyn T);
2020-02-25 05:53:21 +01:00
| ^^ -------------------- this expression has type `&&dyn T`
| |
| expected `dyn T`, found `&_`
2018-08-08 14:28:26 +02:00
|
2019-11-14 14:08:08 -08:00
= 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);
2022-06-15 14:15:54 +03:00
|
2018-08-08 14:28:26 +02:00
error[E0308]: mismatched types
2025-06-08 19:09:38 +05:00
--> $DIR/trait-object-destructure.rs:28:13
2018-08-08 14:28:26 +02:00
|
LL | let box box x = Box::new(1isize) as Box<dyn T>;
| ^^^^^ ------------------------------ this expression has type `Box<dyn T>`
| |
| expected `dyn T`, found `Box<_>`
2018-08-08 14:28:26 +02:00
|
2019-11-14 14:08:08 -08:00
= note: expected trait object `dyn T`
found struct `Box<_>`
2018-08-08 14:28:26 +02:00
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0033, E0308.
2018-08-08 14:28:26 +02:00
For more information about an error, try `rustc --explain E0033`.