rust/tests/ui/impl-trait/unsized_coercion.next.stderr
2024-10-15 20:42:17 -04:00

36 lines
1.2 KiB
Plaintext

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