Skip to content

Commit

Permalink
Remove unused feature gates from cg_llvm
Browse files Browse the repository at this point in the history
Also turns a few `box` into `Box::new`
  • Loading branch information
bjorn3 committed Feb 4, 2020
1 parent 095963f commit f9971c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 4 additions & 11 deletions src/librustc_codegen_llvm/lib.rs
Expand Up @@ -6,18 +6,11 @@

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_cstr_unchecked)]
#![feature(crate_visibility_modifier)]
#![feature(extern_types)]
#![feature(in_band_lifetimes)]
#![feature(libc)]
#![feature(nll)]
#![feature(optin_builtin_traits)]
#![feature(concat_idents)]
#![feature(link_args)]
#![feature(static_nobundle)]
#![feature(trusted_len)]
#![recursion_limit = "256"]

Expand Down Expand Up @@ -196,7 +189,7 @@ unsafe impl Sync for LlvmCodegenBackend {}

impl LlvmCodegenBackend {
pub fn new() -> Box<dyn CodegenBackend> {
box LlvmCodegenBackend(())
Box::new(LlvmCodegenBackend(()))
}
}

Expand Down Expand Up @@ -245,7 +238,7 @@ impl CodegenBackend for LlvmCodegenBackend {
}

fn metadata_loader(&self) -> Box<MetadataLoaderDyn> {
box metadata::LlvmMetadataLoader
Box::new(metadata::LlvmMetadataLoader)
}

fn provide(&self, providers: &mut ty::query::Providers<'_>) {
Expand All @@ -262,12 +255,12 @@ impl CodegenBackend for LlvmCodegenBackend {
metadata: EncodedMetadata,
need_metadata_module: bool,
) -> Box<dyn Any> {
box rustc_codegen_ssa::base::codegen_crate(
Box::new(rustc_codegen_ssa::base::codegen_crate(
LlvmCodegenBackend(()),
tcx,
metadata,
need_metadata_module,
)
))
}

fn join_codegen(
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/metadata.rs
Expand Up @@ -22,7 +22,7 @@ impl MetadataLoader for LlvmMetadataLoader {
// Use ArchiveRO for speed here, it's backed by LLVM and uses mmap
// internally to read the file. We also avoid even using a memcpy by
// just keeping the archive along while the metadata is in use.
let archive = ArchiveRO::open(filename).map(|ar| OwningRef::new(box ar)).map_err(|e| {
let archive = ArchiveRO::open(filename).map(|ar| OwningRef::new(Box::new(ar))).map_err(|e| {
debug!("llvm didn't like `{}`: {}", filename.display(), e);
format!("failed to read rlib metadata in '{}': {}", filename.display(), e)
})?;
Expand All @@ -44,7 +44,7 @@ impl MetadataLoader for LlvmMetadataLoader {
let buf = path_to_c_string(filename);
let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr())
.ok_or_else(|| format!("error reading library: '{}'", filename.display()))?;
let of = ObjectFile::new(mb).map(|of| OwningRef::new(box of)).ok_or_else(|| {
let of = ObjectFile::new(mb).map(|of| OwningRef::new(Box::new(of))).ok_or_else(|| {
format!("provided path not an object file: '{}'", filename.display())
})?;
let buf = of.try_map(|of| search_meta_section(of, target, filename))?;
Expand Down

0 comments on commit f9971c5

Please sign in to comment.