77// edition: 2021
88
99#![ feature( rustc_private) ]
10+ #![ feature( assert_matches) ]
1011
1112extern crate rustc_driver;
1213extern crate rustc_hir;
@@ -19,6 +20,7 @@ use rustc_hir::def::DefKind;
1920use rustc_interface:: { interface, Queries } ;
2021use rustc_middle:: ty:: TyCtxt ;
2122use rustc_smir:: { rustc_internal, stable_mir} ;
23+ use std:: assert_matches:: assert_matches;
2224use std:: io:: Write ;
2325
2426const CRATE_NAME : & str = "input" ;
@@ -63,6 +65,18 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
6365 other => panic ! ( "{other:?}" ) ,
6466 }
6567
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+
6680 let drop = get_item ( tcx, & items, ( DefKind :: Fn , "drop" ) ) . unwrap ( ) ;
6781 let body = drop. body ( ) ;
6882 assert_eq ! ( body. blocks. len( ) , 2 ) ;
@@ -153,6 +167,10 @@ fn generate_input(path: &str) -> std::io::Result<()> {
153167 x_64.wrapping_add(y_64)
154168 }}
155169
170+ pub fn types(b: bool) -> bool {{
171+ b
172+ }}
173+
156174 pub fn drop(_: String) {{}}
157175
158176 pub fn assert(x: i32) -> i32 {{
0 commit comments