File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -438,7 +438,6 @@ This error indicates that the compiler found multiple functions with the
438
438
`#[start]` attribute. This is an error because there must be a unique entry
439
439
point into a Rust program. Example:
440
440
441
-
442
441
```
443
442
#![feature(start)]
444
443
Original file line number Diff line number Diff line change @@ -50,11 +50,36 @@ match 5u32 {
50
50
"## ,
51
51
52
52
E0161 : r##"
53
+ A value was moved. However, its size was not known at compile time, and only
54
+ values of a known size can be moved.
55
+
56
+ Erroneous code example:
57
+
58
+ ```compile_fail
59
+ #![feature(box_syntax)]
60
+
61
+ fn main() {
62
+ let array: &[isize] = &[1, 2, 3];
63
+ let _x: Box<[isize]> = box *array;
64
+ // error: cannot move a value of type [isize]: the size of [isize] cannot
65
+ // be statically determined
66
+ }
67
+ ```
68
+
53
69
In Rust, you can only move a value when its size is known at compile time.
54
70
55
71
To work around this restriction, consider "hiding" the value behind a reference:
56
72
either `&x` or `&mut x`. Since a reference has a fixed size, this lets you move
57
- it around as usual.
73
+ it around as usual. Example:
74
+
75
+ ```
76
+ #![feature(box_syntax)]
77
+
78
+ fn main() {
79
+ let array: &[isize] = &[1, 2, 3];
80
+ let _x: Box<&[isize]> = box array; // ok!
81
+ }
82
+ ```
58
83
"## ,
59
84
60
85
E0265 : r##"
You can’t perform that action at this time.
0 commit comments