File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Ensure that there are no drop terminators in `unwrap<T>` (except the one along the cleanup
2
+ // path).
3
+
4
+ fn unwrap < T > ( opt : Option < T > ) -> T {
5
+ match opt {
6
+ Some ( x) => x,
7
+ None => panic ! ( ) ,
8
+ }
9
+ }
10
+
11
+ fn main ( ) {
12
+ let _ = unwrap ( Some ( 1i32 ) ) ;
13
+ }
14
+
15
+ // END RUST SOURCE
16
+ // START rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir
17
+ // fn unwrap(_1: std::option::Option<T>) -> T {
18
+ // ...
19
+ // bb0: {
20
+ // ...
21
+ // switchInt(move _2) -> [0isize: bb2, 1isize: bb4, otherwise: bb3];
22
+ // }
23
+ // bb1 (cleanup): {
24
+ // resume;
25
+ // }
26
+ // bb2: {
27
+ // ...
28
+ // const std::rt::begin_panic::<&'static str>(const "explicit panic") -> bb5;
29
+ // }
30
+ // bb3: {
31
+ // unreachable;
32
+ // }
33
+ // bb4: {
34
+ // ...
35
+ // return;
36
+ // }
37
+ // bb5 (cleanup): {
38
+ // drop(_1) -> bb1;
39
+ // }
40
+ // }
41
+ // END rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir
You can’t perform that action at this time.
0 commit comments