mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Update the diagnostic message to match the new span
This commit is contained in:
parent
bc14b6bea6
commit
018f9347fc
@ -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 {
|
||||
|
@ -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)]
|
||||
|
@ -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] {
|
||||
|
@ -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] {
|
||||
|
@ -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)]`
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)]
|
||||
|
Loading…
Reference in New Issue
Block a user