File tree Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -1407,7 +1407,7 @@ pub fn get_enclosing_loop_or_multi_call_closure<'tcx>(
1407
1407
ExprKind::Closure { .. } | ExprKind::Loop(..) => return Some(e),
1408
1408
_ => (),
1409
1409
},
1410
- Node::Stmt(_) | Node::Block(_) | Node::LetStmt(_) | Node::Arm(_) => (),
1410
+ Node::Stmt(_) | Node::Block(_) | Node::LetStmt(_) | Node::Arm(_) | Node::ExprField(_) => (),
1411
1411
_ => break,
1412
1412
}
1413
1413
}
Original file line number Diff line number Diff line change @@ -56,13 +56,17 @@ fn from_field<'a>(s: &'a mut S<'a>) -> Option<&'a mut usize> {
56
56
mod issue_non_copy_13077 {
57
57
pub fn something(mut maybe_side_effect: Option<&mut String>) {
58
58
for _ in 0..10 {
59
- let _ = S { field: other(maybe_side_effect) };
59
+ let _ = S {
60
+ field: other(maybe_side_effect.as_deref_mut()),
61
+ };
60
62
}
61
63
}
62
64
63
65
fn other(_maybe_side_effect: Option<&mut String>) {
64
66
unimplemented!()
65
67
}
66
68
67
- pub struct S { pub field: () }
69
+ pub struct S {
70
+ pub field: (),
71
+ }
68
72
}
Original file line number Diff line number Diff line change @@ -56,13 +56,17 @@ fn from_field<'a>(s: &'a mut S<'a>) -> Option<&'a mut usize> {
56
56
mod issue_non_copy_13077 {
57
57
pub fn something(mut maybe_side_effect: Option<&mut String>) {
58
58
for _ in 0..10 {
59
- let _ = S { field: other(maybe_side_effect.as_deref_mut()) };
59
+ let _ = S {
60
+ field: other(maybe_side_effect.as_deref_mut()),
61
+ };
60
62
}
61
63
}
62
64
63
65
fn other(_maybe_side_effect: Option<&mut String>) {
64
66
unimplemented!()
65
67
}
66
68
67
- pub struct S { pub field: () }
69
+ pub struct S {
70
+ pub field: (),
71
+ }
68
72
}
Original file line number Diff line number Diff line change @@ -19,11 +19,5 @@ error: derefed type is same as origin
19
19
LL | let _ = x.as_deref_mut();
20
20
| ^^^^^^^^^^^^^^^^ help: try: `x`
21
21
22
- error: derefed type is same as origin
23
- --> tests/ui/needless_option_as_deref.rs:59:38
24
- |
25
- LL | let _ = S { field: other(maybe_side_effect.as_deref_mut()) };
26
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `maybe_side_effect`
27
-
28
- error: aborting due to 4 previous errors
22
+ error: aborting due to 3 previous errors
29
23
You can’t perform that action at this time.
0 commit comments