Skip to content

Commit

Permalink
Require the metadata loader to be thread-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 12, 2018
1 parent e5acb0c commit 37e897f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/librustc_metadata/cstore.rs
Expand Up @@ -93,11 +93,11 @@ pub struct CStore {
metas: RefCell<IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>>,
/// Map from NodeId's of local extern crate statements to crate numbers
extern_mod_crate_map: RefCell<NodeMap<CrateNum>>,
pub metadata_loader: Box<MetadataLoader>,
pub metadata_loader: Box<MetadataLoader + Sync>,
}

impl CStore {
pub fn new(metadata_loader: Box<MetadataLoader>) -> CStore {
pub fn new(metadata_loader: Box<MetadataLoader + Sync>) -> CStore {
CStore {
metas: RefCell::new(IndexVec::new()),
extern_mod_crate_map: RefCell::new(FxHashMap()),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/lib.rs
Expand Up @@ -200,7 +200,7 @@ impl TransCrate for LlvmTransCrate {
target_features(sess)
}

fn metadata_loader(&self) -> Box<MetadataLoader> {
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
box metadata::LlvmMetadataLoader
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_trans_utils/trans_crate.rs
Expand Up @@ -58,7 +58,7 @@ pub trait TransCrate {
fn print_version(&self) {}
fn diagnostics(&self) -> &[(&'static str, &'static str)] { &[] }

fn metadata_loader(&self) -> Box<MetadataLoader>;
fn metadata_loader(&self) -> Box<MetadataLoader + Sync>;
fn provide(&self, _providers: &mut Providers);
fn provide_extern(&self, _providers: &mut Providers);
fn trans_crate<'a, 'tcx>(
Expand All @@ -84,7 +84,7 @@ pub trait TransCrate {
pub struct DummyTransCrate;

impl TransCrate for DummyTransCrate {
fn metadata_loader(&self) -> Box<MetadataLoader> {
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
box DummyMetadataLoader(())
}

Expand Down Expand Up @@ -195,7 +195,7 @@ impl TransCrate for MetadataOnlyTransCrate {
}
}

fn metadata_loader(&self) -> Box<MetadataLoader> {
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
box NoLlvmMetadataLoader
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make/hotplug_codegen_backend/the_backend.rs
Expand Up @@ -28,7 +28,7 @@ use rustc_trans_utils::trans_crate::{TransCrate, MetadataOnlyTransCrate};
struct TheBackend(Box<TransCrate>);

impl TransCrate for TheBackend {
fn metadata_loader(&self) -> Box<MetadataLoader> {
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
self.0.metadata_loader()
}

Expand Down

0 comments on commit 37e897f

Please sign in to comment.