rust/tests/ui/impl-trait/unsized_coercion.next.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.2 KiB
Plaintext
Raw Normal View History

2024-10-14 17:04:10 +00:00
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
--> $DIR/unsized_coercion.rs:15:17
2024-05-28 15:38:18 +00:00
|
LL | let x = hello();
2024-10-14 17:04:10 +00:00
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `dyn Trait`
2024-05-28 15:38:18 +00:00
error[E0308]: mismatched types
2024-10-14 17:04:10 +00:00
--> $DIR/unsized_coercion.rs:19:5
2024-05-28 15:38:18 +00:00
|
LL | fn hello() -> Box<impl Trait> {
2024-10-14 14:52:34 +00:00
| ---------------
| | |
| | the expected opaque type
| expected `Box<impl Trait>` because of return type
2024-05-28 15:38:18 +00:00
...
LL | Box::new(1u32)
2024-10-14 14:52:34 +00:00
| ^^^^^^^^^^^^^^ types differ
2024-05-28 15:38:18 +00:00
|
2024-10-14 14:52:34 +00:00
= note: expected struct `Box<impl Trait>`
found struct `Box<u32>`
2024-05-28 15:38:18 +00:00
2024-10-14 17:04:10 +00:00
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
2024-10-14 14:52:34 +00:00
--> $DIR/unsized_coercion.rs:12:1
|
LL | fn hello() -> Box<impl Trait> {
2024-10-14 17:04:10 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `dyn Trait`
2024-10-14 14:52:34 +00:00
2024-10-14 17:04:10 +00:00
error: aborting due to 3 previous errors
2024-05-28 15:38:18 +00:00
2024-10-14 17:04:10 +00:00
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.