@@ -754,13 +754,13 @@ impl<'tcx> CommonTypes<'tcx> {
754
754
char : mk ( TyChar ) ,
755
755
never : mk ( TyNever ) ,
756
756
err : mk ( TyError ) ,
757
- isize : mk ( TyInt ( ast:: IntTy :: Is ) ) ,
757
+ isize : mk ( TyInt ( ast:: IntTy :: Isize ) ) ,
758
758
i8 : mk ( TyInt ( ast:: IntTy :: I8 ) ) ,
759
759
i16 : mk ( TyInt ( ast:: IntTy :: I16 ) ) ,
760
760
i32 : mk ( TyInt ( ast:: IntTy :: I32 ) ) ,
761
761
i64 : mk ( TyInt ( ast:: IntTy :: I64 ) ) ,
762
762
i128 : mk ( TyInt ( ast:: IntTy :: I128 ) ) ,
763
- usize : mk ( TyUint ( ast:: UintTy :: Us ) ) ,
763
+ usize : mk ( TyUint ( ast:: UintTy :: Usize ) ) ,
764
764
u8 : mk ( TyUint ( ast:: UintTy :: U8 ) ) ,
765
765
u16 : mk ( TyUint ( ast:: UintTy :: U16 ) ) ,
766
766
u32 : mk ( TyUint ( ast:: UintTy :: U32 ) ) ,
@@ -895,31 +895,29 @@ pub struct InterpretInterner<'tcx> {
895
895
allocs : FxHashSet < & ' tcx interpret:: Allocation > ,
896
896
897
897
/// Allows obtaining function instance handles via a unique identifier
898
- functions : FxHashMap < u64 , Instance < ' tcx > > ,
898
+ functions : FxHashMap < interpret :: AllocId , Instance < ' tcx > > ,
899
899
900
900
/// Inverse map of `interpret_functions`.
901
901
/// Used so we don't allocate a new pointer every time we need one
902
- function_cache : FxHashMap < Instance < ' tcx > , u64 > ,
902
+ function_cache : FxHashMap < Instance < ' tcx > , interpret :: AllocId > ,
903
903
904
904
/// Allows obtaining const allocs via a unique identifier
905
- alloc_by_id : FxHashMap < u64 , & ' tcx interpret:: Allocation > ,
905
+ alloc_by_id : FxHashMap < interpret :: AllocId , & ' tcx interpret:: Allocation > ,
906
906
907
907
/// The AllocId to assign to the next new regular allocation.
908
908
/// Always incremented, never gets smaller.
909
- next_id : u64 ,
909
+ next_id : interpret :: AllocId ,
910
910
911
911
/// Allows checking whether a constant already has an allocation
912
- ///
913
- /// The pointers are to the beginning of an `alloc_by_id` allocation
914
- alloc_cache : FxHashMap < interpret:: GlobalId < ' tcx > , interpret:: Pointer > ,
912
+ alloc_cache : FxHashMap < interpret:: GlobalId < ' tcx > , interpret:: AllocId > ,
915
913
916
914
/// A cache for basic byte allocations keyed by their contents. This is used to deduplicate
917
915
/// allocations for string and bytestring literals.
918
- literal_alloc_cache : FxHashMap < Vec < u8 > , u64 > ,
916
+ literal_alloc_cache : FxHashMap < Vec < u8 > , interpret :: AllocId > ,
919
917
}
920
918
921
919
impl < ' tcx > InterpretInterner < ' tcx > {
922
- pub fn create_fn_alloc ( & mut self , instance : Instance < ' tcx > ) -> u64 {
920
+ pub fn create_fn_alloc ( & mut self , instance : Instance < ' tcx > ) -> interpret :: AllocId {
923
921
if let Some ( & alloc_id) = self . function_cache . get ( & instance) {
924
922
return alloc_id;
925
923
}
@@ -932,29 +930,29 @@ impl<'tcx> InterpretInterner<'tcx> {
932
930
933
931
pub fn get_fn (
934
932
& self ,
935
- id : u64 ,
933
+ id : interpret :: AllocId ,
936
934
) -> Option < Instance < ' tcx > > {
937
935
self . functions . get ( & id) . cloned ( )
938
936
}
939
937
940
938
pub fn get_alloc (
941
939
& self ,
942
- id : u64 ,
940
+ id : interpret :: AllocId ,
943
941
) -> Option < & ' tcx interpret:: Allocation > {
944
942
self . alloc_by_id . get ( & id) . cloned ( )
945
943
}
946
944
947
945
pub fn get_cached (
948
946
& self ,
949
947
global_id : interpret:: GlobalId < ' tcx > ,
950
- ) -> Option < interpret:: Pointer > {
948
+ ) -> Option < interpret:: AllocId > {
951
949
self . alloc_cache . get ( & global_id) . cloned ( )
952
950
}
953
951
954
952
pub fn cache (
955
953
& mut self ,
956
954
global_id : interpret:: GlobalId < ' tcx > ,
957
- ptr : interpret:: Pointer ,
955
+ ptr : interpret:: AllocId ,
958
956
) {
959
957
if let Some ( old) = self . alloc_cache . insert ( global_id, ptr) {
960
958
bug ! ( "tried to cache {:?}, but was already existing as {:#?}" , global_id, old) ;
@@ -963,7 +961,7 @@ impl<'tcx> InterpretInterner<'tcx> {
963
961
964
962
pub fn intern_at_reserved (
965
963
& mut self ,
966
- id : u64 ,
964
+ id : interpret :: AllocId ,
967
965
alloc : & ' tcx interpret:: Allocation ,
968
966
) {
969
967
if let Some ( old) = self . alloc_by_id . insert ( id, alloc) {
@@ -975,9 +973,9 @@ impl<'tcx> InterpretInterner<'tcx> {
975
973
/// yet have an allocation backing it.
976
974
pub fn reserve (
977
975
& mut self ,
978
- ) -> u64 {
976
+ ) -> interpret :: AllocId {
979
977
let next = self . next_id ;
980
- self . next_id = self . next_id
978
+ self . next_id . 0 = self . next_id . 0
981
979
. checked_add ( 1 )
982
980
. expect ( "You overflowed a u64 by incrementing by 1... \
983
981
You've just earned yourself a free drink if we ever meet. \
@@ -1069,7 +1067,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1069
1067
}
1070
1068
1071
1069
/// Allocates a byte or string literal for `mir::interpret`
1072
- pub fn allocate_cached ( self , bytes : & [ u8 ] ) -> u64 {
1070
+ pub fn allocate_cached ( self , bytes : & [ u8 ] ) -> interpret :: AllocId {
1073
1071
// check whether we already allocated this literal or a constant with the same memory
1074
1072
if let Some ( & alloc_id) = self . interpret_interner . borrow ( ) . literal_alloc_cache . get ( bytes) {
1075
1073
return alloc_id;
@@ -1912,7 +1910,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1912
1910
1913
1911
pub fn mk_mach_int ( self , tm : ast:: IntTy ) -> Ty < ' tcx > {
1914
1912
match tm {
1915
- ast:: IntTy :: Is => self . types . isize ,
1913
+ ast:: IntTy :: Isize => self . types . isize ,
1916
1914
ast:: IntTy :: I8 => self . types . i8 ,
1917
1915
ast:: IntTy :: I16 => self . types . i16 ,
1918
1916
ast:: IntTy :: I32 => self . types . i32 ,
@@ -1923,7 +1921,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1923
1921
1924
1922
pub fn mk_mach_uint ( self , tm : ast:: UintTy ) -> Ty < ' tcx > {
1925
1923
match tm {
1926
- ast:: UintTy :: Us => self . types . usize ,
1924
+ ast:: UintTy :: Usize => self . types . usize ,
1927
1925
ast:: UintTy :: U8 => self . types . u8 ,
1928
1926
ast:: UintTy :: U16 => self . types . u16 ,
1929
1927
ast:: UintTy :: U32 => self . types . u32 ,
0 commit comments