use std::path::Path;
use std::sync::mpsc;
-use rustc_data_structures::owning_ref::{ErasedBoxRef, OwningRef};
+use rustc_data_structures::owning_ref::OwningRef;
use rustc_data_structures::sync::Lrc;
use ar::{Archive, Builder, Header};
use flate2::Compression;
use rustc::middle::cstore::MetadataLoader;
use rustc::dep_graph::DepGraph;
use rustc_back::target::Target;
+use rustc_data_structures::fx::FxHashSet;
use rustc_mir::monomorphize::collector;
use link::{build_link_meta, out_filename};
+pub use rustc_data_structures::sync::MetadataRef;
+
pub trait TransCrate {
fn init(&self, _sess: &Session) {}
fn print(&self, _req: PrintRequest, _sess: &Session) {}
&self,
_target: &Target,
_filename: &Path
- ) -> Result<ErasedBoxRef<[u8]>, String> {
+ ) -> Result<MetadataRef, String> {
bug!("DummyMetadataLoader::get_rlib_metadata");
}
&self,
_target: &Target,
_filename: &Path
- ) -> Result<ErasedBoxRef<[u8]>, String> {
+ ) -> Result<MetadataRef, String> {
bug!("DummyMetadataLoader::get_dylib_metadata");
}
}
pub struct NoLlvmMetadataLoader;
impl MetadataLoader for NoLlvmMetadataLoader {
- fn get_rlib_metadata(&self, _: &Target, filename: &Path) -> Result<ErasedBoxRef<[u8]>, String> {
+ fn get_rlib_metadata(&self, _: &Target, filename: &Path) -> Result<MetadataRef, String> {
let file = File::open(filename)
.map_err(|e| format!("metadata file open err: {:?}", e))?;
let mut archive = Archive::new(file);
let mut buf = Vec::new();
io::copy(&mut entry, &mut buf).unwrap();
let buf: OwningRef<Vec<u8>, [u8]> = OwningRef::new(buf).into();
- return Ok(buf.map_owner_box().erase_owner());
+ return Ok(rustc_erase_owner!(buf.map_owner_box()));
}
}
&self,
_target: &Target,
_filename: &Path,
- ) -> Result<ErasedBoxRef<[u8]>, String> {
+ ) -> Result<MetadataRef, String> {
// FIXME: Support reading dylibs from llvm enabled rustc
self.get_rlib_metadata(_target, _filename)
}
fn provide(&self, providers: &mut Providers) {
::symbol_names::provide(providers);
- providers.target_features_enabled = |_tcx, _id| {
- Lrc::new(Vec::new()) // Just a dummy
+
+ providers.target_features_whitelist = |_tcx, _cnum| {
+ Lrc::new(FxHashSet()) // Just a dummy
};
}
fn provide_extern(&self, _providers: &mut Providers) {}
MonoItem::Fn(inst) => {
let def_id = inst.def_id();
if def_id.is_local() {
- let _ = tcx.export_name(def_id);
- let _ = tcx.contains_extern_indicator(def_id);
let _ = inst.def.is_inline(tcx);
- let attrs = inst.def.attrs(tcx);
- let _ =
- ::syntax::attr::find_inline_attr(Some(tcx.sess.diagnostic()), &attrs);
+ let _ = tcx.trans_fn_attrs(def_id);
}
}
_ => {}
tcx.sess.abort_if_errors();
let link_meta = build_link_meta(tcx.crate_hash(LOCAL_CRATE));
- let exported_symbols = ::find_exported_symbols(tcx);
- let metadata = tcx.encode_metadata(&link_meta, &exported_symbols);
+ let metadata = tcx.encode_metadata(&link_meta);
box OngoingCrateTranslation {
metadata: metadata,