File tree 3 files changed +35
-1
lines changed
3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -52,3 +52,17 @@ 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 { field: other(maybe_side_effect) };
60
+ }
61
+ }
62
+
63
+ fn other(_maybe_side_effect: Option<&mut String>) {
64
+ unimplemented!()
65
+ }
66
+
67
+ pub struct S { pub field: () }
68
+ }
Original file line number Diff line number Diff line change @@ -52,3 +52,17 @@ 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 { field : other ( maybe_side_effect. as_deref_mut ( ) ) } ;
60
+ }
61
+ }
62
+
63
+ fn other ( _maybe_side_effect : Option < & mut String > ) {
64
+ unimplemented ! ( )
65
+ }
66
+
67
+ pub struct S { pub field : ( ) }
68
+ }
Original file line number Diff line number Diff line change @@ -19,5 +19,11 @@ error: derefed type is same as origin
19
19
LL | let _ = x.as_deref_mut();
20
20
| ^^^^^^^^^^^^^^^^ help: try: `x`
21
21
22
- error: aborting due to 3 previous errors
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
23
29
You can’t perform that action at this time.
0 commit comments