Skip to content
Permalink
Browse files

Update upvars and module_exports

  • Loading branch information...
Zoxc committed Dec 1, 2018
1 parent 5f808f6 commit 9b648f7088cc6336a70ce65d86af10930212253c
Showing with 9 additions and 9 deletions.
  1. +2 −2 src/librustc/query/mod.rs
  2. +6 −6 src/librustc/ty/context.rs
  3. +1 −1 src/librustc_metadata/encoder.rs
@@ -644,7 +644,7 @@ rustc_queries! {
}

Other {
query module_exports(_: DefId) -> Option<Lrc<Vec<Export<hir::HirId>>>> {
query module_exports(_: DefId) -> Option<&'tcx [Export<hir::HirId>]> {
eval_always
}
}
@@ -822,7 +822,7 @@ rustc_queries! {
desc { "generating a postorder list of CrateNums" }
}

query upvars(_: DefId) -> Option<Lrc<Vec<hir::Upvar>>> {
query upvars(_: DefId) -> Option<&'tcx [hir::Upvar]> {
eval_always
}
query maybe_unused_trait_import(_: DefId) -> bool {
@@ -1068,7 +1068,7 @@ pub struct GlobalCtxt<'tcx> {
StableVec<TraitCandidate>>>,

/// Export map produced by name resolution.
export_map: FxHashMap<DefId, Lrc<Vec<Export<hir::HirId>>>>,
export_map: FxHashMap<DefId, Vec<Export<hir::HirId>>>,

hir_map: hir_map::Map<'tcx>,

@@ -1081,7 +1081,7 @@ pub struct GlobalCtxt<'tcx> {
// Records the captured variables referenced by every closure
// expression. Do not track deps for this, just recompute it from
// scratch every time.
upvars: FxHashMap<DefId, Lrc<Vec<hir::Upvar>>>,
upvars: FxHashMap<DefId, Vec<hir::Upvar>>,

maybe_unused_trait_imports: FxHashSet<DefId>,
maybe_unused_extern_crates: Vec<(DefId, Span)>,
@@ -1328,13 +1328,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let exports: Vec<_> = v.into_iter().map(|e| {
e.map_id(|id| hir.node_to_hir_id(id))
}).collect();
(k, Lrc::new(exports))
(k, exports)
}).collect(),
upvars: resolutions.upvars.into_iter().map(|(k, v)| {
let vars: Vec<_> = v.into_iter().map(|e| {
e.map_id(|id| hir.node_to_hir_id(id))
}).collect();
(hir.local_def_id(k), Lrc::new(vars))
(hir.local_def_id(k), vars)
}).collect(),
maybe_unused_trait_imports:
resolutions.maybe_unused_trait_imports
@@ -3053,7 +3053,7 @@ fn ptr_eq<T, U>(t: *const T, u: *const U) -> bool {

pub fn provide(providers: &mut ty::query::Providers<'_>) {
providers.in_scope_traits_map = |tcx, id| tcx.gcx.trait_map.get(&id);
providers.module_exports = |tcx, id| tcx.gcx.export_map.get(&id).cloned();
providers.module_exports = |tcx, id| tcx.gcx.export_map.get(&id).map(|v| &v[..]);
providers.crate_name = |tcx, id| {
assert_eq!(id, LOCAL_CRATE);
tcx.crate_name
@@ -3066,7 +3066,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
assert_eq!(id, LOCAL_CRATE);
Lrc::new(middle::lang_items::collect(tcx))
};
providers.upvars = |tcx, id| tcx.gcx.upvars.get(&id).cloned();
providers.upvars = |tcx, id| tcx.gcx.upvars.get(&id).map(|v| &v[..]);
providers.maybe_unused_trait_import = |tcx, id| {
tcx.maybe_unused_trait_imports.contains(&id)
};
@@ -673,7 +673,7 @@ impl EncodeContext<'_, 'tcx> {

let data = ModData {
reexports: match tcx.module_exports(def_id) {
Some(ref exports) => self.lazy_seq_ref(&exports[..]),
Some(exports) => self.lazy_seq_ref(exports),
_ => LazySeq::empty(),
},
};

0 comments on commit 9b648f7

Please sign in to comment.
You can’t perform that action at this time.