File tree 1 file changed +40
-0
lines changed
src/test/ui/closures/2229_closure_analysis
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Regression test for #89606. Used to ICE.
2
+ //
3
+ // check-pass
4
+ // revisions: twenty_eighteen twenty_twentyone
5
+ // [twenty_eighteen]compile-flags: --edition 2018
6
+ // [twenty_twentyone]compile-flags: --edition 2021
7
+
8
+ struct S < ' a > ( Option < & ' a mut i32 > ) ;
9
+
10
+ fn by_ref ( s : & mut S < ' _ > ) {
11
+ ( || {
12
+ let S ( _o) = s;
13
+ s. 0 = None ;
14
+ } ) ( ) ;
15
+ }
16
+
17
+ fn by_value ( s : S < ' _ > ) {
18
+ ( || {
19
+ let S ( ref _o) = s;
20
+ let _g = s. 0 ;
21
+ } ) ( ) ;
22
+ }
23
+
24
+ struct V < ' a > ( ( Option < & ' a mut i32 > , ) ) ;
25
+
26
+ fn nested ( v : & mut V < ' _ > ) {
27
+ ( || {
28
+ let V ( ( _o, ) ) = v;
29
+ v. 0 = ( None , ) ;
30
+ } ) ( ) ;
31
+ }
32
+
33
+ fn main ( ) {
34
+ let mut s = S ( None ) ;
35
+ by_ref ( & mut s) ;
36
+ by_value ( s) ;
37
+
38
+ let mut v = V ( ( None , ) ) ;
39
+ nested ( & mut v) ;
40
+ }
You can’t perform that action at this time.
0 commit comments