Update privacy_access_levels
This commit is contained in:
parent
5751fcc3b1
commit
fb578794b0
4 changed files with 5 additions and 6 deletions
|
@ -82,6 +82,7 @@ macro_rules! arena_types {
|
|||
[few] stability_index: rustc::middle::stability::Index<'tcx>,
|
||||
[few] features: syntax::feature_gate::Features,
|
||||
[few] all_traits: Vec<rustc::hir::def_id::DefId>,
|
||||
[few] privacy_access_levels: rustc::middle::privacy::AccessLevels,
|
||||
], $tcx);
|
||||
)
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ rustc_queries! {
|
|||
query check_match(_: DefId) -> () {}
|
||||
|
||||
/// Performs part of the privacy check and computes "access levels".
|
||||
query privacy_access_levels(_: CrateNum) -> Lrc<AccessLevels> {
|
||||
query privacy_access_levels(_: CrateNum) -> &'tcx AccessLevels {
|
||||
eval_always
|
||||
desc { "privacy access levels" }
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ use rustc::ty::query::Providers;
|
|||
use rustc::ty::subst::InternalSubsts;
|
||||
use rustc::util::nodemap::HirIdSet;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use syntax::ast::Ident;
|
||||
use syntax::attr;
|
||||
use syntax::symbol::{kw, sym};
|
||||
|
@ -1851,7 +1850,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
|
|||
fn privacy_access_levels<'tcx>(
|
||||
tcx: TyCtxt<'_, 'tcx, 'tcx>,
|
||||
krate: CrateNum,
|
||||
) -> Lrc<AccessLevels> {
|
||||
) -> &'tcx AccessLevels {
|
||||
assert_eq!(krate, LOCAL_CRATE);
|
||||
|
||||
// Build up a set of all exported items in the AST. This is a set of all
|
||||
|
@ -1872,7 +1871,7 @@ fn privacy_access_levels<'tcx>(
|
|||
}
|
||||
visitor.update(hir::CRATE_HIR_ID, Some(AccessLevel::Public));
|
||||
|
||||
Lrc::new(visitor.access_levels)
|
||||
tcx.arena.alloc(visitor.access_levels)
|
||||
}
|
||||
|
||||
fn check_private_in_public<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, krate: CrateNum) {
|
||||
|
|
|
@ -24,7 +24,6 @@ use rustc::session::config::{CrateType, Input, OutputType};
|
|||
use rustc::ty::{self, DefIdTree, TyCtxt};
|
||||
use rustc::{bug, span_bug};
|
||||
use rustc_codegen_utils::link::{filename_for_metadata, out_filename};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::default::Default;
|
||||
|
@ -1120,7 +1119,7 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(
|
|||
// fallback in case the access levels couldn't have been correctly computed.
|
||||
let access_levels = match tcx.sess.compile_status() {
|
||||
Ok(..) => tcx.privacy_access_levels(LOCAL_CRATE),
|
||||
Err(..) => Lrc::new(AccessLevels::default()),
|
||||
Err(..) => tcx.arena.alloc(AccessLevels::default()),
|
||||
};
|
||||
|
||||
let save_ctxt = SaveContext {
|
||||
|
|
Loading…
Add table
Reference in a new issue