4
4
use std:: assert_matches:: assert_matches;
5
5
6
6
use either:: { Either , Left , Right } ;
7
+ use rustc_abi as abi;
8
+ use rustc_abi:: { Abi , HasDataLayout , Size } ;
7
9
use rustc_hir:: def:: Namespace ;
8
10
use rustc_middle:: mir:: interpret:: ScalarSizeMismatch ;
9
11
use rustc_middle:: ty:: layout:: { HasParamEnv , HasTyCtxt , LayoutOf , TyAndLayout } ;
10
12
use rustc_middle:: ty:: print:: { FmtPrinter , PrettyPrinter } ;
11
13
use rustc_middle:: ty:: { ConstInt , ScalarInt , Ty , TyCtxt } ;
12
14
use rustc_middle:: { bug, mir, span_bug, ty} ;
13
- use rustc_target:: abi:: { self , Abi , HasDataLayout , Size } ;
14
15
use tracing:: trace;
15
16
16
17
use super :: {
@@ -117,7 +118,7 @@ impl<Prov: Provenance> Immediate<Prov> {
117
118
match ( self , abi) {
118
119
( Immediate :: Scalar ( scalar) , Abi :: Scalar ( s) ) => {
119
120
assert_eq ! ( scalar. size( ) , s. size( cx) , "{msg}: scalar value has wrong size" ) ;
120
- if !matches ! ( s. primitive( ) , abi:: Pointer ( ..) ) {
121
+ if !matches ! ( s. primitive( ) , abi:: Primitive :: Pointer ( ..) ) {
121
122
// This is not a pointer, it should not carry provenance.
122
123
assert ! (
123
124
matches!( scalar, Scalar :: Int ( ..) ) ,
@@ -131,7 +132,7 @@ impl<Prov: Provenance> Immediate<Prov> {
131
132
a. size( cx) ,
132
133
"{msg}: first component of scalar pair has wrong size"
133
134
) ;
134
- if !matches ! ( a. primitive( ) , abi:: Pointer ( ..) ) {
135
+ if !matches ! ( a. primitive( ) , abi:: Primitive :: Pointer ( ..) ) {
135
136
assert ! (
136
137
matches!( a_val, Scalar :: Int ( ..) ) ,
137
138
"{msg}: first component of scalar pair should be an integer, but has provenance"
@@ -142,7 +143,7 @@ impl<Prov: Provenance> Immediate<Prov> {
142
143
b. size( cx) ,
143
144
"{msg}: second component of scalar pair has wrong size"
144
145
) ;
145
- if !matches ! ( b. primitive( ) , abi:: Pointer ( ..) ) {
146
+ if !matches ! ( b. primitive( ) , abi:: Primitive :: Pointer ( ..) ) {
146
147
assert ! (
147
148
matches!( b_val, Scalar :: Int ( ..) ) ,
148
149
"{msg}: second component of scalar pair should be an integer, but has provenance"
@@ -572,7 +573,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
572
573
assert_eq ! ( size, mplace. layout. size, "abi::Scalar size does not match layout size" ) ;
573
574
let scalar = alloc. read_scalar (
574
575
alloc_range ( Size :: ZERO , size) ,
575
- /*read_provenance*/ matches ! ( s, abi:: Pointer ( _) ) ,
576
+ /*read_provenance*/ matches ! ( s, abi:: Primitive :: Pointer ( _) ) ,
576
577
) ?;
577
578
Some ( ImmTy :: from_scalar ( scalar, mplace. layout ) )
578
579
}
@@ -588,11 +589,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
588
589
assert ! ( b_offset. bytes( ) > 0 ) ; // in `operand_field` we use the offset to tell apart the fields
589
590
let a_val = alloc. read_scalar (
590
591
alloc_range ( Size :: ZERO , a_size) ,
591
- /*read_provenance*/ matches ! ( a, abi:: Pointer ( _) ) ,
592
+ /*read_provenance*/ matches ! ( a, abi:: Primitive :: Pointer ( _) ) ,
592
593
) ?;
593
594
let b_val = alloc. read_scalar (
594
595
alloc_range ( b_offset, b_size) ,
595
- /*read_provenance*/ matches ! ( b, abi:: Pointer ( _) ) ,
596
+ /*read_provenance*/ matches ! ( b, abi:: Primitive :: Pointer ( _) ) ,
596
597
) ?;
597
598
Some ( ImmTy :: from_immediate ( Immediate :: ScalarPair ( a_val, b_val) , mplace. layout ) )
598
599
}
0 commit comments