rust/src/test/ui/consts/rfc-2203-const-array-repeat-exprs/nll-borrowck.stderr
David Wood 485a80255b
rustc/rustc_mir: Implement RFC 2203.
This commit implements RFC 2203, allowing constants in array repeat
expressions.

Firstly, the check that the array repeat expression implements `Copy` is
removed and re-implemented in `rustc_mir::borrow_check::nll::type_check`
by emitting an error when the MIR contains a `Operand::Move` and the
type does not implement `Copy`.

Next, the `qualify_consts` pass is modified to construct a
`Candidate::Repeat` when it would be correct to promote a array repeat
expression.

Finally, the `promote_consts` pass is modified to promote the candidates
previously identified.
2019-07-07 19:51:09 +01:00

19 lines
811 B
Plaintext

error: repeated expression does not implement `std::marker::Copy`
--> $DIR/nll-borrowck.rs:87:37
|
LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `std::option::Option<Bar>`
|
= note: the `std::marker::Copy` trait is required because the repeated element will be copied
error: repeated expression does not implement `std::marker::Copy`
--> $DIR/nll-borrowck.rs:103:37
|
LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `std::option::Option<Bar>`
|
= note: the `std::marker::Copy` trait is required because the repeated element will be copied
error: aborting due to 2 previous errors