about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorRoxane <roxane.fruytier@hotmail.com>2021-02-02 21:07:52 -0500
committerRoxane <roxane.fruytier@hotmail.com>2021-03-14 16:31:26 -0400
commitec10b71d42ace3c3d57c3d44bc1007badcd58ee8 (patch)
tree39e19afb63aba50b265e76fee4229a3c8c93f2ae /src/test
parent9320b121b5b20d2201c9f5ec40fb3c241fcac6f0 (diff)
downloadrust-ec10b71d42ace3c3d57c3d44bc1007badcd58ee8.tar.gz
rust-ec10b71d42ace3c3d57c3d44bc1007badcd58ee8.zip
Introduce new fake reads
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs8
-rw-r--r--src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr10
2 files changed, 7 insertions, 11 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs
index 6107a082237..2ed0149b9db 100644
--- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs
+++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs
@@ -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;
diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr
index 8586dfd9186..4863e6e2976 100644
--- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr
+++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr
@@ -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`.