@@ -42,10 +42,15 @@ use std::{mem, ptr};
4242#[ derive( Clone , Debug ) ]
4343pub enum ImportDirectiveSubclass < ' a > {
4444 SingleImport {
45+ /// `source` in `use prefix::source as target`.
4546 source : Ident ,
47+ /// `target` in `use prefix::source as target`.
4648 target : Ident ,
49+ /// Bindings to which `source` refers to.
4750 source_bindings : PerNS < Cell < Result < & ' a NameBinding < ' a > , Determinacy > > > ,
51+ /// Bindings introduced by `target`.
4852 target_bindings : PerNS < Cell < Option < & ' a NameBinding < ' a > > > > ,
53+ /// `true` for `...::{self [as target]}` imports, `false` otherwise.
4954 type_ns_only : bool ,
5055 } ,
5156 GlobImport {
@@ -946,9 +951,12 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
946951 // Consistency checks, analogous to `finalize_current_module_macro_resolutions`.
947952 let initial_def = source_bindings[ ns] . get ( ) . map ( |initial_binding| {
948953 all_ns_err = false ;
949- if target. name == "_" &&
950- initial_binding. is_extern_crate ( ) && !initial_binding. is_import ( ) {
951- this. used_imports . insert ( ( directive. id , TypeNS ) ) ;
954+ if let Some ( target_binding) = target_bindings[ ns] . get ( ) {
955+ if target. name == "_" &&
956+ initial_binding. is_extern_crate ( ) && !initial_binding. is_import ( ) {
957+ this. record_use ( ident, ns, target_binding,
958+ directive. module_path . is_empty ( ) ) ;
959+ }
952960 }
953961 initial_binding. def_ignoring_ambiguity ( )
954962 } ) ;
0 commit comments