rust/tests/ui/unsized-locals/suggest-borrow.stderr

64 lines
2.0 KiB
Plaintext

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/suggest-borrow.rs:2:9
|
LL | let x: [u8] = vec!(1, 2, 3)[..];
| ^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: consider borrowing here
|
LL | let x: &[u8] = vec!(1, 2, 3)[..];
| +
error[E0308]: mismatched types
--> $DIR/suggest-borrow.rs:3:20
|
LL | let x: &[u8] = vec!(1, 2, 3)[..];
| ----- ^^^^^^^^^^^^^^^^^ expected `&[u8]`, found `[{integer}]`
| |
| expected due to this
|
help: consider borrowing here
|
LL | let x: &[u8] = &vec!(1, 2, 3)[..];
| +
error[E0308]: mismatched types
--> $DIR/suggest-borrow.rs:4:19
|
LL | let x: [u8] = &vec!(1, 2, 3)[..];
| ---- ^^^^^^^^^^^^^^^^^^ expected `[u8]`, found `&[{integer}]`
| |
| expected due to this
|
help: consider removing the borrow
|
LL - let x: [u8] = &vec!(1, 2, 3)[..];
LL + let x: [u8] = vec!(1, 2, 3)[..];
|
help: alternatively, consider changing the type annotation
|
LL | let x: &[u8] = &vec!(1, 2, 3)[..];
| +
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/suggest-borrow.rs:4:9
|
LL | let x: [u8] = &vec!(1, 2, 3)[..];
| ^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
help: consider borrowing here
|
LL | let x: &[u8] = &vec!(1, 2, 3)[..];
| +
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.