From 3ed96e35c422941535cf0b19e5207572c8f38157 Mon Sep 17 00:00:00 2001 From: yukang Date: Fri, 5 Jan 2024 10:25:20 +0800 Subject: Suggest arry::from_fn for array initialization --- tests/ui/array-slice-vec/repeat_empty_ok.stderr | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/ui/array-slice-vec') diff --git a/tests/ui/array-slice-vec/repeat_empty_ok.stderr b/tests/ui/array-slice-vec/repeat_empty_ok.stderr index e8bac04ac45..bc3a68c905d 100644 --- a/tests/ui/array-slice-vec/repeat_empty_ok.stderr +++ b/tests/ui/array-slice-vec/repeat_empty_ok.stderr @@ -5,6 +5,8 @@ LL | let headers = [Header{value: &[]}; 128]; | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>` | = note: the `Copy` trait is required because this value will be copied for each element of the array + = help: consider using `core::array::from_fn` to initialize the array + = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information help: consider annotating `Header<'_>` with `#[derive(Copy)]` | LL + #[derive(Copy)] @@ -18,6 +20,8 @@ LL | let headers = [Header{value: &[0]}; 128]; | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>` | = note: the `Copy` trait is required because this value will be copied for each element of the array + = help: consider using `core::array::from_fn` to initialize the array + = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information help: consider annotating `Header<'_>` with `#[derive(Copy)]` | LL + #[derive(Copy)] -- cgit 1.4.1-3-g733a5