rustc: Remove local variable IDs from Export
s
Local variables can never be exported.
This commit is contained in:
parent
b69fe57261
commit
294510e1bb
19 changed files with 71 additions and 68 deletions
|
@ -228,7 +228,6 @@ impl<'a> Resolver<'a> {
|
|||
crate fn build_reduced_graph_external(&mut self, module: Module<'a>) {
|
||||
let def_id = module.def_id().expect("unpopulated module without a def-id");
|
||||
for child in self.cstore().item_children_untracked(def_id, self.session) {
|
||||
let child = child.map_id(|_| panic!("unexpected id"));
|
||||
let parent_scope = ParentScope::module(module, self);
|
||||
BuildReducedGraphVisitor { r: self, parent_scope }
|
||||
.build_reduced_graph_for_external_crate_res(child);
|
||||
|
@ -946,9 +945,10 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
}
|
||||
|
||||
/// Builds the reduced graph for a single item in an external crate.
|
||||
fn build_reduced_graph_for_external_crate_res(&mut self, child: Export<NodeId>) {
|
||||
fn build_reduced_graph_for_external_crate_res(&mut self, child: Export) {
|
||||
let parent = self.parent_scope.module;
|
||||
let Export { ident, res, vis, span } = child;
|
||||
let res = res.expect_non_local();
|
||||
let expansion = self.parent_scope.expansion;
|
||||
// Record primary definitions.
|
||||
match res {
|
||||
|
|
|
@ -11,7 +11,6 @@ use crate::{NameBinding, NameBindingKind, PathResult, PrivacyError, ToNameBindin
|
|||
|
||||
use rustc_ast::unwrap_or;
|
||||
use rustc_ast::NodeId;
|
||||
use rustc_ast_lowering::ResolverAstLowering;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::ptr_key::PtrKey;
|
||||
use rustc_errors::{pluralize, struct_span_err, Applicability};
|
||||
|
@ -1387,13 +1386,13 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
|
||||
let mut reexports = Vec::new();
|
||||
|
||||
module.for_each_child(self.r, |this, ident, _, binding| {
|
||||
module.for_each_child(self.r, |_, ident, _, binding| {
|
||||
// Filter away ambiguous imports and anything that has def-site hygiene.
|
||||
// FIXME: Implement actual cross-crate hygiene.
|
||||
let is_good_import =
|
||||
binding.is_import() && !binding.is_ambiguity() && !ident.span.from_expansion();
|
||||
if is_good_import || binding.is_macro_def() {
|
||||
let res = binding.res().map_id(|id| this.local_def_id(id));
|
||||
let res = binding.res().expect_non_local();
|
||||
if res != def::Res::Err {
|
||||
reexports.push(Export { ident, res, span: binding.span, vis: binding.vis });
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(format_args_capture)]
|
||||
#![feature(iter_zip)]
|
||||
#![feature(never_type)]
|
||||
#![feature(nll)]
|
||||
#![recursion_limit = "256"]
|
||||
#![allow(rustdoc::private_intra_doc_links)]
|
||||
|
@ -911,7 +912,7 @@ pub struct Resolver<'a> {
|
|||
|
||||
/// `CrateNum` resolutions of `extern crate` items.
|
||||
extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
|
||||
export_map: ExportMap<LocalDefId>,
|
||||
export_map: ExportMap,
|
||||
trait_map: Option<NodeMap<Vec<TraitCandidate>>>,
|
||||
|
||||
/// A map from nodes to anonymous modules.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue