@@ -24,7 +24,7 @@ use rustc_arena::{DroplessArena, TypedArena};
24
24
use rustc_ast:: node_id:: NodeMap ;
25
25
use rustc_ast:: unwrap_or;
26
26
use rustc_ast:: visit:: { self , Visitor } ;
27
- use rustc_ast:: { self as ast, FloatTy , IntTy , NodeId , UintTy } ;
27
+ use rustc_ast:: { self as ast, NodeId } ;
28
28
use rustc_ast:: { Crate , CRATE_NODE_ID } ;
29
29
use rustc_ast:: { ItemKind , Path } ;
30
30
use rustc_ast_lowering:: ResolverAstLowering ;
@@ -38,8 +38,7 @@ use rustc_hir::def::Namespace::*;
38
38
use rustc_hir:: def:: { self , CtorOf , DefKind , NonMacroAttrKind , PartialRes } ;
39
39
use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , LocalDefId , CRATE_DEF_INDEX } ;
40
40
use rustc_hir:: definitions:: { DefKey , DefPathData , Definitions } ;
41
- use rustc_hir:: PrimTy :: { self , Bool , Char , Float , Int , Str , Uint } ;
42
- use rustc_hir:: TraitCandidate ;
41
+ use rustc_hir:: { PrimTy , TraitCandidate } ;
43
42
use rustc_index:: vec:: IndexVec ;
44
43
use rustc_metadata:: creader:: { CStore , CrateLoader } ;
45
44
use rustc_middle:: hir:: exports:: ExportMap ;
@@ -833,39 +832,6 @@ impl<'a> NameBinding<'a> {
833
832
}
834
833
}
835
834
836
- /// Interns the names of the primitive types.
837
- ///
838
- /// All other types are defined somewhere and possibly imported, but the primitive ones need
839
- /// special handling, since they have no place of origin.
840
- struct PrimitiveTypeTable {
841
- primitive_types : FxHashMap < Symbol , PrimTy > ,
842
- }
843
-
844
- impl PrimitiveTypeTable {
845
- fn new ( ) -> PrimitiveTypeTable {
846
- let mut table = FxHashMap :: default ( ) ;
847
-
848
- table. insert ( sym:: bool, Bool ) ;
849
- table. insert ( sym:: char, Char ) ;
850
- table. insert ( sym:: f32, Float ( FloatTy :: F32 ) ) ;
851
- table. insert ( sym:: f64, Float ( FloatTy :: F64 ) ) ;
852
- table. insert ( sym:: isize, Int ( IntTy :: Isize ) ) ;
853
- table. insert ( sym:: i8, Int ( IntTy :: I8 ) ) ;
854
- table. insert ( sym:: i16, Int ( IntTy :: I16 ) ) ;
855
- table. insert ( sym:: i32, Int ( IntTy :: I32 ) ) ;
856
- table. insert ( sym:: i64, Int ( IntTy :: I64 ) ) ;
857
- table. insert ( sym:: i128, Int ( IntTy :: I128 ) ) ;
858
- table. insert ( sym:: str, Str ) ;
859
- table. insert ( sym:: usize, Uint ( UintTy :: Usize ) ) ;
860
- table. insert ( sym:: u8, Uint ( UintTy :: U8 ) ) ;
861
- table. insert ( sym:: u16, Uint ( UintTy :: U16 ) ) ;
862
- table. insert ( sym:: u32, Uint ( UintTy :: U32 ) ) ;
863
- table. insert ( sym:: u64, Uint ( UintTy :: U64 ) ) ;
864
- table. insert ( sym:: u128, Uint ( UintTy :: U128 ) ) ;
865
- Self { primitive_types : table }
866
- }
867
- }
868
-
869
835
#[ derive( Debug , Default , Clone ) ]
870
836
pub struct ExternPreludeEntry < ' a > {
871
837
extern_crate_item : Option < & ' a NameBinding < ' a > > ,
@@ -911,9 +877,6 @@ pub struct Resolver<'a> {
911
877
/// "self-confirming" import resolutions during import validation.
912
878
unusable_binding : Option < & ' a NameBinding < ' a > > ,
913
879
914
- /// The idents for the primitive types.
915
- primitive_type_table : PrimitiveTypeTable ,
916
-
917
880
/// Resolutions for nodes that have a single resolution.
918
881
partial_res_map : NodeMap < PartialRes > ,
919
882
/// Resolutions for import nodes, which have multiple resolutions in different namespaces.
@@ -1283,8 +1246,6 @@ impl<'a> Resolver<'a> {
1283
1246
last_import_segment : false ,
1284
1247
unusable_binding : None ,
1285
1248
1286
- primitive_type_table : PrimitiveTypeTable :: new ( ) ,
1287
-
1288
1249
partial_res_map : Default :: default ( ) ,
1289
1250
import_res_map : Default :: default ( ) ,
1290
1251
label_res_map : Default :: default ( ) ,
@@ -1993,9 +1954,9 @@ impl<'a> Resolver<'a> {
1993
1954
}
1994
1955
1995
1956
if ns == TypeNS {
1996
- if let Some ( prim_ty) = self . primitive_type_table . primitive_types . get ( & ident. name ) {
1957
+ if let Some ( prim_ty) = PrimTy :: from_name ( ident. name ) {
1997
1958
let binding =
1998
- ( Res :: PrimTy ( * prim_ty) , ty:: Visibility :: Public , DUMMY_SP , ExpnId :: root ( ) )
1959
+ ( Res :: PrimTy ( prim_ty) , ty:: Visibility :: Public , DUMMY_SP , ExpnId :: root ( ) )
1999
1960
. to_name_binding ( self . arenas ) ;
2000
1961
return Some ( LexicalScopeBinding :: Item ( binding) ) ;
2001
1962
}
0 commit comments