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