about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2021-10-25 23:33:12 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2021-11-21 08:15:21 -0600
commit9c83f8c4d1e562cd73a29a00828d68e2b520a086 (patch)
treea7b824c188a775e1de44c0e9c44dffe2d039c78f /src
parent3bfde2f1f4fc9409ecb63dfe1370df66171cf861 (diff)
downloadrust-9c83f8c4d1e562cd73a29a00828d68e2b520a086.tar.gz
rust-9c83f8c4d1e562cd73a29a00828d68e2b520a086.zip
Simplify for loop desugar
Diffstat (limited to 'src')
-rw-r--r--src/test/incremental/hashes/for_loops.rs2
-rw-r--r--src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff115
-rw-r--r--src/test/ui/borrowck/return-local-binding-from-desugaring.rs2
-rw-r--r--src/test/ui/borrowck/return-local-binding-from-desugaring.stderr4
-rw-r--r--src/test/ui/for/for-loop-unconstrained-element-type.stderr6
-rw-r--r--src/test/ui/issues/issue-20261.stderr4
-rw-r--r--src/test/ui/issues/issue-33941.rs1
-rw-r--r--src/test/ui/issues/issue-33941.stderr12
-rw-r--r--src/test/ui/nll/dont-print-desugared.stderr2
-rw-r--r--src/test/ui/nll/issue-53773.stderr4
-rw-r--r--src/test/ui/reachable/unreachable-loop-patterns.rs1
-rw-r--r--src/test/ui/reachable/unreachable-loop-patterns.stderr8
12 files changed, 60 insertions, 101 deletions
diff --git a/src/test/incremental/hashes/for_loops.rs b/src/test/incremental/hashes/for_loops.rs
index 1b96cd54c3e..d3687d5b908 100644
--- a/src/test/incremental/hashes/for_loops.rs
+++ b/src/test/incremental/hashes/for_loops.rs
@@ -183,7 +183,7 @@ pub fn add_loop_label_to_break() {
 #[cfg(not(any(cfail1,cfail4)))]
 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
 #[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
 #[rustc_clean(cfg="cfail6")]
 pub fn add_loop_label_to_break() {
     let mut _x = 0;
diff --git a/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff b/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
index 02f6e55a9a8..2dfc94f2186 100644
--- a/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
+++ b/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
@@ -7,39 +7,29 @@
       let mut _2: std::ops::Range<i32>;    // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
       let mut _3: std::ops::Range<i32>;    // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
       let mut _5: ();                      // in scope 0 at $DIR/remove_storage_markers.rs:6:1: 11:2
-      let _7: ();                          // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
-      let mut _8: std::option::Option<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+      let _6: ();                          // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+      let mut _7: std::option::Option<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+      let mut _8: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
       let mut _9: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
-      let mut _10: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
-      let mut _11: isize;                  // in scope 0 at $DIR/remove_storage_markers.rs:8:9: 8:10
-      let mut _13: i32;                    // in scope 0 at $DIR/remove_storage_markers.rs:8:9: 8:10
-      let mut _14: !;                      // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
-      let _16: ();                         // in scope 0 at $DIR/remove_storage_markers.rs:8:20: 10:6
-      let mut _17: i32;                    // in scope 0 at $DIR/remove_storage_markers.rs:9:16: 9:17
+      let mut _10: isize;                  // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
+      let mut _11: !;                      // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
+      let mut _13: i32;                    // in scope 0 at $DIR/remove_storage_markers.rs:9:16: 9:17
       scope 1 {
           debug sum => _1;                 // in scope 1 at $DIR/remove_storage_markers.rs:7:9: 7:16
           let mut _4: std::ops::Range<i32>; // in scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           scope 2 {
               debug iter => _4;            // in scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
-              let mut _6: i32;             // in scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+              let _12: i32;                // in scope 2 at $DIR/remove_storage_markers.rs:8:9: 8:10
               scope 3 {
-                  debug __next => _6;      // in scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-                  let _12: i32;            // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  let _15: i32;            // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  scope 4 {
-                      debug val => _12;    // in scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  }
-                  scope 5 {
-                      debug i => _15;      // in scope 5 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  }
-                  scope 7 (inlined iter::range::<impl Iterator for std::ops::Range<i32>>::next) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
-                      debug self => _9;    // in scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-                      let mut _18: &mut std::ops::Range<i32>; // in scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-                  }
+                  debug i => _12;          // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+              }
+              scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<i32>>::next) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
+                  debug self => _8;        // in scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+                  let mut _14: &mut std::ops::Range<i32>; // in scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
               }
           }
-          scope 6 (inlined <std::ops::Range<i32> as IntoIterator>::into_iter) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
-              debug self => _3;            // in scope 6 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          scope 4 (inlined <std::ops::Range<i32> as IntoIterator>::into_iter) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
+              debug self => _3;            // in scope 4 at $DIR/remove_storage_markers.rs:8:14: 8:19
           }
       }
   
@@ -50,7 +40,7 @@
 -         StorageLive(_3);                 // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           (_3.0: i32) = const 0_i32;       // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           (_3.1: i32) = const 10_i32;      // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _2 = move _3;                    // scope 6 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _2 = move _3;                    // scope 4 at $DIR/remove_storage_markers.rs:8:14: 8:19
 -         StorageDead(_3);                 // scope 1 at $DIR/remove_storage_markers.rs:8:18: 8:19
 -         StorageLive(_4);                 // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           _4 = move _2;                    // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
@@ -59,64 +49,51 @@
   
       bb1: {
 -         StorageLive(_6);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_7);                 // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_8);                 // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_9);                 // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _10 = &mut _4;                   // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _9 = &mut (*_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_18);                // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _18 = &mut (*_9);                // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _8 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _18) -> bb4; // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_7);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_8);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_9);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _9 = &mut _4;                    // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _8 = &mut (*_9);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_14);                // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _14 = &mut (*_8);                // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _7 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _14) -> bb4; // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
                                            // mir::Constant
                                            // + span: $DIR/remove_storage_markers.rs:8:14: 8:19
                                            // + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> std::option::Option<<std::ops::Range<i32> as std::iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<i32> as std::iter::range::RangeIteratorImpl>::spec_next}, val: Value(Scalar(<ZST>)) }
       }
   
       bb2: {
-          _0 = const ();                   // scope 3 at $DIR/remove_storage_markers.rs:8:5: 10:6
--         StorageDead(_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_8);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_7);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+-         StorageLive(_12);                // scope 2 at $DIR/remove_storage_markers.rs:8:9: 8:10
+          _12 = ((_7 as Some).0: i32);     // scope 2 at $DIR/remove_storage_markers.rs:8:9: 8:10
+-         StorageLive(_13);                // scope 3 at $DIR/remove_storage_markers.rs:9:16: 9:17
+          _13 = _12;                       // scope 3 at $DIR/remove_storage_markers.rs:9:16: 9:17
+          _1 = Add(_1, move _13);          // scope 3 at $DIR/remove_storage_markers.rs:9:9: 9:17
+-         StorageDead(_13);                // scope 3 at $DIR/remove_storage_markers.rs:9:16: 9:17
+          _6 = const ();                   // scope 3 at $DIR/remove_storage_markers.rs:8:20: 10:6
+-         StorageDead(_12);                // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_9);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_7);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
 -         StorageDead(_6);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
--         StorageDead(_4);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
--         StorageDead(_2);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
--         StorageDead(_1);                 // scope 0 at $DIR/remove_storage_markers.rs:11:1: 11:2
-          return;                          // scope 0 at $DIR/remove_storage_markers.rs:11:2: 11:2
+          _5 = const ();                   // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+          goto -> bb1;                     // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
       }
   
       bb3: {
--         StorageLive(_12);                // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _12 = ((_8 as Some).0: i32);     // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageLive(_13);                // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _13 = _12;                       // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _6 = move _13;                   // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _7 = const ();                   // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageDead(_13);                // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageDead(_12);                // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageDead(_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_8);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_7);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageLive(_15);                // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _15 = _6;                        // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_16);                // scope 5 at $DIR/remove_storage_markers.rs:8:20: 10:6
--         StorageLive(_17);                // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
-          _17 = _15;                       // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
-          _1 = Add(_1, move _17);          // scope 5 at $DIR/remove_storage_markers.rs:9:9: 9:17
--         StorageDead(_17);                // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
-          _16 = const ();                  // scope 5 at $DIR/remove_storage_markers.rs:8:20: 10:6
--         StorageDead(_16);                // scope 5 at $DIR/remove_storage_markers.rs:10:5: 10:6
-          _5 = const ();                   // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
--         StorageDead(_15);                // scope 3 at $DIR/remove_storage_markers.rs:10:5: 10:6
+          _0 = const ();                   // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+-         StorageDead(_9);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_7);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
 -         StorageDead(_6);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
-          goto -> bb1;                     // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+-         StorageDead(_4);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_2);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_1);                 // scope 0 at $DIR/remove_storage_markers.rs:11:1: 11:2
+          return;                          // scope 0 at $DIR/remove_storage_markers.rs:11:2: 11:2
       }
   
       bb4: {
--         StorageDead(_18);                // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageDead(_9);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
-          _11 = discriminant(_8);          // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          switchInt(move _11) -> [0_isize: bb2, otherwise: bb3]; // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageDead(_14);                // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageDead(_8);                 // scope 2 at $DIR/remove_storage_markers.rs:8:18: 8:19
+          _10 = discriminant(_7);          // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          switchInt(move _10) -> [0_isize: bb3, otherwise: bb2]; // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
       }
   }
   
diff --git a/src/test/ui/borrowck/return-local-binding-from-desugaring.rs b/src/test/ui/borrowck/return-local-binding-from-desugaring.rs
index b2dcd54ec2e..c6643edf5a9 100644
--- a/src/test/ui/borrowck/return-local-binding-from-desugaring.rs
+++ b/src/test/ui/borrowck/return-local-binding-from-desugaring.rs
@@ -27,7 +27,7 @@ where
         let key = f(x);
         result.entry(key).or_insert(Vec::new()).push(x);
     }
-    result //~ ERROR cannot return value referencing local binding
+    result //~ ERROR cannot return value referencing temporary value
 }
 
 fn main() {}
diff --git a/src/test/ui/borrowck/return-local-binding-from-desugaring.stderr b/src/test/ui/borrowck/return-local-binding-from-desugaring.stderr
index 293dbe62813..9f952542e18 100644
--- a/src/test/ui/borrowck/return-local-binding-from-desugaring.stderr
+++ b/src/test/ui/borrowck/return-local-binding-from-desugaring.stderr
@@ -1,8 +1,8 @@
-error[E0515]: cannot return value referencing local binding
+error[E0515]: cannot return value referencing temporary value
   --> $DIR/return-local-binding-from-desugaring.rs:30:5
    |
 LL |     for ref x in xs {
-   |                  -- local binding introduced here
+   |                  -- temporary value created here
 ...
 LL |     result
    |     ^^^^^^ returns a value referencing data owned by the current function
diff --git a/src/test/ui/for/for-loop-unconstrained-element-type.stderr b/src/test/ui/for/for-loop-unconstrained-element-type.stderr
index 0672014a929..580b135ac2d 100644
--- a/src/test/ui/for/for-loop-unconstrained-element-type.stderr
+++ b/src/test/ui/for/for-loop-unconstrained-element-type.stderr
@@ -1,8 +1,10 @@
 error[E0282]: type annotations needed
-  --> $DIR/for-loop-unconstrained-element-type.rs:8:14
+  --> $DIR/for-loop-unconstrained-element-type.rs:8:9
    |
 LL |     for i in Vec::new() { }
-   |              ^^^^^^^^^^ the element type for this iterator is not specified
+   |         ^    ---------- the element type for this iterator is not specified
+   |         |
+   |         cannot infer type
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-20261.stderr b/src/test/ui/issues/issue-20261.stderr
index c6c3f32dfe7..6330364c92b 100644
--- a/src/test/ui/issues/issue-20261.stderr
+++ b/src/test/ui/issues/issue-20261.stderr
@@ -1,8 +1,8 @@
-error[E0282]: type annotations needed for `&(_,)`
+error[E0282]: type annotations needed for `(_,)`
   --> $DIR/issue-20261.rs:4:11
    |
 LL |     for (ref i,) in [].iter() {
-   |                     --------- the element type for this iterator is not specified
+   |                     --------- this method call resolves to `std::slice::Iter<'_, T>`
 LL |         i.clone();
    |           ^^^^^ cannot infer type
    |
diff --git a/src/test/ui/issues/issue-33941.rs b/src/test/ui/issues/issue-33941.rs
index 4fb805b37e0..ccaa6334856 100644
--- a/src/test/ui/issues/issue-33941.rs
+++ b/src/test/ui/issues/issue-33941.rs
@@ -3,5 +3,4 @@ use std::collections::HashMap;
 fn main() {
     for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch
     //~^ ERROR type mismatch
-    //~| ERROR type mismatch
 }
diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr
index e7263148205..eb98a3a29a6 100644
--- a/src/test/ui/issues/issue-33941.stderr
+++ b/src/test/ui/issues/issue-33941.stderr
@@ -23,16 +23,6 @@ LL |     for _ in HashMap::new().iter().cloned() {}
    = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
    = note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
 
-error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
-  --> $DIR/issue-33941.rs:4:14
-   |
-LL |     for _ in HashMap::new().iter().cloned() {}
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found tuple
-   |
-   = note: expected reference `&_`
-                  found tuple `(&_, &_)`
-   = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/ui/nll/dont-print-desugared.stderr b/src/test/ui/nll/dont-print-desugared.stderr
index 88773def8b7..fad6121cbca 100644
--- a/src/test/ui/nll/dont-print-desugared.stderr
+++ b/src/test/ui/nll/dont-print-desugared.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
   --> $DIR/dont-print-desugared.rs:4:10
    |
 LL |     for &ref mut x in s {}
-   |          ^^^^^^^^^ cannot borrow as mutable through `&` reference
+   |          ^^^^^^^^^ cannot borrow as mutable
 
 error[E0597]: `y` does not live long enough
   --> $DIR/dont-print-desugared.rs:17:16
diff --git a/src/test/ui/nll/issue-53773.stderr b/src/test/ui/nll/issue-53773.stderr
index 11cd423295a..90cba2a145f 100644
--- a/src/test/ui/nll/issue-53773.stderr
+++ b/src/test/ui/nll/issue-53773.stderr
@@ -2,12 +2,10 @@ error[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-53773.rs:41:22
    |
 LL |         members.push(child.raw);
-   |                      ^^^^^^^^^
+   |         -------------^^^^^^^^^- borrow later used here
 LL |
 LL |     }
    |     - here, drop of `child` needs exclusive access to `*child.raw`, because the type `C<'_>` implements the `Drop` trait
-LL |     members.len();
-   |     ------------- borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value
 
diff --git a/src/test/ui/reachable/unreachable-loop-patterns.rs b/src/test/ui/reachable/unreachable-loop-patterns.rs
index 4de29c3c3d7..e9cef5f47d4 100644
--- a/src/test/ui/reachable/unreachable-loop-patterns.rs
+++ b/src/test/ui/reachable/unreachable-loop-patterns.rs
@@ -17,5 +17,4 @@ impl Iterator for Void {
 fn main() {
     for _ in unimplemented!() as Void {}
     //~^ ERROR unreachable pattern
-    //~^^ ERROR unreachable pattern
 }
diff --git a/src/test/ui/reachable/unreachable-loop-patterns.stderr b/src/test/ui/reachable/unreachable-loop-patterns.stderr
index 680d22862d7..80ffa5d73f0 100644
--- a/src/test/ui/reachable/unreachable-loop-patterns.stderr
+++ b/src/test/ui/reachable/unreachable-loop-patterns.stderr
@@ -10,11 +10,5 @@ note: the lint level is defined here
 LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
-error: unreachable pattern
-  --> $DIR/unreachable-loop-patterns.rs:18:14
-   |
-LL |     for _ in unimplemented!() as Void {}
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error