Tweak help to unify formatting and wording

This commit is contained in:
Esteban Küber 2026-01-19 21:54:43 +00:00
parent 8543404e8d
commit dffec20dee
46 changed files with 122 additions and 117 deletions

View file

@ -1293,18 +1293,23 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}
},
);
span.push_span_label(
ty_span,
format!(
"consider {}implementing `Clone` for this type",
if derive_clone { "manually " } else { "" }
),
);
let msg = if !derive_clone {
span.push_span_label(
ty_span,
format!(
"consider {}implementing `Clone` for this type",
if derive_clone { "manually " } else { "" }
),
);
format!("if `{ty}` implemented `Clone`, you could clone the value")
} else {
format!("if all bounds were met, you could clone the value")
};
span.push_span_label(expr.span, "you could clone this value");
err.span_help(
span,
format!("if `{ty}` implemented `Clone`, you could clone the value"),
);
err.span_note(span, msg);
if derive_clone {
err.help("consider manually implementing `Clone` to avoid undesired bounds");
}
} else if let ty::Param(param) = ty.kind()
&& let Some(_clone_trait_def) = self.infcx.tcx.lang_items().clone_trait()
&& let generics = self.infcx.tcx.generics_of(self.mir_def_id())

View file

@ -8,7 +8,7 @@ LL | drop(t);
LL | drop(t);
| ^ value used here after move
|
help: if `S<()>` implemented `Clone`, you could clone the value
note: if `S<()>` implemented `Clone`, you could clone the value
--> $DIR/issue-25700.rs:1:1
|
LL | struct S<T: 'static>(#[allow(dead_code)] Option<&'static T>);

View file

@ -9,7 +9,7 @@ LL |
LL | x.hello();
| - variable moved due to use in coroutine
|
help: if `Ty` implemented `Clone`, you could clone the value
note: if `Ty` implemented `Clone`, you could clone the value
--> $DIR/closure-shim-borrowck-error.rs:17:1
|
LL | x.hello();

View file

@ -7,7 +7,7 @@ LL | let c = async || {
LL | *x;
| ^^ `*x` is moved here
|
help: if `Ty` implemented `Clone`, you could clone the value
note: if `Ty` implemented `Clone`, you could clone the value
--> $DIR/move-out-of-ref.rs:5:1
|
LL | struct Ty;

View file

@ -4,7 +4,7 @@ error[E0507]: cannot move out of static item `BAR`
LL | test(BAR);
| ^^^ move occurs because `BAR` has type `Foo`, which does not implement the `Copy` trait
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrowck-move-out-of-static-item.rs:3:1
|
LL | struct Foo {

View file

@ -10,7 +10,7 @@ LL | let S { x: ax } = a;
LL | f(pb);
| -- borrow later used here
|
help: if `S` implemented `Clone`, you could clone the value
note: if `S` implemented `Clone`, you could clone the value
--> $DIR/borrowck-move-subcomponent.rs:6:1
|
LL | struct S {

View file

@ -30,7 +30,7 @@ LL | s(" world".to_string());
LL | s(" world".to_string());
| ^ value used here after move
|
help: if `SFnOnce` implemented `Clone`, you could clone the value
note: if `SFnOnce` implemented `Clone`, you could clone the value
--> $DIR/borrowck-overloaded-call.rs:41:1
|
LL | struct SFnOnce {

View file

@ -59,7 +59,7 @@ LL |
LL | println!("{b:?}");
| - borrow later used here
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/clone-on-ref.rs:19:1
|
LL | struct A;

View file

@ -2,11 +2,10 @@
use std::marker::PhantomData;
#[derive(Clone, Copy)] //~ NOTE derived `Clone` adds implicit bounds on type parameters
#[derive(Clone, Copy)] //~ NOTE: derived `Clone` adds implicit bounds on type parameters
pub struct TypedAddress<T>{
//~^ HELP if `TypedAddress<T>` implemented `Clone`, you could clone the value
//~| NOTE consider manually implementing `Clone` for this type
//~| NOTE introduces an implicit `T: Clone` bound
//~^ NOTE: if all bounds were met, you could clone the value
//~| NOTE: introduces an implicit `T: Clone` bound
inner: u64,
phantom: PhantomData<T>,
}
@ -14,18 +13,19 @@ pub struct TypedAddress<T>{
pub trait Memory {
fn write_value<T>(&self, offset: TypedAddress<T>, value: &T);
fn return_value<T>(&self, offset: TypedAddress<T>) -> T;
//~^ NOTE consider changing this parameter type in method `return_value` to borrow instead if owning the value isn't necessary
//~| NOTE in this method
//~| NOTE this parameter takes ownership of the value
//~^ NOTE: consider changing this parameter type in method `return_value` to borrow instead if owning the value isn't necessary
//~| NOTE: in this method
//~| NOTE: this parameter takes ownership of the value
fn update_value<T, F>(&self, offset: TypedAddress<T>, update: F)
//~^ NOTE move occurs because `offset` has type `TypedAddress<T>`, which does not implement the `Copy` trait
where F: FnOnce(T) -> T //~ HELP consider further restricting type parameter `T`
//~^ NOTE: move occurs because `offset` has type `TypedAddress<T>`, which does not implement the `Copy` trait
where F: FnOnce(T) -> T //~ HELP: consider further restricting type parameter `T`
{
let old = self.return_value(offset); //~ NOTE value moved here
//~^ NOTE you could clone this value
let old = self.return_value(offset); //~ NOTE: value moved here
//~^ NOTE: you could clone this value
let new = update(old);
self.write_value(offset, &new); //~ ERROR use of moved value: `offset`
//~^ NOTE value used here after move
self.write_value(offset, &new); //~ ERROR: use of moved value: `offset`
//~^ NOTE: value used here after move
//~| HELP: consider manually implementing `Clone` to avoid undesired bounds
}
}

View file

@ -1,5 +1,5 @@
error[E0382]: use of moved value: `offset`
--> $DIR/derive-clone-implicit-bound.rs:27:26
--> $DIR/derive-clone-implicit-bound.rs:26:26
|
LL | fn update_value<T, F>(&self, offset: TypedAddress<T>, update: F)
| ------ move occurs because `offset` has type `TypedAddress<T>`, which does not implement the `Copy` trait
@ -11,23 +11,23 @@ LL | self.write_value(offset, &new);
| ^^^^^^ value used here after move
|
note: consider changing this parameter type in method `return_value` to borrow instead if owning the value isn't necessary
--> $DIR/derive-clone-implicit-bound.rs:16:39
--> $DIR/derive-clone-implicit-bound.rs:15:39
|
LL | fn return_value<T>(&self, offset: TypedAddress<T>) -> T;
| ------------ in this method ^^^^^^^^^^^^^^^ this parameter takes ownership of the value
help: if `TypedAddress<T>` implemented `Clone`, you could clone the value
note: if all bounds were met, you could clone the value
--> $DIR/derive-clone-implicit-bound.rs:6:1
|
LL | #[derive(Clone, Copy)]
| ----- derived `Clone` adds implicit bounds on type parameters
LL | pub struct TypedAddress<T>{
| ^^^^^^^^^^^^^^^^^^^^^^^^-^
| | |
| | introduces an implicit `T: Clone` bound
| consider manually implementing `Clone` for this type
| |
| introduces an implicit `T: Clone` bound
...
LL | let old = self.return_value(offset);
| ------ you could clone this value
= help: consider manually implementing `Clone` to avoid undesired bounds
help: consider further restricting type parameter `T` with trait `Copy`
|
LL | where F: FnOnce(T) -> T, T: Copy

View file

@ -18,7 +18,7 @@ help: `Fn` and `FnMut` closures require captured values to be able to be consume
|
LL | async fn spawn_blocking<T>(f: impl (Fn() -> T) + Send + Sync + 'static) -> T {
| ^^^^^^^^^^^
help: if `StructB` implemented `Clone`, you could clone the value
note: if `StructB` implemented `Clone`, you could clone the value
--> $DIR/issue-103624.rs:23:1
|
LL | self.b;

View file

@ -11,7 +11,7 @@ note: `Example::<E, FakeParam>::change` takes ownership of the receiver `self`,
|
LL | unsafe fn change<NewFakeParam>(self) -> Example<E, NewFakeParam> {
| ^^^^
help: if `Example<E, NoLifetime>` implemented `Clone`, you could clone the value
note: if `Example<E, NoLifetime>` implemented `Clone`, you could clone the value
--> $DIR/issue-119915-bad-clone-suggestion.rs:3:1
|
LL | struct Example<E, FakeParam>(PhantomData<(fn(E), fn(FakeParam))>);

View file

@ -4,7 +4,7 @@ error[E0507]: cannot move out of static item `FOO`
LL | let _a = FOO;
| ^^^ move occurs because `FOO` has type `Foo`, which does not implement the `Copy` trait
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/issue-17718-static-move.rs:1:1
|
LL | struct Foo;

View file

@ -4,7 +4,7 @@ error[E0507]: cannot move out of a mutable reference
LL | let a = unsafe { *mut_ref() };
| ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
|
help: if `T` implemented `Clone`, you could clone the value
note: if `T` implemented `Clone`, you could clone the value
--> $DIR/issue-20801.rs:3:1
|
LL | struct T(u8);
@ -24,7 +24,7 @@ error[E0507]: cannot move out of a shared reference
LL | let b = unsafe { *imm_ref() };
| ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
|
help: if `T` implemented `Clone`, you could clone the value
note: if `T` implemented `Clone`, you could clone the value
--> $DIR/issue-20801.rs:3:1
|
LL | struct T(u8);
@ -44,7 +44,7 @@ error[E0507]: cannot move out of a raw pointer
LL | let c = unsafe { *mut_ptr() };
| ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
|
help: if `T` implemented `Clone`, you could clone the value
note: if `T` implemented `Clone`, you could clone the value
--> $DIR/issue-20801.rs:3:1
|
LL | struct T(u8);
@ -59,7 +59,7 @@ error[E0507]: cannot move out of a raw pointer
LL | let d = unsafe { *const_ptr() };
| ^^^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait
|
help: if `T` implemented `Clone`, you could clone the value
note: if `T` implemented `Clone`, you could clone the value
--> $DIR/issue-20801.rs:3:1
|
LL | struct T(u8);

View file

@ -7,7 +7,7 @@ LL | &([S][0],);
| cannot move out of here
| move occurs because value has type `S`, which does not implement the `Copy` trait
|
help: if `S` implemented `Clone`, you could clone the value
note: if `S` implemented `Clone`, you could clone the value
--> $DIR/move-error-in-promoted-2.rs:3:1
|
LL | struct S;

View file

@ -9,7 +9,7 @@ LL | let a = $c;
LL | sss!();
| ------ in this macro invocation
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/move-error-snippets.rs:9:1
|
LL | struct A;

View file

@ -4,7 +4,7 @@ error[E0507]: cannot move out of a shared reference
LL | static Y: usize = get(*&X);
| ^^^ move occurs because value has type `Foo`, which does not implement the `Copy` trait
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/move-in-static-initializer-issue-38520.rs:5:1
|
LL | struct Foo(usize);
@ -19,7 +19,7 @@ error[E0507]: cannot move out of a shared reference
LL | const Z: usize = get(*&X);
| ^^^ move occurs because value has type `Foo`, which does not implement the `Copy` trait
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/move-in-static-initializer-issue-38520.rs:5:1
|
LL | struct Foo(usize);

View file

@ -12,7 +12,7 @@ LL |
LL | use_value(*theref)
| ------- borrow later used here
|
help: if `Alloc` implemented `Clone`, you could clone the value
note: if `Alloc` implemented `Clone`, you could clone the value
--> $DIR/leak-alloc.rs:8:1
|
LL | struct Alloc {}

View file

@ -1,16 +1,16 @@
//! regression test for <https://github.com/rust-lang/rust/issues/24357>
struct NoCopy; //~ HELP if `NoCopy` implemented `Clone`, you could clone the value
//~^ NOTE consider implementing `Clone` for this type
struct NoCopy; //~ NOTE: if `NoCopy` implemented `Clone`, you could clone the value
//~^ NOTE: consider implementing `Clone` for this type
fn main() {
let x = NoCopy;
//~^ NOTE move occurs because `x` has type `NoCopy`
//~^ NOTE: move occurs because `x` has type `NoCopy`
let f = move || {
//~^ NOTE value moved into closure here
//~^ NOTE: value moved into closure here
let y = x;
//~^ NOTE variable moved due to use in closure
//~| NOTE you could clone this value
//~^ NOTE: variable moved due to use in closure
//~| NOTE: you could clone this value
};
let z = x;
//~^ ERROR use of moved value: `x`
//~| NOTE value used here after move
//~^ ERROR: use of moved value: `x`
//~| NOTE: value used here after move
}

View file

@ -13,7 +13,7 @@ LL | let y = x;
LL | let z = x;
| ^ value used here after move
|
help: if `NoCopy` implemented `Clone`, you could clone the value
note: if `NoCopy` implemented `Clone`, you could clone the value
--> $DIR/closure-move-use-after-move-diagnostic.rs:2:1
|
LL | struct NoCopy;

View file

@ -10,7 +10,7 @@ LL | yield;
LL | let second = first;
| ^^^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/moved-twice.rs:9:1
|
LL | struct Foo([u8; FOO_SIZE]);

View file

@ -7,7 +7,7 @@ LL | #[repr(packed)]
LL | struct X(Y);
| ^ move occurs because value has type `Y`, which does not implement the `Copy` trait
|
help: if `Y` implemented `Clone`, you could clone the value
note: if `Y` implemented `Clone`, you could clone the value
--> $DIR/deriving-with-repr-packed.rs:16:1
|
LL | struct Y(usize);

View file

@ -14,7 +14,7 @@ LL | println!("child function: {}", fancy_num.num);
LL | println!("main function: {}", fancy_ref.num);
| ------------- borrow later used here
|
help: if `FancyNum` implemented `Clone`, you could clone the value
note: if `FancyNum` implemented `Clone`, you could clone the value
--> $DIR/E0504.rs:2:1
|
LL | struct FancyNum {

View file

@ -11,7 +11,7 @@ LL | eat(x);
LL | _ref_to_val.use_ref();
| ----------- borrow later used here
|
help: if `Value` implemented `Clone`, you could clone the value
note: if `Value` implemented `Clone`, you could clone the value
--> $DIR/E0505.rs:1:1
|
LL | struct Value {}

View file

@ -11,7 +11,7 @@ note: `TheDarkKnight::nothing_is_true` takes ownership of the receiver `self`, w
|
LL | fn nothing_is_true(self) {}
| ^^^^
help: if `TheDarkKnight` implemented `Clone`, you could clone the value
note: if `TheDarkKnight` implemented `Clone`, you could clone the value
--> $DIR/E0507.rs:3:1
|
LL | struct TheDarkKnight;

View file

@ -7,7 +7,7 @@ LL | let _value = array[0];
| cannot move out of here
| move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait
|
help: if `NonCopy` implemented `Clone`, you could clone the value
note: if `NonCopy` implemented `Clone`, you could clone the value
--> $DIR/E0508-fail.rs:1:1
|
LL | struct NonCopy;

View file

@ -7,7 +7,7 @@ LL | let _value = array[0];
| cannot move out of here
| move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait
|
help: if `NonCopy` implemented `Clone`, you could clone the value
note: if `NonCopy` implemented `Clone`, you could clone the value
--> $DIR/E0508.rs:1:1
|
LL | struct NonCopy;

View file

@ -7,7 +7,7 @@ LL | let fancy_field = drop_struct.fancy;
| cannot move out of here
| move occurs because `drop_struct.fancy` has type `FancyNum`, which does not implement the `Copy` trait
|
help: if `FancyNum` implemented `Clone`, you could clone the value
note: if `FancyNum` implemented `Clone`, you could clone the value
--> $DIR/E0509.rs:1:1
|
LL | struct FancyNum {

View file

@ -4,7 +4,7 @@ error[E0507]: cannot move out of `*inbounds` which is behind a shared reference
LL | array[*inbounds as usize]
| ^^^^^^^^^ move occurs because `*inbounds` has type `Enum`, which does not implement the `Copy` trait
|
help: if `Enum` implemented `Clone`, you could clone the value
note: if `Enum` implemented `Clone`, you could clone the value
--> $DIR/issue-102389.rs:1:1
|
LL | enum Enum { A, B, C }

View file

@ -3,10 +3,10 @@
// 'value moved in previous iteration of loop' message
struct NonCopy;
//~^ HELP if `NonCopy` implemented `Clone`
//~| HELP if `NonCopy` implemented `Clone`
//~| HELP if `NonCopy` implemented `Clone`
//~| HELP if `NonCopy` implemented `Clone`
//~^ NOTE if `NonCopy` implemented `Clone`
//~| NOTE if `NonCopy` implemented `Clone`
//~| NOTE if `NonCopy` implemented `Clone`
//~| NOTE if `NonCopy` implemented `Clone`
//~| NOTE consider implementing `Clone` for this type
//~| NOTE consider implementing `Clone` for this type
//~| NOTE consider implementing `Clone` for this type

View file

@ -10,7 +10,7 @@ LL | let _used = value;
LL | let _used2 = value;
| ^^^^^ value used here after move
|
help: if `NonCopy` implemented `Clone`, you could clone the value
note: if `NonCopy` implemented `Clone`, you could clone the value
--> $DIR/issue-72649-uninit-in-loop.rs:5:1
|
LL | struct NonCopy;
@ -33,7 +33,7 @@ LL | let _used = value;
LL | let _used2 = value;
| ^^^^^ value used here after move
|
help: if `NonCopy` implemented `Clone`, you could clone the value
note: if `NonCopy` implemented `Clone`, you could clone the value
--> $DIR/issue-72649-uninit-in-loop.rs:5:1
|
LL | struct NonCopy;
@ -53,7 +53,7 @@ LL | loop {
LL | let _used = value;
| ^^^^^ value moved here, in previous iteration of loop
|
help: if `NonCopy` implemented `Clone`, you could clone the value
note: if `NonCopy` implemented `Clone`, you could clone the value
--> $DIR/issue-72649-uninit-in-loop.rs:5:1
|
LL | struct NonCopy;
@ -73,7 +73,7 @@ LL | loop {
LL | let _used2 = value;
| ^^^^^ value moved here, in previous iteration of loop
|
help: if `NonCopy` implemented `Clone`, you could clone the value
note: if `NonCopy` implemented `Clone`, you could clone the value
--> $DIR/issue-72649-uninit-in-loop.rs:5:1
|
LL | struct NonCopy;

View file

@ -11,7 +11,7 @@ LL | &mut a;
LL | a;
| - use occurs due to use in closure
|
help: if `NotCopy` implemented `Clone`, you could clone the value
note: if `NotCopy` implemented `Clone`, you could clone the value
--> $DIR/issue-75904-move-closure-loop.rs:5:1
|
LL | struct NotCopy;

View file

@ -8,7 +8,7 @@ LL | drop(foo);
LL | match foo {
| ^^^^^^^^^ value used here after move
|
help: if `X` implemented `Clone`, you could clone the value
note: if `X` implemented `Clone`, you could clone the value
--> $DIR/matching-partially-moved-value-17385.rs:2:1
|
LL | struct X(isize);
@ -27,7 +27,7 @@ LL | drop(e);
LL | match e {
| ^ value used here after move
|
help: if `Enum` implemented `Clone`, you could clone the value
note: if `Enum` implemented `Clone`, you could clone the value
--> $DIR/matching-partially-moved-value-17385.rs:4:1
|
LL | enum Enum {

View file

@ -132,7 +132,7 @@ LL | foo_add + Foo;
LL | foo_add;
| ^^^^^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/move-fn-self-receiver.rs:5:1
|
LL | struct Foo;

View file

@ -7,7 +7,7 @@ LL | a[i]
| cannot move out of here
| move occurs because `a[_]` has type `D`, which does not implement the `Copy` trait
|
help: if `D` implemented `Clone`, you could clone the value
note: if `D` implemented `Clone`, you could clone the value
--> $DIR/move-out-of-array-1.rs:5:1
|
LL | struct D { _x: u8 }

View file

@ -23,7 +23,7 @@ LL | qux(bar);
LL | let _baa = bar;
| ^^^ value used here after move
|
help: if `Bar` implemented `Clone`, you could clone the value
note: if `Bar` implemented `Clone`, you could clone the value
--> $DIR/moved-value-on-as-ref-arg.rs:5:1
|
LL | struct Bar;
@ -61,7 +61,7 @@ LL | baz(bar);
LL | let _baa = bar;
| ^^^ value used here after move
|
help: if `Bar` implemented `Clone`, you could clone the value
note: if `Bar` implemented `Clone`, you could clone the value
--> $DIR/moved-value-on-as-ref-arg.rs:5:1
|
LL | struct Bar;

View file

@ -28,7 +28,7 @@ LL | let mut s: S<B> = S::new(); drop(s);
LL | s.x = 10; s.y = Box::new(20);
| ^^^^^^^^ value partially assigned here after move
|
help: if `S<Box<u32>>` implemented `Clone`, you could clone the value
note: if `S<Box<u32>>` implemented `Clone`, you could clone the value
--> $DIR/issue-21232-partial-init-and-use.rs:15:1
|
LL | struct S<Y> {
@ -82,7 +82,7 @@ LL | let mut s: S<B> = S::new(); drop(s);
LL | s.x = 10;
| ^^^^^^^^ value partially assigned here after move
|
help: if `S<Box<u32>>` implemented `Clone`, you could clone the value
note: if `S<Box<u32>>` implemented `Clone`, you could clone the value
--> $DIR/issue-21232-partial-init-and-use.rs:15:1
|
LL | struct S<Y> {

View file

@ -4,7 +4,7 @@ error[E0507]: cannot move out of `*a` which is behind a shared reference
LL | let b = *a;
| ^^ move occurs because `*a` has type `A`, which does not implement the `Copy` trait
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/move-errors.rs:1:1
|
LL | struct A(String);
@ -27,7 +27,7 @@ LL | let b = a[0];
| cannot move out of here
| move occurs because `a[_]` has type `A`, which does not implement the `Copy` trait
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/move-errors.rs:1:1
|
LL | struct A(String);
@ -46,7 +46,7 @@ error[E0507]: cannot move out of `**r` which is behind a shared reference
LL | let s = **r;
| ^^^ move occurs because `**r` has type `A`, which does not implement the `Copy` trait
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/move-errors.rs:1:1
|
LL | struct A(String);
@ -66,7 +66,7 @@ error[E0507]: cannot move out of an `Rc`
LL | let s = *r;
| ^^ move occurs because value has type `A`, which does not implement the `Copy` trait
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/move-errors.rs:1:1
|
LL | struct A(String);
@ -89,7 +89,7 @@ LL | let a = [A("".to_string())][0];
| cannot move out of here
| move occurs because value has type `A`, which does not implement the `Copy` trait
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/move-errors.rs:1:1
|
LL | struct A(String);
@ -137,7 +137,7 @@ error[E0507]: cannot move out of `*a` which is behind a shared reference
LL | b = *a;
| ^^ move occurs because `*a` has type `A`, which does not implement the `Copy` trait
|
help: if `A` implemented `Clone`, you could clone the value
note: if `A` implemented `Clone`, you could clone the value
--> $DIR/move-errors.rs:1:1
|
LL | struct A(String);

View file

@ -8,7 +8,7 @@ LL | foo_pin_mut(&pin mut foo);
LL | foo_move(foo);
| ^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -27,7 +27,7 @@ LL | let x = &pin mut foo;
LL | foo_move(foo);
| ^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -46,7 +46,7 @@ LL | foo_pin_mut(&pin mut foo); // ok
LL | foo_move(foo);
| ^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -65,7 +65,7 @@ LL | let x = &pin mut foo; // ok
LL | foo_move(foo);
| ^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -87,7 +87,7 @@ LL |
LL | foo_pin_ref(x);
| - borrow later used here
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -106,7 +106,7 @@ LL | foo_pin_mut(&pin mut foo); // ok
LL | foo_ref(&foo);
| ^^^^ value borrowed here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -125,7 +125,7 @@ LL | let x = &pin mut foo; // ok
LL | foo_ref(&foo);
| ^^^^ value borrowed here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -144,7 +144,7 @@ LL | foo_pin_mut(&pin mut foo); // ok
LL | foo_pin_mut(&pin mut foo);
| ^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -163,7 +163,7 @@ LL | let x = &pin mut foo; // ok
LL | foo_pin_mut(&pin mut foo);
| ^^^ value used here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -185,7 +185,7 @@ LL |
LL | foo_pin_ref(x);
| - borrow later used here
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -204,7 +204,7 @@ LL | foo_pin_mut(&pin mut foo); // ok
LL | foo_pin_ref(&pin const foo);
| ^^^^^^^^^^^^^^ value borrowed here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);
@ -223,7 +223,7 @@ LL | let x = &pin mut foo; // ok
LL | foo_pin_ref(&pin const foo);
| ^^^^^^^^^^^^^^ value borrowed here after move
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:16:1
|
LL | struct Foo(PhantomPinned);

View file

@ -33,7 +33,7 @@ LL |
LL | foo_pin_mut(x); //
| - borrow later used here
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:20:1
|
LL | struct Foo;
@ -55,7 +55,7 @@ LL |
LL | foo_pin_mut(x); //
| - borrow later used here
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:20:1
|
LL | struct Foo;
@ -77,7 +77,7 @@ LL |
LL | foo_pin_ref(x);
| - borrow later used here
|
help: if `Foo` implemented `Clone`, you could clone the value
note: if `Foo` implemented `Clone`, you could clone the value
--> $DIR/borrow-unpin.rs:20:1
|
LL | struct Foo;

View file

@ -8,7 +8,7 @@ LL | pin!(pointee);
LL | let _moved = pointee;
| ^^^^^^^ value used here after move
|
help: if `a::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
note: if `a::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
--> $DIR/pin_move.rs:7:5
|
LL | struct NotCopy<T>(T);
@ -23,7 +23,7 @@ error[E0507]: cannot move out of a mutable reference
LL | pin!(*&mut pointee);
| ^^^^^^^^^^^^^ move occurs because value has type `b::NotCopy<PhantomPinned>`, which does not implement the `Copy` trait
|
help: if `b::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
note: if `b::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
--> $DIR/pin_move.rs:16:5
|
LL | struct NotCopy<T>(T);

View file

@ -7,7 +7,7 @@ LL | (b,) = *tuple;
| data moved here
| move occurs because the place has type `NonCopy`, which does not implement the `Copy` trait
|
help: if `NonCopy` implemented `Clone`, you could clone the value
note: if `NonCopy` implemented `Clone`, you could clone the value
--> $DIR/non_copy_move_out_of_tuple.rs:3:1
|
LL | struct NonCopy;

View file

@ -10,7 +10,7 @@ LL | let x = var;
| ^^^ move occurs because `var` has type `NotCopyable`, which does not implement the `Copy` trait
|
= help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once
help: if `NotCopyable` implemented `Clone`, you could clone the value
note: if `NotCopyable` implemented `Clone`, you could clone the value
--> $DIR/option-content-move3.rs:2:1
|
LL | struct NotCopyable;
@ -43,7 +43,7 @@ help: `Fn` and `FnMut` closures require captured values to be able to be consume
|
LL | fn func<F: FnMut() -> H, H: FnMut()>(_: F) {}
| ^^^^^^^^^^^^
help: if `NotCopyable` implemented `Clone`, you could clone the value
note: if `NotCopyable` implemented `Clone`, you could clone the value
--> $DIR/option-content-move3.rs:2:1
|
LL | struct NotCopyable;

View file

@ -59,7 +59,7 @@ error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, Moc
LL | let a = (u.x.0).0;
| ^^^^^^^^^ move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait
|
help: if `MockVec<u8>` implemented `Clone`, you could clone the value
note: if `MockVec<u8>` implemented `Clone`, you could clone the value
--> $DIR/union-borrow-move-parent-sibling.rs:25:1
|
LL | struct MockVec<T> {

View file

@ -16,7 +16,7 @@ LL | fn move_out<T>(x: T) {}
| -------- ^ this parameter takes ownership of the value
| |
| in this function
help: if `U1` implemented `Clone`, you could clone the value
note: if `U1` implemented `Clone`, you could clone the value
--> $DIR/union-move.rs:9:1
|
LL | union U1 {
@ -43,7 +43,7 @@ LL | fn move_out<T>(x: T) {}
| -------- ^ this parameter takes ownership of the value
| |
| in this function
help: if `U1` implemented `Clone`, you could clone the value
note: if `U1` implemented `Clone`, you could clone the value
--> $DIR/union-move.rs:9:1
|
LL | union U1 {

View file

@ -10,7 +10,7 @@ LL | drop(a);
LL | drop(x);
| - borrow later used here
|
help: if `AffineU32` implemented `Clone`, you could clone the value
note: if `AffineU32` implemented `Clone`, you could clone the value
--> $DIR/variance-issue-20533.rs:26:1
|
LL | struct AffineU32(u32);
@ -31,7 +31,7 @@ LL | drop(a);
LL | drop(x);
| - borrow later used here
|
help: if `AffineU32` implemented `Clone`, you could clone the value
note: if `AffineU32` implemented `Clone`, you could clone the value
--> $DIR/variance-issue-20533.rs:26:1
|
LL | struct AffineU32(u32);
@ -52,7 +52,7 @@ LL | drop(a);
LL | drop(x);
| - borrow later used here
|
help: if `AffineU32` implemented `Clone`, you could clone the value
note: if `AffineU32` implemented `Clone`, you could clone the value
--> $DIR/variance-issue-20533.rs:26:1
|
LL | struct AffineU32(u32);
@ -73,7 +73,7 @@ LL | drop(a);
LL | drop(x);
| - borrow later used here
|
help: if `AffineU32` implemented `Clone`, you could clone the value
note: if `AffineU32` implemented `Clone`, you could clone the value
--> $DIR/variance-issue-20533.rs:26:1
|
LL | struct AffineU32(u32);