diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui-fulldeps/stable-mir/crate-info.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index a3db2e9ef24..7cbb7898f2c 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -7,6 +7,7 @@ // edition: 2021 #![feature(rustc_private)] +#![feature(assert_matches)] extern crate rustc_driver; extern crate rustc_hir; @@ -19,6 +20,7 @@ use rustc_hir::def::DefKind; use rustc_interface::{interface, Queries}; use rustc_middle::ty::TyCtxt; use rustc_smir::{rustc_internal, stable_mir}; +use std::assert_matches::assert_matches; use std::io::Write; const CRATE_NAME: &str = "input"; @@ -63,6 +65,18 @@ fn test_stable_mir(tcx: TyCtxt<'_>) { other => panic!("{other:?}"), } + let types = get_item(tcx, &items, (DefKind::Fn, "types")).unwrap(); + let body = types.body(); + assert_eq!(body.locals.len(), 2); + assert_matches!( + body.locals[0].kind(), + stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool) + ); + assert_matches!( + body.locals[1].kind(), + stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool) + ); + let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap(); let body = drop.body(); assert_eq!(body.blocks.len(), 2); @@ -153,6 +167,10 @@ fn generate_input(path: &str) -> std::io::Result<()> { x_64.wrapping_add(y_64) }} + pub fn types(b: bool) -> bool {{ + b + }} + pub fn drop(_: String) {{}} pub fn assert(x: i32) -> i32 {{ |
