7
7
// edition: 2021
8
8
9
9
#![ feature( rustc_private) ]
10
+ #![ feature( assert_matches) ]
10
11
11
12
extern crate rustc_driver;
12
13
extern crate rustc_hir;
@@ -19,6 +20,7 @@ use rustc_hir::def::DefKind;
19
20
use rustc_interface:: { interface, Queries } ;
20
21
use rustc_middle:: ty:: TyCtxt ;
21
22
use rustc_smir:: { rustc_internal, stable_mir} ;
23
+ use std:: assert_matches:: assert_matches;
22
24
use std:: io:: Write ;
23
25
24
26
const CRATE_NAME : & str = "input" ;
@@ -63,6 +65,18 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
63
65
other => panic ! ( "{other:?}" ) ,
64
66
}
65
67
68
+ let types = get_item ( tcx, & items, ( DefKind :: Fn , "types" ) ) . unwrap ( ) ;
69
+ let body = types. body ( ) ;
70
+ assert_eq ! ( body. locals. len( ) , 2 ) ;
71
+ assert_matches ! (
72
+ body. locals[ 0 ] . kind( ) ,
73
+ stable_mir:: ty:: TyKind :: RigidTy ( stable_mir:: ty:: RigidTy :: Bool )
74
+ ) ;
75
+ assert_matches ! (
76
+ body. locals[ 1 ] . kind( ) ,
77
+ stable_mir:: ty:: TyKind :: RigidTy ( stable_mir:: ty:: RigidTy :: Bool )
78
+ ) ;
79
+
66
80
let drop = get_item ( tcx, & items, ( DefKind :: Fn , "drop" ) ) . unwrap ( ) ;
67
81
let body = drop. body ( ) ;
68
82
assert_eq ! ( body. blocks. len( ) , 2 ) ;
@@ -153,6 +167,10 @@ fn generate_input(path: &str) -> std::io::Result<()> {
153
167
x_64.wrapping_add(y_64)
154
168
}}
155
169
170
+ pub fn types(b: bool) -> bool {{
171
+ b
172
+ }}
173
+
156
174
pub fn drop(_: String) {{}}
157
175
158
176
pub fn assert(x: i32) -> i32 {{
0 commit comments