This repository was archived by the owner on May 28, 2025. It is now read-only.
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>(
14071407 ExprKind :: Closure { .. } | ExprKind :: Loop ( ..) => return Some ( e) ,
14081408 _ => ( ) ,
14091409 } ,
1410- Node :: Stmt ( _) | Node :: Block ( _) | Node :: LetStmt ( _) | Node :: Arm ( _) => ( ) ,
1410+ Node :: Stmt ( _) | Node :: Block ( _) | Node :: LetStmt ( _) | Node :: Arm ( _) | Node :: ExprField ( _ ) => ( ) ,
14111411 _ => break ,
14121412 }
14131413 }
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> {
5656mod issue_non_copy_13077 {
5757 pub fn something(mut maybe_side_effect: Option<&mut String>) {
5858 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+ };
6062 }
6163 }
6264
6365 fn other(_maybe_side_effect: Option<&mut String>) {
6466 unimplemented!()
6567 }
6668
67- pub struct S { pub field: () }
69+ pub struct S {
70+ pub field: (),
71+ }
6872}
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> {
5656mod issue_non_copy_13077 {
5757 pub fn something ( mut maybe_side_effect : Option < & mut String > ) {
5858 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+ } ;
6062 }
6163 }
6264
6365 fn other ( _maybe_side_effect : Option < & mut String > ) {
6466 unimplemented ! ( )
6567 }
6668
67- pub struct S { pub field : ( ) }
69+ pub struct S {
70+ pub field : ( ) ,
71+ }
6872}
Original file line number Diff line number Diff line change @@ -19,11 +19,5 @@ error: derefed type is same as origin
1919LL | let _ = x.as_deref_mut();
2020 | ^^^^^^^^^^^^^^^^ help: try: `x`
2121
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
2923
You can’t perform that action at this time.
0 commit comments