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
|
@ -11,23 +11,18 @@ use std::fmt::Debug;
|
|||
|
||||
/// This is the replacement export map. It maps a module to all of the exports
|
||||
/// within.
|
||||
pub type ExportMap<Id> = FxHashMap<LocalDefId, Vec<Export<Id>>>;
|
||||
pub type ExportMap = FxHashMap<LocalDefId, Vec<Export>>;
|
||||
|
||||
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||
pub struct Export<Id> {
|
||||
pub struct Export {
|
||||
/// The name of the target.
|
||||
pub ident: Ident,
|
||||
/// The resolution of the target.
|
||||
pub res: Res<Id>,
|
||||
/// Local variables cannot be exported, so this `Res` doesn't need the ID parameter.
|
||||
pub res: Res<!>,
|
||||
/// The span of the target.
|
||||
pub span: Span,
|
||||
/// The visibility of the export.
|
||||
/// We include non-`pub` exports for hygienic macros that get used from extern crates.
|
||||
pub vis: ty::Visibility,
|
||||
}
|
||||
|
||||
impl<Id> Export<Id> {
|
||||
pub fn map_id<R>(self, map: impl FnMut(Id) -> R) -> Export<R> {
|
||||
Export { ident: self.ident, res: self.res.map_id(map), span: self.span, vis: self.vis }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1181,7 +1181,7 @@ rustc_queries! {
|
|||
desc { "traits in scope at a block" }
|
||||
}
|
||||
|
||||
query module_exports(def_id: LocalDefId) -> Option<&'tcx [Export<LocalDefId>]> {
|
||||
query module_exports(def_id: LocalDefId) -> Option<&'tcx [Export]> {
|
||||
desc { |tcx| "looking up items exported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
|
||||
}
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ rustc_queries! {
|
|||
eval_always
|
||||
desc { "fetching what a crate is named" }
|
||||
}
|
||||
query item_children(def_id: DefId) -> &'tcx [Export<hir::HirId>] {
|
||||
query item_children(def_id: DefId) -> &'tcx [Export] {
|
||||
desc { |tcx| "collecting child items of `{}`", tcx.def_path_str(def_id) }
|
||||
}
|
||||
query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
|
||||
|
|
|
@ -127,7 +127,7 @@ pub struct ResolverOutputs {
|
|||
pub extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
|
||||
pub maybe_unused_trait_imports: FxHashSet<LocalDefId>,
|
||||
pub maybe_unused_extern_crates: Vec<(LocalDefId, Span)>,
|
||||
pub export_map: ExportMap<LocalDefId>,
|
||||
pub export_map: ExportMap,
|
||||
pub glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>,
|
||||
/// Extern prelude entries. The value is `true` if the entry was introduced
|
||||
/// via `extern crate` item and not `--extern` option or compiler built-in.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue