mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-18 18:04:13 +00:00
Warn and error about some things and make METADATA_FILENAME an &str
This commit is contained in:
parent
9ceb1a170b
commit
c88353c942
14
src/lib.rs
14
src/lib.rs
@ -73,7 +73,7 @@ mod prelude {
|
||||
|
||||
pub use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||
pub use rustc::mir::{self, interpret::AllocId, *};
|
||||
pub use rustc::session::{config::CrateType, Session};
|
||||
pub use rustc::session::{config::{CrateType, Lto}, Session};
|
||||
pub use rustc::ty::layout::{self, Abi, LayoutOf, Scalar, Size, TyLayout};
|
||||
pub use rustc::ty::{
|
||||
self, subst::Substs, FnSig, Instance, InstanceDef, ParamEnv, PolyFnSig, Ty, TyCtxt,
|
||||
@ -143,6 +143,18 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||
}
|
||||
}
|
||||
}
|
||||
match sess.lto() {
|
||||
Lto::Fat | Lto::Thin | Lto::ThinLocal => {
|
||||
sess.warn("Rustc codegen cranelift doesn't support lto");
|
||||
}
|
||||
Lto::No => {},
|
||||
}
|
||||
if sess.opts.cg.rpath {
|
||||
sess.err("rpath is not yet supported");
|
||||
}
|
||||
if sess.opts.debugging_opts.pgo_gen.is_some() {
|
||||
sess.err("pgo is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
|
||||
|
@ -22,7 +22,7 @@ pub(crate) fn link_rlib(sess: &Session, res: &crate::CodegenResults, output_name
|
||||
builder
|
||||
.append(
|
||||
&ar::Header::new(
|
||||
crate::metadata::METADATA_FILENAME.to_vec(),
|
||||
crate::metadata::METADATA_FILENAME.as_bytes().to_vec(),
|
||||
res.metadata.len() as u64,
|
||||
),
|
||||
::std::io::Cursor::new(res.metadata.clone()),
|
||||
|
@ -3,7 +3,7 @@ use rustc_data_structures::owning_ref::{self, OwningRef};
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
||||
pub const METADATA_FILENAME: &'static [u8] = b"rust.metadata.bin" as &[u8];
|
||||
pub const METADATA_FILENAME: &str = "rust.metadata.bin";
|
||||
|
||||
pub struct CraneliftMetadataLoader;
|
||||
|
||||
@ -17,7 +17,7 @@ impl MetadataLoader for CraneliftMetadataLoader {
|
||||
// Iterate over all entries in the archive:
|
||||
while let Some(entry_result) = archive.next_entry() {
|
||||
let mut entry = entry_result.map_err(|e| format!("{:?}", e))?;
|
||||
if entry.header().identifier() == METADATA_FILENAME {
|
||||
if entry.header().identifier() == METADATA_FILENAME.as_bytes() {
|
||||
let mut buf = Vec::new();
|
||||
::std::io::copy(&mut entry, &mut buf).map_err(|e| format!("{:?}", e))?;
|
||||
let buf: OwningRef<Vec<u8>, [u8]> = OwningRef::new(buf).into();
|
||||
|
Loading…
Reference in New Issue
Block a user