]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized-locals/suggest-borrow.stderr
Don't resolve type var roots in point_at_expr_source_of_inferred_type
[rust.git] / tests / ui / unsized-locals / suggest-borrow.stderr
1 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
2   --> $DIR/suggest-borrow.rs:2:9
3    |
4 LL |     let x: [u8] = vec!(1, 2, 3)[..];
5    |         ^ doesn't have a size known at compile-time
6    |
7    = help: the trait `Sized` is not implemented for `[u8]`
8    = note: all local variables must have a statically known size
9    = help: unsized locals are gated as an unstable feature
10 help: consider borrowing here
11    |
12 LL |     let x: &[u8] = vec!(1, 2, 3)[..];
13    |            +
14
15 error[E0308]: mismatched types
16   --> $DIR/suggest-borrow.rs:3:20
17    |
18 LL |     let x: &[u8] = vec!(1, 2, 3)[..];
19    |            -----   ^^^^^^^^^^^^^^^^^
20    |            |       |
21    |            |       expected `&[u8]`, found slice `[{integer}]`
22    |            |       help: consider borrowing here: `&vec!(1, 2, 3)[..]`
23    |            expected due to this
24
25 error[E0308]: mismatched types
26   --> $DIR/suggest-borrow.rs:4:19
27    |
28 LL |     let x: [u8] = &vec!(1, 2, 3)[..];
29    |            ----   ^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `&[{integer}]`
30    |            |
31    |            expected due to this
32    |
33 help: consider removing the borrow
34    |
35 LL -     let x: [u8] = &vec!(1, 2, 3)[..];
36 LL +     let x: [u8] = vec!(1, 2, 3)[..];
37    |
38 help: alternatively, consider changing the type annotation
39    |
40 LL |     let x: &[u8] = &vec!(1, 2, 3)[..];
41    |            +
42
43 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
44   --> $DIR/suggest-borrow.rs:4:9
45    |
46 LL |     let x: [u8] = &vec!(1, 2, 3)[..];
47    |         ^ doesn't have a size known at compile-time
48    |
49    = help: the trait `Sized` is not implemented for `[u8]`
50    = note: all local variables must have a statically known size
51    = help: unsized locals are gated as an unstable feature
52 help: consider borrowing here
53    |
54 LL |     let x: &[u8] = &vec!(1, 2, 3)[..];
55    |            +
56
57 error: aborting due to 4 previous errors
58
59 Some errors have detailed explanations: E0277, E0308.
60 For more information about an error, try `rustc --explain E0277`.