2022-04-11 16:38:48 +00:00
|
|
|
error[E0277]: the trait bound `Bar: Copy` is not satisfied
|
|
|
|
--> $DIR/fn-call-in-non-const.rs:14:32
|
2019-06-13 17:30:49 +01:00
|
|
|
|
|
2019-11-22 10:45:49 -08:00
|
|
|
LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
|
2024-01-29 18:31:02 +00:00
|
|
|
| ^^^^^^^^^ the trait `Copy` is not implemented for `Bar`, which is required by `Option<Bar>: Copy`
|
2019-06-13 17:30:49 +01:00
|
|
|
|
|
2022-08-15 21:31:37 +01:00
|
|
|
= note: required for `Option<Bar>` to implement `Copy`
|
2022-04-28 09:40:42 +00:00
|
|
|
= note: the `Copy` trait is required because this value will be copied for each element of the array
|
2021-03-09 08:20:50 +05:30
|
|
|
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
|
2022-04-11 16:38:48 +00:00
|
|
|
help: consider annotating `Bar` with `#[derive(Copy)]`
|
|
|
|
|
|
2023-03-18 02:18:39 +00:00
|
|
|
LL + #[derive(Copy)]
|
|
|
|
LL | struct Bar;
|
2022-04-11 16:38:48 +00:00
|
|
|
|
|
2023-07-21 15:59:28 +00:00
|
|
|
help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position
|
|
|
|
|
|
|
|
|
LL ~ const ARRAY_REPEAT_VALUE: Option<Bar> = no_copy();
|
|
|
|
LL ~ let _: [Option<Bar>; 2] = [ARRAY_REPEAT_VALUE; 2];
|
|
|
|
|
|
2019-06-13 17:30:49 +01:00
|
|
|
|
2023-11-21 15:44:16 +00:00
|
|
|
error: aborting due to 1 previous error
|
2019-06-13 17:30:49 +01:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|