rust/tests/ui/lint/forgetting_references-can-f...

134 lines
3.8 KiB
Plaintext

error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:11:5
|
LL | forget(&SomeStruct);
| ^^^^^^^-----------^
| |
| argument has type `&SomeStruct`
|
note: the lint level is defined here
--> $DIR/forgetting_references-can-fixed.rs:4:9
|
LL | #![deny(forgetting_references)]
| ^^^^^^^^^^^^^^^^^^^^^
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(&SomeStruct);
LL + let _ = &SomeStruct;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:14:5
|
LL | forget(&owned);
| ^^^^^^^------^
| |
| argument has type `&SomeStruct`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(&owned);
LL + let _ = &owned;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:15:5
|
LL | forget(&&owned);
| ^^^^^^^-------^
| |
| argument has type `&&SomeStruct`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(&&owned);
LL + let _ = &&owned;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:16:5
|
LL | forget(&mut owned);
| ^^^^^^^----------^
| |
| argument has type `&mut SomeStruct`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(&mut owned);
LL + let _ = &mut owned;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:20:5
|
LL | forget(&*reference1);
| ^^^^^^^------------^
| |
| argument has type `&SomeStruct`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(&*reference1);
LL + let _ = &*reference1;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:23:5
|
LL | forget(reference2);
| ^^^^^^^----------^
| |
| argument has type `&mut SomeStruct`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(reference2);
LL + let _ = reference2;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:26:5
|
LL | forget(reference3);
| ^^^^^^^----------^
| |
| argument has type `&SomeStruct`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(reference3);
LL + let _ = reference3;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:31:5
|
LL | forget(&val);
| ^^^^^^^----^
| |
| argument has type `&T`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - forget(&val);
LL + let _ = &val;
|
error: calls to `std::mem::forget` with a reference instead of an owned value does nothing
--> $DIR/forgetting_references-can-fixed.rs:39:5
|
LL | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^-----------^
| |
| argument has type `&SomeStruct`
|
help: use `let _ = ...` to ignore the expression or result
|
LL - std::mem::forget(&SomeStruct);
LL + let _ = &SomeStruct;
|
error: aborting due to 9 previous errors