@@ -80,7 +80,7 @@ use std::mem::replace;
80
80
use rustc_data_structures::sync::Lrc;
81
81
82
82
use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver};
83
- use macros::{InvocationData, LegacyBinding, LegacyScope, MacroBinding};
83
+ use macros::{InvocationData, LegacyBinding, MacroBinding};
84
84
85
85
// NB: This module needs to be declared first so diagnostics are
86
86
// registered before they are used.
@@ -1399,23 +1399,18 @@ pub struct Resolver<'a, 'b: 'a> {
1399
1399
/// crate-local macro expanded `macro_export` referred to by a module-relative path
1400
1400
macro_expanded_macro_export_errors: BTreeSet<(Span, Span)>,
1401
1401
1402
- gated_errors: FxHashSet<Span>,
1403
1402
disallowed_shadowing: Vec<&'a LegacyBinding<'a>>,
1404
1403
1405
1404
arenas: &'a ResolverArenas<'a>,
1406
1405
dummy_binding: &'a NameBinding<'a>,
1407
- /// true if `#![feature(use_extern_macros)]`
1408
- use_extern_macros: bool,
1409
1406
1410
1407
crate_loader: &'a mut CrateLoader<'b>,
1411
1408
macro_names: FxHashSet<Ident>,
1412
1409
macro_prelude: FxHashMap<Name, &'a NameBinding<'a>>,
1413
1410
pub all_macros: FxHashMap<Name, Def>,
1414
- lexical_macro_resolutions: Vec<(Ident, &'a Cell<LegacyScope<'a>>)>,
1415
1411
macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
1416
1412
macro_defs: FxHashMap<Mark, DefId>,
1417
1413
local_macro_def_scopes: FxHashMap<NodeId, Module<'a>>,
1418
- macro_exports: Vec<Export>, // FIXME: Remove when `use_extern_macros` is stabilized
1419
1414
pub whitelisted_legacy_custom_derives: Vec<Name>,
1420
1415
pub found_unresolved_macro: bool,
1421
1416
@@ -1657,8 +1652,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
1657
1652
invocations.insert(Mark::root(),
1658
1653
arenas.alloc_invocation_data(InvocationData::root(graph_root)));
1659
1654
1660
- let features = session.features_untracked();
1661
-
1662
1655
let mut macro_defs = FxHashMap();
1663
1656
macro_defs.insert(Mark::root(), root_def_id);
1664
1657
@@ -1717,7 +1710,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
1717
1710
ambiguity_errors: Vec::new(),
1718
1711
use_injections: Vec::new(),
1719
1712
proc_mac_errors: Vec::new(),
1720
- gated_errors: FxHashSet(),
1721
1713
disallowed_shadowing: Vec::new(),
1722
1714
macro_expanded_macro_export_errors: BTreeSet::new(),
1723
1715
@@ -1729,15 +1721,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
1729
1721
vis: ty::Visibility::Public,
1730
1722
}),
1731
1723
1732
- use_extern_macros: features.use_extern_macros(),
1733
-
1734
1724
crate_loader,
1735
1725
macro_names: FxHashSet(),
1736
1726
macro_prelude: FxHashMap(),
1737
1727
all_macros: FxHashMap(),
1738
- lexical_macro_resolutions: Vec::new(),
1739
1728
macro_map: FxHashMap(),
1740
- macro_exports: Vec::new(),
1741
1729
invocations,
1742
1730
macro_defs,
1743
1731
local_macro_def_scopes: FxHashMap(),
@@ -1770,9 +1758,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
1770
1758
fn per_ns<F: FnMut(&mut Self, Namespace)>(&mut self, mut f: F) {
1771
1759
f(self, TypeNS);
1772
1760
f(self, ValueNS);
1773
- if self.use_extern_macros {
1774
- f(self, MacroNS);
1775
- }
1761
+ f(self, MacroNS);
1776
1762
}
1777
1763
1778
1764
fn macro_def(&self, mut ctxt: SyntaxContext) -> DefId {
@@ -2186,11 +2172,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
2186
2172
2187
2173
fn resolve_item(&mut self, item: &Item) {
2188
2174
let name = item.ident.name;
2189
-
2190
2175
debug!("(resolving item) resolving {}", name);
2191
2176
2192
- self.check_proc_macro_attrs(&item.attrs);
2193
-
2194
2177
match item.node {
2195
2178
ItemKind::Enum(_, ref generics) |
2196
2179
ItemKind::Ty(_, ref generics) |
@@ -2218,8 +2201,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
2218
2201
walk_list!(this, visit_param_bound, bounds);
2219
2202
2220
2203
for trait_item in trait_items {
2221
- this.check_proc_macro_attrs(&trait_item.attrs);
2222
-
2223
2204
let type_parameters = HasTypeParameters(&trait_item.generics,
2224
2205
TraitOrImplItemRibKind);
2225
2206
this.with_type_parameter_rib(type_parameters, |this| {
@@ -2498,7 +2479,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
2498
2479
this.visit_generics(generics);
2499
2480
this.with_current_self_type(self_type, |this| {
2500
2481
for impl_item in impl_items {
2501
- this.check_proc_macro_attrs(&impl_item.attrs);
2502
2482
this.resolve_visibility(&impl_item.vis);
2503
2483
2504
2484
// We also need a new scope for the impl item type parameters.
@@ -4488,10 +4468,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
4488
4468
}
4489
4469
4490
4470
fn report_shadowing_errors(&mut self) {
4491
- for (ident, scope) in replace(&mut self.lexical_macro_resolutions, Vec::new()) {
4492
- self.resolve_legacy_scope(scope, ident, true);
4493
- }
4494
-
4495
4471
let mut reported_errors = FxHashSet();
4496
4472
for binding in replace(&mut self.disallowed_shadowing, Vec::new()) {
4497
4473
if self.resolve_legacy_scope(&binding.parent, binding.ident, false).is_some() &&
@@ -4612,36 +4588,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
4612
4588
err.emit();
4613
4589
self.name_already_seen.insert(name, span);
4614
4590
}
4615
-
4616
- fn check_proc_macro_attrs(&mut self, attrs: &[ast::Attribute]) {
4617
- if self.use_extern_macros { return; }
4618
-
4619
- for attr in attrs {
4620
- if attr.path.segments.len() > 1 {
4621
- continue
4622
- }
4623
- let ident = attr.path.segments[0].ident;
4624
- let result = self.resolve_lexical_macro_path_segment(ident,
4625
- MacroNS,
4626
- false,
4627
- false,
4628
- true,
4629
- attr.path.span);
4630
- if let Ok(binding) = result {
4631
- if let SyntaxExtension::AttrProcMacro(..) = *binding.binding().get_macro(self) {
4632
- attr::mark_known(attr);
4633
-
4634
- let msg = "attribute procedural macros are experimental";
4635
- let feature = "use_extern_macros";
4636
-
4637
- feature_err(&self.session.parse_sess, feature,
4638
- attr.span, GateIssue::Language, msg)
4639
- .span_label(binding.span(), "procedural macro imported here")
4640
- .emit();
4641
- }
4642
- }
4643
- }
4644
- }
4645
4591
}
4646
4592
4647
4593
fn is_self_type(path: &[Ident], namespace: Namespace) -> bool {
0 commit comments