From 3df199680a34b28b8eeb023a4e26dd6b40c3f9df Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 3 Mar 2018 06:19:15 +0100 Subject: [PATCH] Add Sync bounds to the crate store --- src/librustc/middle/cstore.rs | 4 +++- src/librustc/ty/context.rs | 6 +++--- src/librustc_driver/driver.rs | 4 ++-- src/librustc_driver/lib.rs | 2 ++ src/librustc_driver/pretty.rs | 8 ++++---- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 4400ebc294f..61c8470b616 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -38,7 +38,7 @@ 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 @@ fn encode_metadata<'a, 'tcx>(&self, 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) { let mut err_count = 0; diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index f224f87da0a..31639d27054 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -26,7 +26,7 @@ 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 @@ fn is_global(self) -> bool { /// 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(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>, diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 1e74039503d..942dd771cf9 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -20,7 +20,7 @@ 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, diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index a1052ca6c3c..ca2ae771122 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -27,6 +27,8 @@ #![feature(rustc_stack_internals)] #![feature(no_debug)] +#![recursion_limit="256"] + extern crate arena; extern crate getopts; extern crate graphviz; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 70b73ebb8cd..108b4762338 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -20,7 +20,7 @@ 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 @@ fn call_with_pp_support<'tcx, A, F>(&self, } 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, -- 2.44.0