Skip to content

Commit

Permalink
resolve: Merge resolution for macro_rules into the common early in-…
Browse files Browse the repository at this point in the history
…scope resolution function

`fn resolve_legacy_scope`/`fn resolve_lexical_macro_path_segment` -> `fn early_resolve_ident_in_lexical_scope`
  • Loading branch information
petrochenkov committed Oct 5, 2018
1 parent 05a4681 commit 050bd32
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 253 deletions.
1 change: 1 addition & 0 deletions src/librustc_resolve/Cargo.toml
Expand Up @@ -10,6 +10,7 @@ crate-type = ["dylib"]
test = false

[dependencies]
bitflags = "1.0"
log = "0.4"
syntax = { path = "../libsyntax" }
rustc = { path = "../librustc" }
Expand Down
10 changes: 4 additions & 6 deletions src/librustc_resolve/lib.rs
Expand Up @@ -17,6 +17,8 @@
#![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)]

#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate log;
#[macro_use]
Expand Down Expand Up @@ -1210,10 +1212,6 @@ impl<'a> NameBinding<'a> {
}
}

fn get_macro<'b: 'a>(&self, resolver: &mut Resolver<'a, 'b>) -> Lrc<SyntaxExtension> {
resolver.get_macro(self.def_ignoring_ambiguity())
}

// We sometimes need to treat variants as `pub` for backwards compatibility
fn pseudo_vis(&self) -> ty::Visibility {
if self.is_variant() && self.def().def_id().is_local() {
Expand Down Expand Up @@ -3664,8 +3662,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
self.resolve_ident_in_module(module, ident, ns, record_used, path_span)
} else if opt_ns == Some(MacroNS) {
assert!(ns == TypeNS);
self.resolve_lexical_macro_path_segment(ident, ns, None, parent_scope, record_used,
record_used, path_span).map(|(b, _)| b)
self.early_resolve_ident_in_lexical_scope(ident, ns, None, parent_scope,
record_used, record_used, path_span)
} else {
let record_used_id =
if record_used { crate_lint.node_id().or(Some(CRATE_NODE_ID)) } else { None };
Expand Down

0 comments on commit 050bd32

Please sign in to comment.