@@ -19,13 +19,6 @@ extern crate rustc_driver;
19
19
extern crate rustc_interface;
20
20
extern crate stable_mir;
21
21
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 } ;
29
22
use std:: ascii:: Char ;
30
23
use std:: assert_matches:: assert_matches;
31
24
use std:: cmp:: { max, min} ;
@@ -34,6 +27,14 @@ use std::ffi::CStr;
34
27
use std:: io:: Write ;
35
28
use std:: ops:: ControlFlow ;
36
29
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
+
37
38
const CRATE_NAME : & str = "input" ;
38
39
39
40
/// This function uses the Stable MIR APIs to get information about the test crate.
@@ -78,11 +79,12 @@ fn check_bar(item: CrateItem) {
78
79
79
80
let alloc_id_0 = alloc. provenance . ptrs [ 0 ] . 1 . 0 ;
80
81
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 ) ;
82
83
assert_eq ! ( allocation. bytes[ 0 ] . unwrap( ) , Char :: CapitalB . to_u8( ) ) ;
83
84
assert_eq ! ( allocation. bytes[ 1 ] . unwrap( ) , Char :: SmallA . to_u8( ) ) ;
84
85
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 " ) ) ;
86
88
}
87
89
88
90
/// Check the allocation data for static `C_STR`.
0 commit comments