Fix some 2018 edition idioms

This commit is contained in:
bjorn3 2018-11-17 18:23:52 +01:00
parent 16334be18e
commit 06202c007c
7 changed files with 12 additions and 24 deletions

View File

@ -63,7 +63,7 @@ pub fn codegen(module: &mut Module<impl Backend + 'static>, kind: AllocatorKind)
ctx.func = Function::with_name_signature(ExternalName::user(0, 0), sig.clone());
{
let mut func_ctx = FunctionBuilderContext::new();
let mut bcx: FunctionBuilder = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
let ebb = bcx.create_ebb();
bcx.switch_to_block(ebb);

View File

@ -2,7 +2,7 @@ use crate::prelude::*;
use rustc::mir::StatementKind::*;
bitflags! {
bitflags::bitflags! {
pub struct Flags: u8 {
const NOT_SSA = 0b00000001;
}

View File

@ -74,7 +74,7 @@ fn trans_fn<'a, 'tcx: 'a>(
// Step 3. Make FunctionBuilder
let mut func = Function::with_name_signature(ExternalName::user(0, 0), sig);
let mut func_ctx = FunctionBuilderContext::new();
let mut bcx: FunctionBuilder = FunctionBuilder::new(&mut func, &mut func_ctx);
let mut bcx = FunctionBuilder::new(&mut func, &mut func_ctx);
// Step 4. Predefine ebb's
let start_ebb = bcx.create_ebb();

View File

@ -603,7 +603,7 @@ pub fn clif_intcast<'a, 'tcx: 'a>(
}
}
pub struct FunctionCx<'a, 'tcx: 'a, B: Backend + 'a> {
pub struct FunctionCx<'a, 'tcx: 'a, B: Backend> {
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub module: &'a mut Module<B>,
pub pointer_type: Type, // Cached from module

View File

@ -7,32 +7,17 @@
)]
#![allow(intra_doc_link_resolution_failure)]
extern crate byteorder;
extern crate syntax;
#[macro_use]
extern crate rustc;
extern crate rustc_allocator;
extern crate rustc_codegen_utils;
extern crate rustc_incremental;
extern crate rustc_mir;
extern crate rustc_target;
#[macro_use]
extern crate rustc_data_structures;
extern crate rustc_fs_util;
#[macro_use]
extern crate log;
extern crate ar;
#[macro_use]
extern crate bitflags;
extern crate faerie;
//extern crate goblin;
extern crate cranelift;
extern crate cranelift_faerie;
extern crate cranelift_module;
extern crate cranelift_simplejit;
extern crate target_lexicon;
use std::any::Any;
use std::fs::File;
use std::sync::mpsc;
@ -84,6 +69,7 @@ mod prelude {
pub use syntax::ast::{FloatTy, IntTy, UintTy};
pub use syntax::source_map::DUMMY_SP;
pub use rustc::bug;
pub use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
pub use rustc::mir::{self, interpret::AllocId, *};
pub use rustc::session::{
@ -291,7 +277,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
}
}
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
Box::new(crate::metadata::CraneliftMetadataLoader)
}
@ -308,8 +294,8 @@ impl CodegenBackend for CraneliftCodegenBackend {
fn codegen_crate<'a, 'tcx>(
&self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
_rx: mpsc::Receiver<Box<Any + Send>>,
) -> Box<Any> {
_rx: mpsc::Receiver<Box<dyn Any + Send>>,
) -> Box<dyn Any> {
if !tcx.sess.crate_types.get().contains(&CrateType::Executable)
&& std::env::var("SHOULD_RUN").is_ok()
{
@ -436,7 +422,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
fn join_codegen_and_link(
&self,
res: Box<Any>,
res: Box<dyn Any>,
sess: &Session,
_dep_graph: &DepGraph,
outputs: &OutputFilenames,
@ -512,6 +498,6 @@ fn save_incremental<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
/// This is the entrypoint for a hot plugged rustc_codegen_cranelift
#[no_mangle]
pub fn __rustc_codegen_backend() -> Box<CodegenBackend> {
pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
Box::new(CraneliftCodegenBackend)
}

View File

@ -9,6 +9,7 @@ use std::path::{Path, PathBuf};
use std::process::{Output, Stdio};
use cc::windows_registry;
use log::info;
use rustc::middle::cstore::{NativeLibrary, NativeLibraryKind};
use rustc::middle::dependency_format::Linkage;

View File

@ -1,5 +1,6 @@
use rustc::middle::cstore::MetadataLoader;
use rustc_data_structures::owning_ref::{self, OwningRef};
use rustc_data_structures::rustc_erase_owner;
use std::fs::File;
use std::path::Path;