@@ -6,7 +6,7 @@ use rustc_apfloat::{
66 Float ,
77} ;
88use rustc_macros:: HashStable ;
9- use rustc_target:: abi:: { HasDataLayout , Size , TargetDataLayout } ;
9+ use rustc_target:: abi:: { HasDataLayout , Size } ;
1010
1111use crate :: ty:: { Lift , ParamEnv , ScalarInt , Ty , TyCtxt } ;
1212
@@ -179,7 +179,7 @@ impl<Tag> From<ScalarInt> for Scalar<Tag> {
179179 }
180180}
181181
182- impl < ' tcx , Tag > Scalar < Tag > {
182+ impl < Tag > Scalar < Tag > {
183183 pub const ZST : Self = Scalar :: Int ( ScalarInt :: ZST ) ;
184184
185185 #[ inline( always) ]
@@ -202,56 +202,6 @@ impl<'tcx, Tag> Scalar<Tag> {
202202 Scalar :: Int ( ScalarInt :: null ( cx. pointer_size ( ) ) )
203203 }
204204
205- #[ inline( always) ]
206- fn ptr_op (
207- self ,
208- dl : & TargetDataLayout ,
209- f_int : impl FnOnce ( u64 ) -> InterpResult < ' tcx , u64 > ,
210- f_ptr : impl FnOnce ( Pointer < Tag > ) -> InterpResult < ' tcx , Pointer < Tag > > ,
211- ) -> InterpResult < ' tcx , Self > {
212- match self {
213- Scalar :: Int ( int) => Ok ( Scalar :: Int ( int. ptr_sized_op ( dl, f_int) ?) ) ,
214- Scalar :: Ptr ( ptr, sz) => {
215- debug_assert_eq ! ( u64 :: from( sz) , dl. pointer_size( ) . bytes( ) ) ;
216- Ok ( Scalar :: Ptr ( f_ptr ( ptr) ?, sz) )
217- }
218- }
219- }
220-
221- #[ inline]
222- pub fn ptr_offset ( self , i : Size , cx : & impl HasDataLayout ) -> InterpResult < ' tcx , Self > {
223- let dl = cx. data_layout ( ) ;
224- self . ptr_op ( dl, |int| dl. offset ( int, i. bytes ( ) ) , |ptr| ptr. offset ( i, dl) )
225- }
226-
227- #[ inline]
228- pub fn ptr_wrapping_offset ( self , i : Size , cx : & impl HasDataLayout ) -> Self {
229- let dl = cx. data_layout ( ) ;
230- self . ptr_op (
231- dl,
232- |int| Ok ( dl. overflowing_offset ( int, i. bytes ( ) ) . 0 ) ,
233- |ptr| Ok ( ptr. wrapping_offset ( i, dl) ) ,
234- )
235- . unwrap ( )
236- }
237-
238- #[ inline]
239- pub fn ptr_signed_offset ( self , i : i64 , cx : & impl HasDataLayout ) -> InterpResult < ' tcx , Self > {
240- let dl = cx. data_layout ( ) ;
241- self . ptr_op ( dl, |int| dl. signed_offset ( int, i) , |ptr| ptr. signed_offset ( i, dl) )
242- }
243-
244- #[ inline]
245- pub fn ptr_wrapping_signed_offset ( self , i : i64 , cx : & impl HasDataLayout ) -> Self {
246- let dl = cx. data_layout ( ) ;
247- self . ptr_op (
248- dl,
249- |int| Ok ( dl. overflowing_signed_offset ( int, i) . 0 ) ,
250- |ptr| Ok ( ptr. wrapping_signed_offset ( i, dl) ) ,
251- )
252- . unwrap ( )
253- }
254-
255205 #[ inline]
256206 pub fn from_bool ( b : bool ) -> Self {
257207 Scalar :: Int ( b. into ( ) )
0 commit comments