diff --git a/patches/0016-Apply-rust-lang-pr61828.patch b/patches/0016-Apply-rust-lang-pr61828.patch deleted file mode 100644 index 14abc18eea6..00000000000 --- a/patches/0016-Apply-rust-lang-pr61828.patch +++ /dev/null @@ -1,23 +0,0 @@ -From e5f840ecb5093e4f5e96f76119d5e3b733e660f3 Mon Sep 17 00:00:00 2001 -From: Ralf Jung -Date: Fri, 14 Jun 2019 11:00:37 +0200 -Subject: [PATCH] make sure we use cfg-if as a std dependency - ---- - src/libstd/Cargo.toml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml -index a170dae2b08c..38df1f26d95f 100644 ---- a/src/libstd/Cargo.toml -+++ b/src/libstd/Cargo.toml -@@ -15,7 +15,7 @@ crate-type = ["dylib", "rlib"] - - [dependencies] - alloc = { path = "../liballoc" } --cfg-if = "0.1.8" -+cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] } - panic_unwind = { path = "../libpanic_unwind", optional = true } - panic_abort = { path = "../libpanic_abort" } - core = { path = "../libcore" } - diff --git a/src/abi.rs b/src/abi.rs index 033d41c5f20..bb76e48ad72 100644 --- a/src/abi.rs +++ b/src/abi.rs @@ -40,7 +40,7 @@ pub fn scalar_to_clif_type(tcx: TyCtxt, scalar: Scalar) -> Type { } fn get_pass_mode<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, ) -> PassMode { let layout = tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap(); @@ -76,7 +76,7 @@ fn adjust_arg_for_abi<'a, 'tcx: 'a>( } } -fn clif_sig_from_fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sig: FnSig<'tcx>) -> Signature { +fn clif_sig_from_fn_sig<'tcx>(tcx: TyCtxt<'tcx>, sig: FnSig<'tcx>) -> Signature { let (call_conv, inputs, output): (CallConv, Vec, Ty) = match sig.abi { Abi::Rust => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()), Abi::C => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()), @@ -129,7 +129,7 @@ fn clif_sig_from_fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sig: FnSig<'tcx>) -> Sign } pub fn get_function_name_and_sig<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, inst: Instance<'tcx>, support_vararg: bool, ) -> (String, Signature) { @@ -144,7 +144,7 @@ pub fn get_function_name_and_sig<'tcx>( /// Instance must be monomorphized pub fn import_function<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, module: &mut Module, inst: Instance<'tcx>, ) -> FuncId { diff --git a/src/base.rs b/src/base.rs index aec7f3f77e8..26b6e39b341 100644 --- a/src/base.rs +++ b/src/base.rs @@ -18,7 +18,7 @@ pub fn trans_fn<'a, 'clif, 'tcx: 'a, B: Backend + 'static>( // Check sig for u128 and i128 let fn_sig = tcx.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &instance.fn_sig(tcx)); - struct UI128Visitor<'tcx>(TyCtxt<'tcx, 'tcx>, bool); + struct UI128Visitor<'tcx>(TyCtxt<'tcx>, bool); impl<'tcx> rustc::ty::fold::TypeVisitor<'tcx> for UI128Visitor<'tcx> { fn visit_ty(&mut self, t: Ty<'tcx>) -> bool { diff --git a/src/common.rs b/src/common.rs index 700c6ec75ec..bffa526c8b4 100644 --- a/src/common.rs +++ b/src/common.rs @@ -17,8 +17,8 @@ pub fn pointer_ty(tcx: TyCtxt) -> types::Type { } } -pub fn clif_type_from_ty<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx>, +pub fn clif_type_from_ty<'tcx>( + tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, ) -> Option { Some(match ty.sty { @@ -95,7 +95,7 @@ pub fn clif_intcast<'a, 'tcx: 'a>( pub struct FunctionCx<'a, 'tcx: 'a, B: Backend> { // FIXME use a reference to `CodegenCx` instead of `tcx`, `module` and `constants` and `caches` - pub tcx: TyCtxt<'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx>, pub module: &'a mut Module, pub pointer_type: Type, // Cached from module @@ -123,7 +123,7 @@ fn layout_of(&self, ty: Ty<'tcx>) -> TyLayout<'tcx> { } impl<'a, 'tcx, B: Backend + 'a> layout::HasTyCtxt<'tcx> for FunctionCx<'a, 'tcx, B> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx> { self.tcx } } diff --git a/src/constant.rs b/src/constant.rs index 068d08097dd..60c583fd67c 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -26,10 +26,10 @@ enum TodoItem { } impl ConstantCx { - pub fn finalize<'a, 'tcx: 'a, B: Backend>( + pub fn finalize( mut self, - tcx: TyCtxt<'tcx, 'tcx>, - module: &mut Module, + tcx: TyCtxt<'_>, + module: &mut Module, ) { //println!("todo {:?}", self.todo); define_all_allocs(tcx, module, &mut self); @@ -38,7 +38,7 @@ pub fn finalize<'a, 'tcx: 'a, B: Backend>( } } -pub fn codegen_static<'a, 'tcx: 'a>(ccx: &mut ConstantCx, def_id: DefId) { +pub fn codegen_static(ccx: &mut ConstantCx, def_id: DefId) { ccx.todo.insert(TodoItem::Static(def_id)); } @@ -177,15 +177,15 @@ fn trans_const_place<'a, 'tcx: 'a>( cplace_for_dataid(fx, const_.ty, data_id) } -fn data_id_for_alloc_id(module: &mut Module, alloc_id: AllocId) -> DataId { +fn data_id_for_alloc_id(module: &mut Module, alloc_id: AllocId) -> DataId { module .declare_data(&format!("__alloc_{}", alloc_id.0), Linkage::Local, false, None) .unwrap() } -fn data_id_for_static<'a, 'tcx: 'a, B: Backend>( - tcx: TyCtxt<'tcx, 'tcx>, - module: &mut Module, +fn data_id_for_static( + tcx: TyCtxt<'_>, + module: &mut Module, def_id: DefId, linkage: Linkage, ) -> DataId { @@ -237,9 +237,9 @@ fn cplace_for_dataid<'a, 'tcx: 'a>( CPlace::for_addr(global_ptr, layout) } -fn define_all_allocs<'a, 'tcx: 'a, B: Backend + 'a>( - tcx: TyCtxt<'tcx, 'tcx>, - module: &mut Module, +fn define_all_allocs( + tcx: TyCtxt<'_>, + module: &mut Module, cx: &mut ConstantCx, ) { let memory = Memory::::new(tcx.at(DUMMY_SP)); @@ -374,7 +374,7 @@ fn call_intrinsic( fn find_foreign_static( _: DefId, - _: ::rustc::ty::query::TyCtxtAt<'tcx, 'tcx>, + _: ::rustc::ty::query::TyCtxtAt<'tcx>, ) -> InterpResult<'tcx, Cow<'tcx, Allocation>> { panic!(); } diff --git a/src/debuginfo.rs b/src/debuginfo.rs index 6d1726dd7b4..ab63d125945 100644 --- a/src/debuginfo.rs +++ b/src/debuginfo.rs @@ -92,7 +92,7 @@ pub struct DebugContext<'tcx> { _dummy: PhantomData<&'tcx ()>, } -impl<'a, 'tcx: 'a> DebugContext<'tcx> { +impl<'tcx> DebugContext<'tcx> { pub fn new(tcx: TyCtxt, address_size: u8) -> Self { let encoding = Encoding { format: Format::Dwarf32, @@ -155,7 +155,7 @@ pub fn new(tcx: TyCtxt, address_size: u8) -> Self { } } - fn emit_location(&mut self, tcx: TyCtxt<'tcx, 'tcx>, entry_id: UnitEntryId, span: Span) { + fn emit_location(&mut self, tcx: TyCtxt<'tcx>, entry_id: UnitEntryId, span: Span) { let loc = tcx.sess.source_map().lookup_char_pos(span.lo()); let file_id = line_program_add_file( @@ -230,9 +230,9 @@ pub struct FunctionDebugContext<'a, 'tcx> { mir_span: Span, } -impl<'a, 'b, 'tcx: 'b> FunctionDebugContext<'a, 'tcx> { +impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, debug_context: &'a mut DebugContext<'tcx>, mir: &Body, name: &str, diff --git a/src/driver.rs b/src/driver.rs index 81c8100d3da..413f9f4e048 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -13,8 +13,8 @@ use crate::prelude::*; -pub fn codegen_crate<'a, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, +pub fn codegen_crate( + tcx: TyCtxt<'_>, metadata: EncodedMetadata, need_metadata_module: bool, ) -> Box { @@ -45,7 +45,7 @@ pub fn codegen_crate<'a, 'tcx>( } #[cfg(not(target_arch = "wasm32"))] -fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, log: &mut Option) -> ! { +fn run_jit(tcx: TyCtxt<'_>, log: &mut Option) -> ! { use cranelift_simplejit::{SimpleJITBackend, SimpleJITBuilder}; let mut jit_module: Module = Module::new(SimpleJITBuilder::new( @@ -95,8 +95,8 @@ fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, log: &mut Option) -> ! { std::process::exit(ret); } -fn run_aot<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx>, +fn run_aot( + tcx: TyCtxt<'_>, metadata: EncodedMetadata, need_metadata_module: bool, log: &mut Option, @@ -224,8 +224,8 @@ fn run_aot<'a, 'tcx: 'a>( }) } -fn codegen_cgus<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx>, +fn codegen_cgus<'tcx>( + tcx: TyCtxt<'tcx>, module: &mut Module, debug: &mut Option>, log: &mut Option, @@ -242,8 +242,8 @@ fn codegen_cgus<'a, 'tcx: 'a>( crate::main_shim::maybe_create_entry_wrapper(tcx, module); } -fn codegen_mono_items<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx>, +fn codegen_mono_items<'tcx>( + tcx: TyCtxt<'tcx>, module: &mut Module, debug_context: Option<&mut DebugContext<'tcx>>, log: &mut Option, @@ -262,7 +262,7 @@ fn codegen_mono_items<'a, 'tcx: 'a>( }); } -fn trans_mono_item<'a, 'clif, 'tcx: 'a, B: Backend + 'static>( +fn trans_mono_item<'clif, 'tcx, B: Backend + 'static>( cx: &mut crate::CodegenCx<'clif, 'tcx, B>, mono_item: MonoItem<'tcx>, linkage: Linkage, diff --git a/src/lib.rs b/src/lib.rs index 897e8a1e367..0d7cab1f8e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -113,7 +113,7 @@ pub struct Caches<'tcx> { pub vtables: HashMap<(Ty<'tcx>, Option>), DataId>, } -impl<'tcx> Default for Caches<'tcx> { +impl Default for Caches<'_> { fn default() -> Self { Caches { context: Context::new(), @@ -123,7 +123,7 @@ fn default() -> Self { } pub struct CodegenCx<'clif, 'tcx, B: Backend + 'static> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, module: &'clif mut Module, ccx: ConstantCx, caches: Caches<'tcx>, @@ -132,7 +132,7 @@ pub struct CodegenCx<'clif, 'tcx, B: Backend + 'static> { impl<'clif, 'tcx, B: Backend + 'static> CodegenCx<'clif, 'tcx, B> { fn new( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, module: &'clif mut Module, debug_context: Option<&'clif mut DebugContext<'tcx>>, ) -> Self { @@ -193,9 +193,9 @@ fn provide_extern(&self, providers: &mut Providers) { rustc_codegen_ssa::back::symbol_export::provide_extern(providers); } - fn codegen_crate<'a, 'tcx>( + fn codegen_crate<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, _rx: mpsc::Receiver>, diff --git a/src/main_shim.rs b/src/main_shim.rs index 6653951fd68..1dae9e32baa 100644 --- a/src/main_shim.rs +++ b/src/main_shim.rs @@ -2,8 +2,8 @@ /// Create the `main` function which will initialize the rust runtime and call /// users main function. -pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx>, +pub fn maybe_create_entry_wrapper( + tcx: TyCtxt<'_>, module: &mut Module, ) { use rustc::middle::lang_items::StartFnLangItem; @@ -22,8 +22,8 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a>( create_entry_fn(tcx, module, main_def_id, use_start_lang_item);; - fn create_entry_fn<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx>, + fn create_entry_fn( + tcx: TyCtxt<'_>, m: &mut Module, rust_main_def_id: DefId, use_start_lang_item: bool, diff --git a/src/metadata.rs b/src/metadata.rs index 9f6fccdc71e..265a160e7a8 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -48,8 +48,8 @@ fn get_dylib_metadata( } // Adapted from https://github.com/rust-lang/rust/blob/da573206f87b5510de4b0ee1a9c044127e409bd3/src/librustc_codegen_llvm/base.rs#L47-L112 -pub fn write_metadata<'a, 'gcx>( - tcx: TyCtxt<'gcx, 'gcx>, +pub fn write_metadata( + tcx: TyCtxt<'_>, artifact: &mut faerie::Artifact ) -> EncodedMetadata { use std::io::Write; diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs index 677cb4705bc..57fcebe79c2 100644 --- a/src/pretty_clif.rs +++ b/src/pretty_clif.rs @@ -77,7 +77,7 @@ pub struct CommentWriter { } impl CommentWriter { - pub fn new<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) -> Self { + pub fn new<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> Self { CommentWriter { global_comments: vec![ format!("symbol {}", tcx.symbol_name(instance).as_str()), @@ -91,7 +91,7 @@ pub fn new<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) -> S } } -impl<'a> FuncWriter for &'a CommentWriter { +impl FuncWriter for &'_ CommentWriter { fn write_preamble( &mut self, w: &mut dyn fmt::Write, @@ -193,8 +193,8 @@ pub fn add_comment<'s, S: Into>>(&mut self, inst: Inst, comment: S) } } -pub fn write_clif_file<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx>, +pub fn write_clif_file<'tcx>( + tcx: TyCtxt<'tcx>, postfix: &str, instance: Instance<'tcx>, func: &ir::Function,