Skip to content
Permalink
Browse files

Update privacy_access_levels

  • Loading branch information...
Zoxc committed Dec 1, 2018
1 parent 5751fcc commit fb578794b0da323c963906555a5afe126f2d8644
Showing with 5 additions and 6 deletions.
  1. +1 −0 src/librustc/arena.rs
  2. +1 −1 src/librustc/query/mod.rs
  3. +2 −3 src/librustc_privacy/lib.rs
  4. +1 −2 src/librustc_save_analysis/lib.rs
@@ -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 {

0 comments on commit fb57879

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