Skip to content

Commit 050bd32

Browse files
committed
resolve: Merge resolution for macro_rules into the common early in-scope resolution function
`fn resolve_legacy_scope`/`fn resolve_lexical_macro_path_segment` -> `fn early_resolve_ident_in_lexical_scope`
1 parent 05a4681 commit 050bd32

File tree

6 files changed

+173
-253
lines changed

6 files changed

+173
-253
lines changed

src/librustc_resolve/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ crate-type = ["dylib"]
1010
test = false
1111

1212
[dependencies]
13+
bitflags = "1.0"
1314
log = "0.4"
1415
syntax = { path = "../libsyntax" }
1516
rustc = { path = "../librustc" }

src/librustc_resolve/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#![feature(rustc_diagnostic_macros)]
1818
#![feature(slice_sort_by_cached_key)]
1919

20+
#[macro_use]
21+
extern crate bitflags;
2022
#[macro_use]
2123
extern crate log;
2224
#[macro_use]
@@ -1210,10 +1212,6 @@ impl<'a> NameBinding<'a> {
12101212
}
12111213
}
12121214

1213-
fn get_macro<'b: 'a>(&self, resolver: &mut Resolver<'a, 'b>) -> Lrc<SyntaxExtension> {
1214-
resolver.get_macro(self.def_ignoring_ambiguity())
1215-
}
1216-
12171215
// We sometimes need to treat variants as `pub` for backwards compatibility
12181216
fn pseudo_vis(&self) -> ty::Visibility {
12191217
if self.is_variant() && self.def().def_id().is_local() {
@@ -3664,8 +3662,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
36643662
self.resolve_ident_in_module(module, ident, ns, record_used, path_span)
36653663
} else if opt_ns == Some(MacroNS) {
36663664
assert!(ns == TypeNS);
3667-
self.resolve_lexical_macro_path_segment(ident, ns, None, parent_scope, record_used,
3668-
record_used, path_span).map(|(b, _)| b)
3665+
self.early_resolve_ident_in_lexical_scope(ident, ns, None, parent_scope,
3666+
record_used, record_used, path_span)
36693667
} else {
36703668
let record_used_id =
36713669
if record_used { crate_lint.node_id().or(Some(CRATE_NODE_ID)) } else { None };

0 commit comments

Comments
 (0)