1
- // skip-filecheck
2
1
#![ feature( custom_mir, core_intrinsics) ]
3
2
4
3
extern crate core;
@@ -7,6 +6,8 @@ use core::intrinsics::mir::*;
7
6
// EMIT_MIR debuginfo.pointee.built.after.mir
8
7
#[ custom_mir( dialect = "built" ) ]
9
8
fn pointee ( opt : & mut Option < i32 > ) {
9
+ // CHECK-LABEL: fn pointee(
10
+ // CHECK: debug foo => (((*_1) as variant#1).0: i32);
10
11
mir ! {
11
12
debug foo => Field :: <i32 >( Variant ( * opt, 1 ) , 0 ) ;
12
13
{
@@ -18,9 +19,12 @@ fn pointee(opt: &mut Option<i32>) {
18
19
// EMIT_MIR debuginfo.numbered.built.after.mir
19
20
#[ custom_mir( dialect = "analysis" , phase = "post-cleanup" ) ]
20
21
fn numbered ( i : ( u32 , i32 ) ) {
22
+ // CHECK-LABEL: fn numbered(
23
+ // CHECK: debug first => (_1.0: u32);
24
+ // CHECK: debug second => (_1.1: i32);
21
25
mir ! {
22
26
debug first => i. 0 ;
23
- debug second => i. 0 ;
27
+ debug second => i. 1 ;
24
28
{
25
29
Return ( )
26
30
}
@@ -34,6 +38,8 @@ struct S {
34
38
// EMIT_MIR debuginfo.structured.built.after.mir
35
39
#[ custom_mir( dialect = "analysis" , phase = "post-cleanup" ) ]
36
40
fn structured ( i : S ) {
41
+ // CHECK-LABEL: fn structured(
42
+ // CHECK: debug x => (_1.0: f32);
37
43
mir ! {
38
44
debug x => i. x;
39
45
{
@@ -45,6 +51,8 @@ fn structured(i: S) {
45
51
// EMIT_MIR debuginfo.variant.built.after.mir
46
52
#[ custom_mir( dialect = "built" ) ]
47
53
fn variant ( opt : Option < i32 > ) {
54
+ // CHECK-LABEL: fn variant(
55
+ // CHECK: debug inner => ((_1 as variant#1).0: i32);
48
56
mir ! {
49
57
debug inner => Field :: <i32 >( Variant ( opt, 1 ) , 0 ) ;
50
58
{
@@ -56,6 +64,9 @@ fn variant(opt: Option<i32>) {
56
64
// EMIT_MIR debuginfo.variant_deref.built.after.mir
57
65
#[ custom_mir( dialect = "built" ) ]
58
66
fn variant_deref ( opt : Option < & i32 > ) {
67
+ // CHECK-LABEL: fn variant_deref(
68
+ // CHECK: debug pointer => ((_1 as variant#1).0: &i32);
69
+ // CHECK: debug deref => (*((_1 as variant#1).0: &i32));
59
70
mir ! {
60
71
debug pointer => Field :: <& i32 >( Variant ( opt, 1 ) , 0 ) ;
61
72
debug deref => * Field :: <& i32 >( Variant ( opt, 1 ) , 0 ) ;
@@ -65,10 +76,24 @@ fn variant_deref(opt: Option<&i32>) {
65
76
}
66
77
}
67
78
79
+ // EMIT_MIR debuginfo.constant.built.after.mir
80
+ #[ custom_mir( dialect = "built" ) ]
81
+ fn constant ( ) {
82
+ // CHECK-LABEL: fn constant(
83
+ // CHECK: debug scalar => const 5_usize;
84
+ mir ! (
85
+ debug scalar => 5_usize ;
86
+ {
87
+ Return ( )
88
+ }
89
+ )
90
+ }
91
+
68
92
fn main ( ) {
69
93
numbered ( ( 5 , 6 ) ) ;
70
94
structured ( S { x : 5. } ) ;
71
95
variant ( Some ( 5 ) ) ;
72
96
variant_deref ( Some ( & 5 ) ) ;
73
97
pointee ( & mut Some ( 5 ) ) ;
98
+ constant ( ) ;
74
99
}
0 commit comments