@@ -754,13 +754,13 @@ impl<'tcx> CommonTypes<'tcx> {
754754 char : mk ( TyChar ) ,
755755 never : mk ( TyNever ) ,
756756 err : mk ( TyError ) ,
757- isize : mk ( TyInt ( ast:: IntTy :: Is ) ) ,
757+ isize : mk ( TyInt ( ast:: IntTy :: Isize ) ) ,
758758 i8 : mk ( TyInt ( ast:: IntTy :: I8 ) ) ,
759759 i16 : mk ( TyInt ( ast:: IntTy :: I16 ) ) ,
760760 i32 : mk ( TyInt ( ast:: IntTy :: I32 ) ) ,
761761 i64 : mk ( TyInt ( ast:: IntTy :: I64 ) ) ,
762762 i128 : mk ( TyInt ( ast:: IntTy :: I128 ) ) ,
763- usize : mk ( TyUint ( ast:: UintTy :: Us ) ) ,
763+ usize : mk ( TyUint ( ast:: UintTy :: Usize ) ) ,
764764 u8 : mk ( TyUint ( ast:: UintTy :: U8 ) ) ,
765765 u16 : mk ( TyUint ( ast:: UintTy :: U16 ) ) ,
766766 u32 : mk ( TyUint ( ast:: UintTy :: U32 ) ) ,
@@ -895,31 +895,29 @@ pub struct InterpretInterner<'tcx> {
895895 allocs : FxHashSet < & ' tcx interpret:: Allocation > ,
896896
897897 /// Allows obtaining function instance handles via a unique identifier
898- functions : FxHashMap < u64 , Instance < ' tcx > > ,
898+ functions : FxHashMap < interpret :: AllocId , Instance < ' tcx > > ,
899899
900900 /// Inverse map of `interpret_functions`.
901901 /// 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 > ,
903903
904904 /// 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 > ,
906906
907907 /// The AllocId to assign to the next new regular allocation.
908908 /// Always incremented, never gets smaller.
909- next_id : u64 ,
909+ next_id : interpret :: AllocId ,
910910
911911 /// 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 > ,
915913
916914 /// A cache for basic byte allocations keyed by their contents. This is used to deduplicate
917915 /// allocations for string and bytestring literals.
918- literal_alloc_cache : FxHashMap < Vec < u8 > , u64 > ,
916+ literal_alloc_cache : FxHashMap < Vec < u8 > , interpret :: AllocId > ,
919917}
920918
921919impl < ' 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 {
923921 if let Some ( & alloc_id) = self . function_cache . get ( & instance) {
924922 return alloc_id;
925923 }
@@ -932,29 +930,29 @@ impl<'tcx> InterpretInterner<'tcx> {
932930
933931 pub fn get_fn (
934932 & self ,
935- id : u64 ,
933+ id : interpret :: AllocId ,
936934 ) -> Option < Instance < ' tcx > > {
937935 self . functions . get ( & id) . cloned ( )
938936 }
939937
940938 pub fn get_alloc (
941939 & self ,
942- id : u64 ,
940+ id : interpret :: AllocId ,
943941 ) -> Option < & ' tcx interpret:: Allocation > {
944942 self . alloc_by_id . get ( & id) . cloned ( )
945943 }
946944
947945 pub fn get_cached (
948946 & self ,
949947 global_id : interpret:: GlobalId < ' tcx > ,
950- ) -> Option < interpret:: Pointer > {
948+ ) -> Option < interpret:: AllocId > {
951949 self . alloc_cache . get ( & global_id) . cloned ( )
952950 }
953951
954952 pub fn cache (
955953 & mut self ,
956954 global_id : interpret:: GlobalId < ' tcx > ,
957- ptr : interpret:: Pointer ,
955+ ptr : interpret:: AllocId ,
958956 ) {
959957 if let Some ( old) = self . alloc_cache . insert ( global_id, ptr) {
960958 bug ! ( "tried to cache {:?}, but was already existing as {:#?}" , global_id, old) ;
@@ -963,7 +961,7 @@ impl<'tcx> InterpretInterner<'tcx> {
963961
964962 pub fn intern_at_reserved (
965963 & mut self ,
966- id : u64 ,
964+ id : interpret :: AllocId ,
967965 alloc : & ' tcx interpret:: Allocation ,
968966 ) {
969967 if let Some ( old) = self . alloc_by_id . insert ( id, alloc) {
@@ -975,9 +973,9 @@ impl<'tcx> InterpretInterner<'tcx> {
975973 /// yet have an allocation backing it.
976974 pub fn reserve (
977975 & mut self ,
978- ) -> u64 {
976+ ) -> interpret :: AllocId {
979977 let next = self . next_id ;
980- self . next_id = self . next_id
978+ self . next_id . 0 = self . next_id . 0
981979 . checked_add ( 1 )
982980 . expect ( "You overflowed a u64 by incrementing by 1... \
983981 You've just earned yourself a free drink if we ever meet. \
@@ -1069,7 +1067,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
10691067 }
10701068
10711069 /// 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 {
10731071 // check whether we already allocated this literal or a constant with the same memory
10741072 if let Some ( & alloc_id) = self . interpret_interner . borrow ( ) . literal_alloc_cache . get ( bytes) {
10751073 return alloc_id;
@@ -1912,7 +1910,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
19121910
19131911 pub fn mk_mach_int ( self , tm : ast:: IntTy ) -> Ty < ' tcx > {
19141912 match tm {
1915- ast:: IntTy :: Is => self . types . isize ,
1913+ ast:: IntTy :: Isize => self . types . isize ,
19161914 ast:: IntTy :: I8 => self . types . i8 ,
19171915 ast:: IntTy :: I16 => self . types . i16 ,
19181916 ast:: IntTy :: I32 => self . types . i32 ,
@@ -1923,7 +1921,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
19231921
19241922 pub fn mk_mach_uint ( self , tm : ast:: UintTy ) -> Ty < ' tcx > {
19251923 match tm {
1926- ast:: UintTy :: Us => self . types . usize ,
1924+ ast:: UintTy :: Usize => self . types . usize ,
19271925 ast:: UintTy :: U8 => self . types . u8 ,
19281926 ast:: UintTy :: U16 => self . types . u16 ,
19291927 ast:: UintTy :: U32 => self . types . u32 ,
0 commit comments