@@ -397,90 +397,90 @@ impl<'tcx, Tag: Provenance> Scalar<Tag> {
397
397
/// Converts the scalar to produce an unsigned integer of the given size.
398
398
/// Fails if the scalar is a pointer.
399
399
#[ inline]
400
- pub fn to_uint ( self , size : Size ) -> InterpResult < ' static , u128 > {
400
+ pub fn to_uint ( self , size : Size ) -> InterpResult < ' tcx , u128 > {
401
401
self . to_bits ( size)
402
402
}
403
403
404
404
/// Converts the scalar to produce a `u8`. Fails if the scalar is a pointer.
405
- pub fn to_u8 ( self ) -> InterpResult < ' static , u8 > {
405
+ pub fn to_u8 ( self ) -> InterpResult < ' tcx , u8 > {
406
406
self . to_uint ( Size :: from_bits ( 8 ) ) . map ( |v| u8:: try_from ( v) . unwrap ( ) )
407
407
}
408
408
409
409
/// Converts the scalar to produce a `u16`. Fails if the scalar is a pointer.
410
- pub fn to_u16 ( self ) -> InterpResult < ' static , u16 > {
410
+ pub fn to_u16 ( self ) -> InterpResult < ' tcx , u16 > {
411
411
self . to_uint ( Size :: from_bits ( 16 ) ) . map ( |v| u16:: try_from ( v) . unwrap ( ) )
412
412
}
413
413
414
414
/// Converts the scalar to produce a `u32`. Fails if the scalar is a pointer.
415
- pub fn to_u32 ( self ) -> InterpResult < ' static , u32 > {
415
+ pub fn to_u32 ( self ) -> InterpResult < ' tcx , u32 > {
416
416
self . to_uint ( Size :: from_bits ( 32 ) ) . map ( |v| u32:: try_from ( v) . unwrap ( ) )
417
417
}
418
418
419
419
/// Converts the scalar to produce a `u64`. Fails if the scalar is a pointer.
420
- pub fn to_u64 ( self ) -> InterpResult < ' static , u64 > {
420
+ pub fn to_u64 ( self ) -> InterpResult < ' tcx , u64 > {
421
421
self . to_uint ( Size :: from_bits ( 64 ) ) . map ( |v| u64:: try_from ( v) . unwrap ( ) )
422
422
}
423
423
424
424
/// Converts the scalar to produce a `u128`. Fails if the scalar is a pointer.
425
- pub fn to_u128 ( self ) -> InterpResult < ' static , u128 > {
425
+ pub fn to_u128 ( self ) -> InterpResult < ' tcx , u128 > {
426
426
self . to_uint ( Size :: from_bits ( 128 ) )
427
427
}
428
428
429
429
/// Converts the scalar to produce a machine-pointer-sized unsigned integer.
430
430
/// Fails if the scalar is a pointer.
431
- pub fn to_machine_usize ( self , cx : & impl HasDataLayout ) -> InterpResult < ' static , u64 > {
431
+ pub fn to_machine_usize ( self , cx : & impl HasDataLayout ) -> InterpResult < ' tcx , u64 > {
432
432
let b = self . to_uint ( cx. data_layout ( ) . pointer_size ) ?;
433
433
Ok ( u64:: try_from ( b) . unwrap ( ) )
434
434
}
435
435
436
436
/// Converts the scalar to produce a signed integer of the given size.
437
437
/// Fails if the scalar is a pointer.
438
438
#[ inline]
439
- pub fn to_int ( self , size : Size ) -> InterpResult < ' static , i128 > {
439
+ pub fn to_int ( self , size : Size ) -> InterpResult < ' tcx , i128 > {
440
440
let b = self . to_bits ( size) ?;
441
441
Ok ( size. sign_extend ( b) as i128 )
442
442
}
443
443
444
444
/// Converts the scalar to produce an `i8`. Fails if the scalar is a pointer.
445
- pub fn to_i8 ( self ) -> InterpResult < ' static , i8 > {
445
+ pub fn to_i8 ( self ) -> InterpResult < ' tcx , i8 > {
446
446
self . to_int ( Size :: from_bits ( 8 ) ) . map ( |v| i8:: try_from ( v) . unwrap ( ) )
447
447
}
448
448
449
449
/// Converts the scalar to produce an `i16`. Fails if the scalar is a pointer.
450
- pub fn to_i16 ( self ) -> InterpResult < ' static , i16 > {
450
+ pub fn to_i16 ( self ) -> InterpResult < ' tcx , i16 > {
451
451
self . to_int ( Size :: from_bits ( 16 ) ) . map ( |v| i16:: try_from ( v) . unwrap ( ) )
452
452
}
453
453
454
454
/// Converts the scalar to produce an `i32`. Fails if the scalar is a pointer.
455
- pub fn to_i32 ( self ) -> InterpResult < ' static , i32 > {
455
+ pub fn to_i32 ( self ) -> InterpResult < ' tcx , i32 > {
456
456
self . to_int ( Size :: from_bits ( 32 ) ) . map ( |v| i32:: try_from ( v) . unwrap ( ) )
457
457
}
458
458
459
459
/// Converts the scalar to produce an `i64`. Fails if the scalar is a pointer.
460
- pub fn to_i64 ( self ) -> InterpResult < ' static , i64 > {
460
+ pub fn to_i64 ( self ) -> InterpResult < ' tcx , i64 > {
461
461
self . to_int ( Size :: from_bits ( 64 ) ) . map ( |v| i64:: try_from ( v) . unwrap ( ) )
462
462
}
463
463
464
464
/// Converts the scalar to produce an `i128`. Fails if the scalar is a pointer.
465
- pub fn to_i128 ( self ) -> InterpResult < ' static , i128 > {
465
+ pub fn to_i128 ( self ) -> InterpResult < ' tcx , i128 > {
466
466
self . to_int ( Size :: from_bits ( 128 ) )
467
467
}
468
468
469
469
/// Converts the scalar to produce a machine-pointer-sized signed integer.
470
470
/// Fails if the scalar is a pointer.
471
- pub fn to_machine_isize ( self , cx : & impl HasDataLayout ) -> InterpResult < ' static , i64 > {
471
+ pub fn to_machine_isize ( self , cx : & impl HasDataLayout ) -> InterpResult < ' tcx , i64 > {
472
472
let b = self . to_int ( cx. data_layout ( ) . pointer_size ) ?;
473
473
Ok ( i64:: try_from ( b) . unwrap ( ) )
474
474
}
475
475
476
476
#[ inline]
477
- pub fn to_f32 ( self ) -> InterpResult < ' static , Single > {
477
+ pub fn to_f32 ( self ) -> InterpResult < ' tcx , Single > {
478
478
// Going through `u32` to check size and truncation.
479
479
Ok ( Single :: from_bits ( self . to_u32 ( ) ?. into ( ) ) )
480
480
}
481
481
482
482
#[ inline]
483
- pub fn to_f64 ( self ) -> InterpResult < ' static , Double > {
483
+ pub fn to_f64 ( self ) -> InterpResult < ' tcx , Double > {
484
484
// Going through `u64` to check size and truncation.
485
485
Ok ( Double :: from_bits ( self . to_u64 ( ) ?. into ( ) ) )
486
486
}
@@ -534,7 +534,7 @@ impl<Tag> ScalarMaybeUninit<Tag> {
534
534
}
535
535
536
536
#[ inline]
537
- pub fn check_init ( self ) -> InterpResult < ' static , Scalar < Tag > > {
537
+ pub fn check_init < ' tcx > ( self ) -> InterpResult < ' tcx , Scalar < Tag > > {
538
538
match self {
539
539
ScalarMaybeUninit :: Scalar ( scalar) => Ok ( scalar) ,
540
540
ScalarMaybeUninit :: Uninit => throw_ub ! ( InvalidUninitBytes ( None ) ) ,
0 commit comments