From 041a612dad70dbcc69189773ee396fcb55bda4f5 Mon Sep 17 00:00:00 2001 From: Gabriel Smith Date: Mon, 18 Nov 2019 14:22:00 -0500 Subject: [PATCH] resolve: Allow idents to resolve to primitives in the type namespace --- src/librustc_resolve/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 8f6bb91f028c..c49db39643bc 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1726,6 +1726,14 @@ impl<'a> Resolver<'a> { } } + if ns == TypeNS { + if let Some(prim_ty) = self.primitive_type_table.primitive_types.get(&ident.name) { + let binding = (Res::PrimTy(*prim_ty), ty::Visibility::Public, + DUMMY_SP, ExpnId::root()).to_name_binding(self.arenas); + return Some(LexicalScopeBinding::Item(binding)); + } + } + None }