Skip to content

Commit

Permalink
Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwco
Browse files Browse the repository at this point in the history
resolve: Improve candidate search for unresolved macro suggestions

Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names.

The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around).

This should be the last pre-requisite for #62086.
r? @davidtwco
  • Loading branch information
bors committed Jul 19, 2019
2 parents a336998 + 1b4fbfc commit fe499a7
Show file tree
Hide file tree
Showing 66 changed files with 1,170 additions and 1,271 deletions.
8 changes: 8 additions & 0 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,12 @@ impl<Id> Res<Id> {
Res::Err => Res::Err,
}
}

pub fn macro_kind(self) -> Option<MacroKind> {
match self {
Res::Def(DefKind::Macro(kind), _) => Some(kind),
Res::NonMacroAttr(..) => Some(MacroKind::Attr),
_ => None,
}
}
}
4 changes: 2 additions & 2 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
//! Here we build the "reduced graph": the graph of the module tree without
//! any imports resolved.
use crate::macros::{InvocationData, ParentScope, LegacyScope};
use crate::macros::{InvocationData, LegacyScope};
use crate::resolve_imports::ImportDirective;
use crate::resolve_imports::ImportDirectiveSubclass::{self, GlobImport, SingleImport};
use crate::{Module, ModuleData, ModuleKind, NameBinding, NameBindingKind, Segment, ToNameBinding};
use crate::{ModuleOrUniformRoot, PerNS, Resolver, ResolverArenas, ExternPreludeEntry};
use crate::{ModuleOrUniformRoot, ParentScope, PerNS, Resolver, ResolverArenas, ExternPreludeEntry};
use crate::Namespace::{self, TypeNS, ValueNS, MacroNS};
use crate::{resolve_error, resolve_struct_error, ResolutionError, Determinacy};

Expand Down
Loading

0 comments on commit fe499a7

Please sign in to comment.