Skip to content

Commit 018f934

Browse files
committed
Update the diagnostic message to match the new span
1 parent bc14b6b commit 018f934

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
22272227
}
22282228
ObligationCauseCode::RepeatElementCopy { is_const_fn } => {
22292229
err.note(
2230-
"the `Copy` trait is required because the repeated element will be copied",
2230+
"the `Copy` trait is required because this value will be copied for each element of the array",
22312231
);
22322232

22332233
if is_const_fn {

src/test/ui/array-slice-vec/repeat_empty_ok.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
44
LL | let headers = [Header{value: &[]}; 128];
55
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
66
|
7-
= note: the `Copy` trait is required because the repeated element will be copied
7+
= note: the `Copy` trait is required because this value will be copied for each element of the array
88
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
99
|
1010
LL | #[derive(Copy)]
@@ -16,7 +16,7 @@ error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
1616
LL | let headers = [Header{value: &[0]}; 128];
1717
| ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
1818
|
19-
= note: the `Copy` trait is required because the repeated element will be copied
19+
= note: the `Copy` trait is required because this value will be copied for each element of the array
2020
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
2121
|
2222
LL | #[derive(Copy)]

src/test/ui/const-generics/issues/issue-61336-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied
44
LL | [x; { N }]
55
| ^ the trait `Copy` is not implemented for `T`
66
|
7-
= note: the `Copy` trait is required because the repeated element will be copied
7+
= note: the `Copy` trait is required because this value will be copied for each element of the array
88
help: consider restricting type parameter `T`
99
|
1010
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {

src/test/ui/const-generics/issues/issue-61336.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied
44
LL | [x; N]
55
| ^ the trait `Copy` is not implemented for `T`
66
|
7-
= note: the `Copy` trait is required because the repeated element will be copied
7+
= note: the `Copy` trait is required because this value will be copied for each element of the array
88
help: consider restricting type parameter `T`
99
|
1010
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {

src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
55
| ^^^^^^^^^ the trait `Copy` is not implemented for `Bar`
66
|
77
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
8-
= note: the `Copy` trait is required because the repeated element will be copied
8+
= note: the `Copy` trait is required because this value will be copied for each element of the array
99
= help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
1010
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
1111
help: consider annotating `Bar` with `#[derive(Copy)]`

src/test/ui/consts/const-blocks/migrate-fail.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
55
| ^ the trait `Copy` is not implemented for `Bar`
66
|
77
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
8-
= note: the `Copy` trait is required because the repeated element will be copied
8+
= note: the `Copy` trait is required because this value will be copied for each element of the array
99
help: consider annotating `Bar` with `#[derive(Copy)]`
1010
|
1111
LL | #[derive(Copy)]
@@ -18,7 +18,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
1818
| ^ the trait `Copy` is not implemented for `Bar`
1919
|
2020
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
21-
= note: the `Copy` trait is required because the repeated element will be copied
21+
= note: the `Copy` trait is required because this value will be copied for each element of the array
2222
help: consider annotating `Bar` with `#[derive(Copy)]`
2323
|
2424
LL | #[derive(Copy)]

src/test/ui/consts/const-blocks/nll-fail.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
55
| ^ the trait `Copy` is not implemented for `Bar`
66
|
77
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
8-
= note: the `Copy` trait is required because the repeated element will be copied
8+
= note: the `Copy` trait is required because this value will be copied for each element of the array
99
help: consider annotating `Bar` with `#[derive(Copy)]`
1010
|
1111
LL | #[derive(Copy)]
@@ -18,7 +18,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
1818
| ^ the trait `Copy` is not implemented for `Bar`
1919
|
2020
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
21-
= note: the `Copy` trait is required because the repeated element will be copied
21+
= note: the `Copy` trait is required because this value will be copied for each element of the array
2222
help: consider annotating `Bar` with `#[derive(Copy)]`
2323
|
2424
LL | #[derive(Copy)]

src/test/ui/consts/const-blocks/trait-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required because of the requirements on the impl of `Copy` for `Foo<String
99
|
1010
LL | #[derive(Copy, Clone)]
1111
| ^^^^
12-
= note: the `Copy` trait is required because the repeated element will be copied
12+
= note: the `Copy` trait is required because this value will be copied for each element of the array
1313
= help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
1414
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
1515
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

src/test/ui/consts/const-fn-in-vec.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
44
LL | let strings: [String; 5] = [String::new(); 5];
55
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
66
|
7-
= note: the `Copy` trait is required because the repeated element will be copied
7+
= note: the `Copy` trait is required because this value will be copied for each element of the array
88
= help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
99
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
1010

src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied
44
LL | let _ = [ a; 5 ];
55
| ^ the trait `Copy` is not implemented for `Foo`
66
|
7-
= note: the `Copy` trait is required because the repeated element will be copied
7+
= note: the `Copy` trait is required because this value will be copied for each element of the array
88
help: consider annotating `Foo` with `#[derive(Copy)]`
99
|
1010
LL | #[derive(Copy)]

0 commit comments

Comments
 (0)