Add Sync bounds to the crate store

This commit is contained in:
John Kåre Alsaker 2018-03-03 06:19:15 +01:00
parent 6968f4c8a3
commit 3df199680a
5 changed files with 14 additions and 10 deletions

View file

@ -38,7 +38,7 @@ use syntax::ext::base::SyntaxExtension;
use syntax::symbol::Symbol;
use syntax_pos::Span;
use rustc_target::spec::Target;
use rustc_data_structures::sync::{MetadataRef, Lrc};
use rustc_data_structures::sync::{self, MetadataRef, Lrc};
pub use self::NativeLibraryKind::*;
@ -255,6 +255,8 @@ pub trait CrateStore {
fn metadata_encoding_version(&self) -> &[u8];
}
pub type CrateStoreDyn = CrateStore + sync::Sync;
// FIXME: find a better place for this?
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
let mut err_count = 0;

View file

@ -26,7 +26,7 @@ use lint::{self, Lint};
use ich::{StableHashingContext, NodeIdHashingMode};
use infer::canonical::{CanonicalVarInfo, CanonicalVarInfos};
use infer::outlives::free_region_map::FreeRegionMap;
use middle::cstore::{CrateStore, LinkMeta};
use middle::cstore::{CrateStoreDyn, LinkMeta};
use middle::cstore::EncodedMetadata;
use middle::lang_items;
use middle::resolve_lifetime::{self, ObjectLifetimeDefault};
@ -852,7 +852,7 @@ pub struct GlobalCtxt<'tcx> {
global_arenas: &'tcx GlobalArenas<'tcx>,
global_interners: CtxtInterners<'tcx>,
cstore: &'tcx dyn CrateStore,
cstore: &'tcx CrateStoreDyn,
pub sess: &'tcx Session,
@ -1188,7 +1188,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
/// value (types, substs, etc.) can only be used while `ty::tls` has a valid
/// reference to the context, to allow formatting values that need it.
pub fn create_and_enter<F, R>(s: &'tcx Session,
cstore: &'tcx dyn CrateStore,
cstore: &'tcx CrateStoreDyn,
local_providers: ty::maps::Providers<'tcx>,
extern_providers: ty::maps::Providers<'tcx>,
arenas: &'tcx AllArenas<'tcx>,

View file

@ -20,7 +20,7 @@ use rustc::session::config::{self, Input, OutputFilenames, OutputType};
use rustc::session::search_paths::PathKind;
use rustc::lint;
use rustc::middle::{self, reachable, resolve_lifetime, stability};
use rustc::middle::cstore::CrateStore;
use rustc::middle::cstore::CrateStoreDyn;
use rustc::middle::privacy::AccessLevels;
use rustc::ty::{self, AllArenas, Resolutions, TyCtxt};
use rustc::traits;
@ -1047,7 +1047,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(
trans: &TransCrate,
control: &CompileController,
sess: &'tcx Session,
cstore: &'tcx CrateStore,
cstore: &'tcx CrateStoreDyn,
hir_map: hir_map::Map<'tcx>,
mut analysis: ty::CrateAnalysis,
resolutions: Resolutions,

View file

@ -27,6 +27,8 @@
#![feature(rustc_stack_internals)]
#![feature(no_debug)]
#![recursion_limit="256"]
extern crate arena;
extern crate getopts;
extern crate graphviz;

View file

@ -20,7 +20,7 @@ use {abort_on_err, driver};
use rustc::ty::{self, TyCtxt, Resolutions, AllArenas};
use rustc::cfg;
use rustc::cfg::graphviz::LabelledCFG;
use rustc::middle::cstore::CrateStore;
use rustc::middle::cstore::CrateStoreDyn;
use rustc::session::Session;
use rustc::session::config::{Input, OutputFilenames};
use rustc_borrowck as borrowck;
@ -199,7 +199,7 @@ impl PpSourceMode {
}
fn call_with_pp_support_hir<'tcx, A, F>(&self,
sess: &'tcx Session,
cstore: &'tcx CrateStore,
cstore: &'tcx CrateStoreDyn,
hir_map: &hir_map::Map<'tcx>,
analysis: &ty::CrateAnalysis,
resolutions: &Resolutions,
@ -912,7 +912,7 @@ pub fn print_after_parsing(sess: &Session,
}
pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
cstore: &'tcx CrateStore,
cstore: &'tcx CrateStoreDyn,
hir_map: &hir_map::Map<'tcx>,
analysis: &ty::CrateAnalysis,
resolutions: &Resolutions,
@ -1068,7 +1068,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
// with a different callback than the standard driver, so that isn't easy.
// Instead, we call that function ourselves.
fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
cstore: &'a CrateStore,
cstore: &'a CrateStoreDyn,
hir_map: &hir_map::Map<'tcx>,
analysis: &ty::CrateAnalysis,
resolutions: &Resolutions,