mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
rustc: Add a convenience alias for dyn MetadataLoader + Sync
This commit is contained in:
parent
175d325ccb
commit
222503a354
@ -191,6 +191,8 @@ pub trait MetadataLoader {
|
||||
-> Result<MetadataRef, String>;
|
||||
}
|
||||
|
||||
pub type MetadataLoaderDyn = dyn MetadataLoader + Sync;
|
||||
|
||||
/// A store of Rust crates, through which their metadata can be accessed.
|
||||
///
|
||||
/// Note that this trait should probably not be expanding today. All new
|
||||
|
@ -56,7 +56,7 @@ use std::sync::Arc;
|
||||
use std::ffi::CStr;
|
||||
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc::middle::cstore::{EncodedMetadata, MetadataLoader};
|
||||
use rustc::middle::cstore::{EncodedMetadata, MetadataLoaderDyn};
|
||||
use rustc::session::Session;
|
||||
use rustc::session::config::{OutputFilenames, OutputType, PrintRequest, OptLevel};
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
@ -260,7 +260,7 @@ impl CodegenBackend for LlvmCodegenBackend {
|
||||
target_features(sess)
|
||||
}
|
||||
|
||||
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
|
||||
fn metadata_loader(&self) -> Box<MetadataLoaderDyn> {
|
||||
box metadata::LlvmMetadataLoader
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ use rustc::util::common::ErrorReported;
|
||||
use rustc::session::config::{OutputFilenames, PrintRequest};
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::middle::cstore::{EncodedMetadata, MetadataLoader};
|
||||
use rustc::middle::cstore::{EncodedMetadata, MetadataLoaderDyn};
|
||||
use rustc::dep_graph::DepGraph;
|
||||
|
||||
pub use rustc_data_structures::sync::MetadataRef;
|
||||
@ -26,7 +26,7 @@ pub trait CodegenBackend {
|
||||
fn print_passes(&self) {}
|
||||
fn print_version(&self) {}
|
||||
|
||||
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync>;
|
||||
fn metadata_loader(&self) -> Box<MetadataLoaderDyn>;
|
||||
fn provide(&self, _providers: &mut Providers<'_>);
|
||||
fn provide_extern(&self, _providers: &mut Providers<'_>);
|
||||
fn codegen_crate<'tcx>(
|
||||
|
@ -5,7 +5,7 @@ use crate::schema;
|
||||
use rustc::dep_graph::DepNodeIndex;
|
||||
use rustc::hir::def_id::{CrateNum, DefIndex};
|
||||
use rustc::hir::map::definitions::DefPathTable;
|
||||
use rustc::middle::cstore::{CrateSource, DepKind, ExternCrate, MetadataLoader};
|
||||
use rustc::middle::cstore::{CrateSource, DepKind, ExternCrate, MetadataLoaderDyn};
|
||||
use rustc::mir::interpret::AllocDecodingState;
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc::util::nodemap::FxHashMap;
|
||||
@ -96,7 +96,7 @@ pub struct CrateMetadata {
|
||||
|
||||
pub struct CStore {
|
||||
metas: RwLock<IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>>,
|
||||
crate metadata_loader: Box<dyn MetadataLoader + Sync>,
|
||||
crate metadata_loader: Box<MetadataLoaderDyn>,
|
||||
}
|
||||
|
||||
pub enum LoadedMacro {
|
||||
@ -105,7 +105,7 @@ pub enum LoadedMacro {
|
||||
}
|
||||
|
||||
impl CStore {
|
||||
pub fn new(metadata_loader: Box<dyn MetadataLoader + Sync>) -> CStore {
|
||||
pub fn new(metadata_loader: Box<MetadataLoaderDyn>) -> CStore {
|
||||
CStore {
|
||||
// We add an empty entry for LOCAL_CRATE (which maps to zero) in
|
||||
// order to make array indices in `metas` match with the
|
||||
|
@ -9,14 +9,14 @@ extern crate rustc_target;
|
||||
extern crate rustc_driver;
|
||||
|
||||
use std::any::Any;
|
||||
use std::sync::{Arc, mpsc};
|
||||
use std::sync::Arc;
|
||||
use std::path::Path;
|
||||
use syntax::symbol::Symbol;
|
||||
use rustc::session::Session;
|
||||
use rustc::session::config::OutputFilenames;
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc::ty::query::Providers;
|
||||
use rustc::middle::cstore::{EncodedMetadata, MetadataLoader};
|
||||
use rustc::middle::cstore::{EncodedMetadata, MetadataLoader, MetadataLoaderDyn};
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc::util::common::ErrorReported;
|
||||
use rustc_codegen_utils::codegen_backend::CodegenBackend;
|
||||
@ -41,7 +41,7 @@ impl MetadataLoader for NoLlvmMetadataLoader {
|
||||
struct TheBackend;
|
||||
|
||||
impl CodegenBackend for TheBackend {
|
||||
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
|
||||
fn metadata_loader(&self) -> Box<MetadataLoaderDyn> {
|
||||
Box::new(NoLlvmMetadataLoader)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user