Introduce new fake reads

This commit is contained in:
Roxane 2021-02-02 21:07:52 -05:00
parent 9320b121b5
commit ec10b71d42
11 changed files with 195 additions and 21 deletions

View file

@ -13,12 +13,8 @@ fn main() {
let mut point = SingleVariant::Point(10, -10);
let c = || {
// FIXME(project-rfc-2229#24): Change this to be a destructure pattern
// once this is fixed, to remove the warning.
if let SingleVariant::Point(ref mut x, _) = point {
//~^ WARNING: irrefutable `if let` pattern
*x += 1;
}
let SingleVariant::Point(ref mut x, _) = point;
*x += 1;
};
let b = c;

View file

@ -21,7 +21,7 @@ LL | | }
= help: consider replacing the `if let` with a `let`
error[E0382]: use of moved value: `c`
--> $DIR/closure-origin-single-variant-diagnostics.rs:25:13
--> $DIR/closure-origin-single-variant-diagnostics.rs:21:13
|
LL | let b = c;
| - value moved here
@ -29,11 +29,11 @@ LL | let a = c;
| ^ value used here after move
|
note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `point.0` out of its environment
--> $DIR/closure-origin-single-variant-diagnostics.rs:18:53
--> $DIR/closure-origin-single-variant-diagnostics.rs:16:50
|
LL | if let SingleVariant::Point(ref mut x, _) = point {
| ^^^^^
LL | let SingleVariant::Point(ref mut x, _) = point;
| ^^^^^
error: aborting due to previous error; 2 warnings emitted
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0382`.