Address review comments
This commit is contained in:
parent
2d4b633be3
commit
eb1d2e637e
2 changed files with 15 additions and 4 deletions
|
@ -1519,8 +1519,11 @@ pub struct Resolver<'a, 'b: 'a> {
|
||||||
/// The current self item if inside an ADT (used for better errors).
|
/// The current self item if inside an ADT (used for better errors).
|
||||||
current_self_item: Option<NodeId>,
|
current_self_item: Option<NodeId>,
|
||||||
|
|
||||||
/// FIXME: Refactor things so that this is passed through arguments and not resolver.
|
/// FIXME: Refactor things so that these fields are passed through arguments and not resolver.
|
||||||
|
/// We are resolving a last import segment during import validation.
|
||||||
last_import_segment: bool,
|
last_import_segment: bool,
|
||||||
|
/// This binding should be ignored during in-module resolution, so that we don't get
|
||||||
|
/// "self-confirming" import resolutions during import validation.
|
||||||
blacklisted_binding: Option<&'a NameBinding<'a>>,
|
blacklisted_binding: Option<&'a NameBinding<'a>>,
|
||||||
|
|
||||||
/// The idents for the primitive types.
|
/// The idents for the primitive types.
|
||||||
|
|
|
@ -42,10 +42,15 @@ use std::{mem, ptr};
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum ImportDirectiveSubclass<'a> {
|
pub enum ImportDirectiveSubclass<'a> {
|
||||||
SingleImport {
|
SingleImport {
|
||||||
|
/// `source` in `use prefix::source as target`.
|
||||||
source: Ident,
|
source: Ident,
|
||||||
|
/// `target` in `use prefix::source as target`.
|
||||||
target: Ident,
|
target: Ident,
|
||||||
|
/// Bindings to which `source` refers to.
|
||||||
source_bindings: PerNS<Cell<Result<&'a NameBinding<'a>, Determinacy>>>,
|
source_bindings: PerNS<Cell<Result<&'a NameBinding<'a>, Determinacy>>>,
|
||||||
|
/// Bindings introduced by `target`.
|
||||||
target_bindings: PerNS<Cell<Option<&'a NameBinding<'a>>>>,
|
target_bindings: PerNS<Cell<Option<&'a NameBinding<'a>>>>,
|
||||||
|
/// `true` for `...::{self [as target]}` imports, `false` otherwise.
|
||||||
type_ns_only: bool,
|
type_ns_only: bool,
|
||||||
},
|
},
|
||||||
GlobImport {
|
GlobImport {
|
||||||
|
@ -946,9 +951,12 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
|
||||||
// Consistency checks, analogous to `finalize_current_module_macro_resolutions`.
|
// Consistency checks, analogous to `finalize_current_module_macro_resolutions`.
|
||||||
let initial_def = source_bindings[ns].get().map(|initial_binding| {
|
let initial_def = source_bindings[ns].get().map(|initial_binding| {
|
||||||
all_ns_err = false;
|
all_ns_err = false;
|
||||||
if target.name == "_" &&
|
if let Some(target_binding) = target_bindings[ns].get() {
|
||||||
initial_binding.is_extern_crate() && !initial_binding.is_import() {
|
if target.name == "_" &&
|
||||||
this.used_imports.insert((directive.id, TypeNS));
|
initial_binding.is_extern_crate() && !initial_binding.is_import() {
|
||||||
|
this.record_use(ident, ns, target_binding,
|
||||||
|
directive.module_path.is_empty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
initial_binding.def_ignoring_ambiguity()
|
initial_binding.def_ignoring_ambiguity()
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue