File tree 3 files changed +37
-1
lines changed
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -1408,7 +1408,7 @@ pub fn get_enclosing_loop_or_multi_call_closure<'tcx>(
1408
1408
ExprKind :: Closure { .. } | ExprKind :: Loop ( ..) => return Some ( e) ,
1409
1409
_ => ( ) ,
1410
1410
} ,
1411
- Node :: Stmt ( _) | Node :: Block ( _) | Node :: LetStmt ( _) | Node :: Arm ( _) => ( ) ,
1411
+ Node :: Stmt ( _) | Node :: Block ( _) | Node :: LetStmt ( _) | Node :: Arm ( _) | Node :: ExprField ( _ ) => ( ) ,
1412
1412
_ => break ,
1413
1413
}
1414
1414
}
Original file line number Diff line number Diff line change @@ -52,3 +52,21 @@ struct S<'a> {
52
52
fn from_field<'a>(s: &'a mut S<'a>) -> Option<&'a mut usize> {
53
53
s.opt.as_deref_mut()
54
54
}
55
+
56
+ mod issue_non_copy_13077 {
57
+ pub fn something(mut maybe_side_effect: Option<&mut String>) {
58
+ for _ in 0..10 {
59
+ let _ = S {
60
+ field: other(maybe_side_effect.as_deref_mut()),
61
+ };
62
+ }
63
+ }
64
+
65
+ fn other(_maybe_side_effect: Option<&mut String>) {
66
+ unimplemented!()
67
+ }
68
+
69
+ pub struct S {
70
+ pub field: (),
71
+ }
72
+ }
Original file line number Diff line number Diff line change @@ -52,3 +52,21 @@ struct S<'a> {
52
52
fn from_field < ' a > ( s : & ' a mut S < ' a > ) -> Option < & ' a mut usize > {
53
53
s. opt . as_deref_mut ( )
54
54
}
55
+
56
+ mod issue_non_copy_13077 {
57
+ pub fn something ( mut maybe_side_effect : Option < & mut String > ) {
58
+ for _ in 0 ..10 {
59
+ let _ = S {
60
+ field : other ( maybe_side_effect. as_deref_mut ( ) ) ,
61
+ } ;
62
+ }
63
+ }
64
+
65
+ fn other ( _maybe_side_effect : Option < & mut String > ) {
66
+ unimplemented ! ( )
67
+ }
68
+
69
+ pub struct S {
70
+ pub field : ( ) ,
71
+ }
72
+ }
You can’t perform that action at this time.
0 commit comments