@@ -19,13 +19,6 @@ extern crate rustc_driver;
1919extern crate rustc_interface;
2020extern crate stable_mir;
2121
22- use rustc_smir:: rustc_internal;
23- use stable_mir:: crate_def:: CrateDef ;
24- use stable_mir:: mir:: alloc:: GlobalAlloc ;
25- use stable_mir:: mir:: mono:: { Instance , InstanceKind , StaticDef } ;
26- use stable_mir:: mir:: { Body , TerminatorKind } ;
27- use stable_mir:: ty:: { Allocation , ConstantKind , RigidTy , TyKind } ;
28- use stable_mir:: { CrateItem , CrateItems , ItemKind } ;
2922use std:: ascii:: Char ;
3023use std:: assert_matches:: assert_matches;
3124use std:: cmp:: { max, min} ;
@@ -34,6 +27,14 @@ use std::ffi::CStr;
3427use std:: io:: Write ;
3528use std:: ops:: ControlFlow ;
3629
30+ use rustc_smir:: rustc_internal;
31+ use stable_mir:: crate_def:: CrateDef ;
32+ use stable_mir:: mir:: alloc:: GlobalAlloc ;
33+ use stable_mir:: mir:: mono:: { Instance , InstanceKind , StaticDef } ;
34+ use stable_mir:: mir:: { Body , TerminatorKind } ;
35+ use stable_mir:: ty:: { Allocation , ConstantKind , RigidTy , TyKind } ;
36+ use stable_mir:: { CrateItem , CrateItems , ItemKind } ;
37+
3738const CRATE_NAME : & str = "input" ;
3839
3940/// This function uses the Stable MIR APIs to get information about the test crate.
@@ -78,11 +79,12 @@ fn check_bar(item: CrateItem) {
7879
7980 let alloc_id_0 = alloc. provenance . ptrs [ 0 ] . 1 . 0 ;
8081 let GlobalAlloc :: Memory ( allocation) = GlobalAlloc :: from ( alloc_id_0) else { unreachable ! ( ) } ;
81- assert_eq ! ( allocation. bytes. len( ) , 3 ) ;
82+ assert_eq ! ( allocation. bytes. len( ) , 4 ) ;
8283 assert_eq ! ( allocation. bytes[ 0 ] . unwrap( ) , Char :: CapitalB . to_u8( ) ) ;
8384 assert_eq ! ( allocation. bytes[ 1 ] . unwrap( ) , Char :: SmallA . to_u8( ) ) ;
8485 assert_eq ! ( allocation. bytes[ 2 ] . unwrap( ) , Char :: SmallR . to_u8( ) ) ;
85- assert_eq ! ( std:: str :: from_utf8( & allocation. raw_bytes( ) . unwrap( ) ) , Ok ( "Bar" ) ) ;
86+ assert_eq ! ( allocation. bytes[ 3 ] . unwrap( ) , Char :: Null . to_u8( ) ) ;
87+ assert_eq ! ( std:: str :: from_utf8( & allocation. raw_bytes( ) . unwrap( ) ) , Ok ( "Bar\0 " ) ) ;
8688}
8789
8890/// Check the allocation data for static `C_STR`.
0 commit comments