Update the diagnostic message to match the new span

This commit is contained in:
Oli Scherer 2022-04-28 09:40:42 +00:00
parent bc14b6bea6
commit 018f9347fc
10 changed files with 13 additions and 13 deletions

View File

@ -2227,7 +2227,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
ObligationCauseCode::RepeatElementCopy { is_const_fn } => {
err.note(
"the `Copy` trait is required because the repeated element will be copied",
"the `Copy` trait is required because this value will be copied for each element of the array",
);
if is_const_fn {

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
LL | let headers = [Header{value: &[]}; 128];
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
|
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
|
LL | #[derive(Copy)]
@ -16,7 +16,7 @@ error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
LL | let headers = [Header{value: &[0]}; 128];
| ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
|
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Header<'_>` with `#[derive(Copy)]`
|
LL | #[derive(Copy)]

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied
LL | [x; { N }]
| ^ the trait `Copy` is not implemented for `T`
|
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider restricting type parameter `T`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied
LL | [x; N]
| ^ the trait `Copy` is not implemented for `T`
|
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider restricting type parameter `T`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {

View File

@ -5,7 +5,7 @@ LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
| ^^^^^^^^^ the trait `Copy` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
= 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];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
help: consider annotating `Bar` with `#[derive(Copy)]`

View File

@ -5,7 +5,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^ the trait `Copy` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL | #[derive(Copy)]
@ -18,7 +18,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^ the trait `Copy` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL | #[derive(Copy)]

View File

@ -5,7 +5,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^ the trait `Copy` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL | #[derive(Copy)]
@ -18,7 +18,7 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^ the trait `Copy` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL | #[derive(Copy)]

View File

@ -9,7 +9,7 @@ note: required because of the requirements on the impl of `Copy` for `Foo<String
|
LL | #[derive(Copy, Clone)]
| ^^^^
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
= 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];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
LL | let strings: [String; 5] = [String::new(); 5];
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
= 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];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information

View File

@ -4,7 +4,7 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied
LL | let _ = [ a; 5 ];
| ^ the trait `Copy` is not implemented for `Foo`
|
= note: the `Copy` trait is required because the repeated element will be copied
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Foo` with `#[derive(Copy)]`
|
LL | #[derive(Copy)]