fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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