Change note to help
This commit is contained in:
parent
6c8eee8297
commit
879633f97b
46 changed files with 90 additions and 87 deletions
|
|
@ -1301,7 +1301,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
),
|
||||
);
|
||||
span.push_span_label(expr.span, "you could clone this value");
|
||||
err.span_note(
|
||||
err.span_help(
|
||||
span,
|
||||
format!("if `{ty}` implemented `Clone`, you could clone the value"),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | drop(t);
|
|||
LL | drop(t);
|
||||
| ^ value used here after move
|
||||
|
|
||||
note: if `S<()>` implemented `Clone`, you could clone the value
|
||||
help: 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>);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ LL |
|
|||
LL | x.hello();
|
||||
| - variable moved due to use in coroutine
|
||||
|
|
||||
note: if `Ty` implemented `Clone`, you could clone the value
|
||||
help: if `Ty` implemented `Clone`, you could clone the value
|
||||
--> $DIR/closure-shim-borrowck-error.rs:17:1
|
||||
|
|
||||
LL | x.hello();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | let c = async || {
|
|||
LL | *x;
|
||||
| ^^ `*x` is moved here
|
||||
|
|
||||
note: if `Ty` implemented `Clone`, you could clone the value
|
||||
help: if `Ty` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-out-of-ref.rs:5:1
|
||||
|
|
||||
LL | struct Ty;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: if `Foo` implemented `Clone`, you could clone the value
|
||||
--> $DIR/borrowck-move-out-of-static-item.rs:3:1
|
||||
|
|
||||
LL | struct Foo {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LL | let S { x: ax } = a;
|
|||
LL | f(pb);
|
||||
| -- borrow later used here
|
||||
|
|
||||
note: if `S` implemented `Clone`, you could clone the value
|
||||
help: if `S` implemented `Clone`, you could clone the value
|
||||
--> $DIR/borrowck-move-subcomponent.rs:6:1
|
||||
|
|
||||
LL | struct S {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ LL | s(" world".to_string());
|
|||
LL | s(" world".to_string());
|
||||
| ^ value used here after move
|
||||
|
|
||||
note: if `SFnOnce` implemented `Clone`, you could clone the value
|
||||
help: if `SFnOnce` implemented `Clone`, you could clone the value
|
||||
--> $DIR/borrowck-overloaded-call.rs:41:1
|
||||
|
|
||||
LL | struct SFnOnce {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ LL |
|
|||
LL | println!("{b:?}");
|
||||
| - borrow later used here
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: if `A` implemented `Clone`, you could clone the value
|
||||
--> $DIR/clone-on-ref.rs:19:1
|
||||
|
|
||||
LL | struct A;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::marker::PhantomData;
|
|||
|
||||
#[derive(Clone, Copy)] //~ NOTE derived `Clone` adds implicit bounds on type parameters
|
||||
pub struct TypedAddress<T>{
|
||||
//~^ NOTE if `TypedAddress<T>` implemented `Clone`, you could clone the value
|
||||
//~^ 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
|
||||
inner: u64,
|
||||
|
|
@ -19,7 +19,7 @@ pub trait Memory {
|
|||
//~| 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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ note: consider changing this parameter type in method `return_value` to borrow i
|
|||
|
|
||||
LL | fn return_value<T>(&self, offset: TypedAddress<T>) -> T;
|
||||
| ------------ in this method ^^^^^^^^^^^^^^^ this parameter takes ownership of the value
|
||||
note: if `TypedAddress<T>` implemented `Clone`, you could clone the value
|
||||
help: if `TypedAddress<T>` implemented `Clone`, you could clone the value
|
||||
--> $DIR/derive-clone-implicit-bound.rs:6:1
|
||||
|
|
||||
LL | #[derive(Clone, Copy)]
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
| ^^^^^^^^^^^
|
||||
note: if `StructB` implemented `Clone`, you could clone the value
|
||||
help: if `StructB` implemented `Clone`, you could clone the value
|
||||
--> $DIR/issue-103624.rs:23:1
|
||||
|
|
||||
LL | self.b;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ note: `Example::<E, FakeParam>::change` takes ownership of the receiver `self`,
|
|||
|
|
||||
LL | unsafe fn change<NewFakeParam>(self) -> Example<E, NewFakeParam> {
|
||||
| ^^^^
|
||||
note: if `Example<E, NoLifetime>` implemented `Clone`, you could clone the value
|
||||
help: 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))>);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: if `Foo` implemented `Clone`, you could clone the value
|
||||
--> $DIR/issue-17718-static-move.rs:1:1
|
||||
|
|
||||
LL | struct Foo;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `T` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `T` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `T` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `T` implemented `Clone`, you could clone the value
|
||||
help: if `T` implemented `Clone`, you could clone the value
|
||||
--> $DIR/issue-20801.rs:3:1
|
||||
|
|
||||
LL | struct T(u8);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `S` implemented `Clone`, you could clone the value
|
||||
help: if `S` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-error-in-promoted-2.rs:3:1
|
||||
|
|
||||
LL | struct S;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ LL | let a = $c;
|
|||
LL | sss!();
|
||||
| ------ in this macro invocation
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: if `A` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-error-snippets.rs:9:1
|
||||
|
|
||||
LL | struct A;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: if `Foo` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-in-static-initializer-issue-38520.rs:5:1
|
||||
|
|
||||
LL | struct Foo(usize);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ LL |
|
|||
LL | use_value(*theref)
|
||||
| ------- borrow later used here
|
||||
|
|
||||
note: if `Alloc` implemented `Clone`, you could clone the value
|
||||
help: if `Alloc` implemented `Clone`, you could clone the value
|
||||
--> $DIR/leak-alloc.rs:8:1
|
||||
|
|
||||
LL | struct Alloc {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! regression test for <https://github.com/rust-lang/rust/issues/24357>
|
||||
struct NoCopy; //~ NOTE if `NoCopy` implemented `Clone`, you could clone the value
|
||||
struct NoCopy; //~ HELP if `NoCopy` implemented `Clone`, you could clone the value
|
||||
//~^ NOTE consider implementing `Clone` for this type
|
||||
fn main() {
|
||||
let x = NoCopy;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ LL | let y = x;
|
|||
LL | let z = x;
|
||||
| ^ value used here after move
|
||||
|
|
||||
note: if `NoCopy` implemented `Clone`, you could clone the value
|
||||
help: if `NoCopy` implemented `Clone`, you could clone the value
|
||||
--> $DIR/closure-move-use-after-move-diagnostic.rs:2:1
|
||||
|
|
||||
LL | struct NoCopy;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LL | yield;
|
|||
LL | let second = first;
|
||||
| ^^^^^ value used here after move
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: if `Foo` implemented `Clone`, you could clone the value
|
||||
--> $DIR/moved-twice.rs:9:1
|
||||
|
|
||||
LL | struct Foo([u8; FOO_SIZE]);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `Y` implemented `Clone`, you could clone the value
|
||||
help: if `Y` implemented `Clone`, you could clone the value
|
||||
--> $DIR/deriving-with-repr-packed.rs:16:1
|
||||
|
|
||||
LL | struct Y(usize);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ LL | println!("child function: {}", fancy_num.num);
|
|||
LL | println!("main function: {}", fancy_ref.num);
|
||||
| ------------- borrow later used here
|
||||
|
|
||||
note: if `FancyNum` implemented `Clone`, you could clone the value
|
||||
help: if `FancyNum` implemented `Clone`, you could clone the value
|
||||
--> $DIR/E0504.rs:2:1
|
||||
|
|
||||
LL | struct FancyNum {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ LL | eat(x);
|
|||
LL | _ref_to_val.use_ref();
|
||||
| ----------- borrow later used here
|
||||
|
|
||||
note: if `Value` implemented `Clone`, you could clone the value
|
||||
help: if `Value` implemented `Clone`, you could clone the value
|
||||
--> $DIR/E0505.rs:1:1
|
||||
|
|
||||
LL | struct Value {}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ note: `TheDarkKnight::nothing_is_true` takes ownership of the receiver `self`, w
|
|||
|
|
||||
LL | fn nothing_is_true(self) {}
|
||||
| ^^^^
|
||||
note: if `TheDarkKnight` implemented `Clone`, you could clone the value
|
||||
help: if `TheDarkKnight` implemented `Clone`, you could clone the value
|
||||
--> $DIR/E0507.rs:3:1
|
||||
|
|
||||
LL | struct TheDarkKnight;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
help: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
--> $DIR/E0508-fail.rs:1:1
|
||||
|
|
||||
LL | struct NonCopy;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
help: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
--> $DIR/E0508.rs:1:1
|
||||
|
|
||||
LL | struct NonCopy;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `FancyNum` implemented `Clone`, you could clone the value
|
||||
help: if `FancyNum` implemented `Clone`, you could clone the value
|
||||
--> $DIR/E0509.rs:1:1
|
||||
|
|
||||
LL | struct FancyNum {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `Enum` implemented `Clone`, you could clone the value
|
||||
help: if `Enum` implemented `Clone`, you could clone the value
|
||||
--> $DIR/issue-102389.rs:1:1
|
||||
|
|
||||
LL | enum Enum { A, B, C }
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
// 'value moved in previous iteration of loop' message
|
||||
|
||||
struct NonCopy;
|
||||
//~^ NOTE if `NonCopy` implemented `Clone`
|
||||
//~| NOTE if `NonCopy` implemented `Clone`
|
||||
//~| NOTE if `NonCopy` implemented `Clone`
|
||||
//~| NOTE if `NonCopy` implemented `Clone`
|
||||
//~^ HELP if `NonCopy` implemented `Clone`
|
||||
//~| HELP if `NonCopy` implemented `Clone`
|
||||
//~| HELP if `NonCopy` implemented `Clone`
|
||||
//~| HELP 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
|
||||
|
|
@ -70,6 +70,7 @@ fn moved_loop_2() {
|
|||
fn uninit_1() {
|
||||
loop {
|
||||
let value: NonCopy; //~ NOTE declared here
|
||||
//~^ HELP consider assigning a value
|
||||
let _used = value; //~ ERROR binding `value` isn't initialized
|
||||
//~^ NOTE `value` used here but it isn't initialized
|
||||
}
|
||||
|
|
@ -77,6 +78,7 @@ fn uninit_1() {
|
|||
|
||||
fn uninit_2() {
|
||||
let mut value: NonCopy; //~ NOTE declared here
|
||||
//~^ HELP consider assigning a value
|
||||
loop {
|
||||
let _used = value; //~ ERROR binding `value` isn't initialized
|
||||
//~^ NOTE `value` used here but it isn't initialized
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LL | let _used = value;
|
|||
LL | let _used2 = value;
|
||||
| ^^^^^ value used here after move
|
||||
|
|
||||
note: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
help: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
--> $DIR/issue-72649-uninit-in-loop.rs:5:1
|
||||
|
|
||||
LL | struct NonCopy;
|
||||
|
|
@ -83,10 +83,11 @@ LL | let _used2 = value;
|
|||
| ----- you could clone this value
|
||||
|
||||
error[E0381]: used binding `value` isn't initialized
|
||||
--> $DIR/issue-72649-uninit-in-loop.rs:73:21
|
||||
--> $DIR/issue-72649-uninit-in-loop.rs:74:21
|
||||
|
|
||||
LL | let value: NonCopy;
|
||||
| ----- binding declared here but left uninitialized
|
||||
LL |
|
||||
LL | let _used = value;
|
||||
| ^^^^^ `value` used here but it isn't initialized
|
||||
|
|
||||
|
|
@ -96,11 +97,11 @@ LL | let value: NonCopy = /* value */;
|
|||
| +++++++++++++
|
||||
|
||||
error[E0381]: used binding `value` isn't initialized
|
||||
--> $DIR/issue-72649-uninit-in-loop.rs:81:21
|
||||
--> $DIR/issue-72649-uninit-in-loop.rs:83:21
|
||||
|
|
||||
LL | let mut value: NonCopy;
|
||||
| --------- binding declared here but left uninitialized
|
||||
LL | loop {
|
||||
...
|
||||
LL | let _used = value;
|
||||
| ^^^^^ `value` used here but it isn't initialized
|
||||
|
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ LL | &mut a;
|
|||
LL | a;
|
||||
| - use occurs due to use in closure
|
||||
|
|
||||
note: if `NotCopy` implemented `Clone`, you could clone the value
|
||||
help: if `NotCopy` implemented `Clone`, you could clone the value
|
||||
--> $DIR/issue-75904-move-closure-loop.rs:5:1
|
||||
|
|
||||
LL | struct NotCopy;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | drop(foo);
|
|||
LL | match foo {
|
||||
| ^^^^^^^^^ value used here after move
|
||||
|
|
||||
note: if `X` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Enum` implemented `Clone`, you could clone the value
|
||||
help: if `Enum` implemented `Clone`, you could clone the value
|
||||
--> $DIR/matching-partially-moved-value-17385.rs:4:1
|
||||
|
|
||||
LL | enum Enum {
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ LL | foo_add + Foo;
|
|||
LL | foo_add;
|
||||
| ^^^^^^^ value used here after move
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: if `Foo` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-fn-self-receiver.rs:5:1
|
||||
|
|
||||
LL | struct Foo;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `D` implemented `Clone`, you could clone the value
|
||||
help: if `D` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-out-of-array-1.rs:5:1
|
||||
|
|
||||
LL | struct D { _x: u8 }
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ LL | qux(bar);
|
|||
LL | let _baa = bar;
|
||||
| ^^^ value used here after move
|
||||
|
|
||||
note: if `Bar` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Bar` implemented `Clone`, you could clone the value
|
||||
help: if `Bar` implemented `Clone`, you could clone the value
|
||||
--> $DIR/moved-value-on-as-ref-arg.rs:5:1
|
||||
|
|
||||
LL | struct Bar;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `S<Box<u32>>` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `S<Box<u32>>` implemented `Clone`, you could clone the value
|
||||
help: 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> {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `A` implemented `Clone`, you could clone the value
|
||||
help: if `A` implemented `Clone`, you could clone the value
|
||||
--> $DIR/move-errors.rs:1:1
|
||||
|
|
||||
LL | struct A(String);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | foo_pin_mut(&pin mut foo);
|
|||
LL | foo_move(foo);
|
||||
| ^^^ value used here after move
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: if `Foo` implemented `Clone`, you could clone the value
|
||||
--> $DIR/borrow-unpin.rs:16:1
|
||||
|
|
||||
LL | struct Foo(PhantomPinned);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ LL |
|
|||
LL | foo_pin_mut(x); //
|
||||
| - borrow later used here
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `Foo` implemented `Clone`, you could clone the value
|
||||
help: if `Foo` implemented `Clone`, you could clone the value
|
||||
--> $DIR/borrow-unpin.rs:20:1
|
||||
|
|
||||
LL | struct Foo;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | pin!(pointee);
|
|||
LL | let _moved = pointee;
|
||||
| ^^^^^^^ value used here after move
|
||||
|
|
||||
note: if `a::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `b::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
|
||||
help: if `b::NotCopy<PhantomPinned>` implemented `Clone`, you could clone the value
|
||||
--> $DIR/pin_move.rs:16:5
|
||||
|
|
||||
LL | struct NotCopy<T>(T);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
help: if `NonCopy` implemented `Clone`, you could clone the value
|
||||
--> $DIR/non_copy_move_out_of_tuple.rs:3:1
|
||||
|
|
||||
LL | struct NonCopy;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
note: if `NotCopyable` implemented `Clone`, you could clone the value
|
||||
help: 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) {}
|
||||
| ^^^^^^^^^^^^
|
||||
note: if `NotCopyable` implemented `Clone`, you could clone the value
|
||||
help: if `NotCopyable` implemented `Clone`, you could clone the value
|
||||
--> $DIR/option-content-move3.rs:2:1
|
||||
|
|
||||
LL | struct NotCopyable;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
note: if `MockVec<u8>` implemented `Clone`, you could clone the value
|
||||
help: if `MockVec<u8>` implemented `Clone`, you could clone the value
|
||||
--> $DIR/union-borrow-move-parent-sibling.rs:25:1
|
||||
|
|
||||
LL | struct MockVec<T> {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ LL | fn move_out<T>(x: T) {}
|
|||
| -------- ^ this parameter takes ownership of the value
|
||||
| |
|
||||
| in this function
|
||||
note: if `U1` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
note: if `U1` implemented `Clone`, you could clone the value
|
||||
help: if `U1` implemented `Clone`, you could clone the value
|
||||
--> $DIR/union-move.rs:9:1
|
||||
|
|
||||
LL | union U1 {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LL | drop(a);
|
|||
LL | drop(x);
|
||||
| - borrow later used here
|
||||
|
|
||||
note: if `AffineU32` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `AffineU32` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `AffineU32` implemented `Clone`, you could clone the value
|
||||
help: 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
|
||||
|
|
||||
note: if `AffineU32` implemented `Clone`, you could clone the value
|
||||
help: if `AffineU32` implemented `Clone`, you could clone the value
|
||||
--> $DIR/variance-issue-20533.rs:26:1
|
||||
|
|
||||
LL | struct AffineU32(u32);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue