From 1d34f2c22879886fcd452da096317861f8a0c9e6 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 25 Feb 2019 08:52:46 +0100 Subject: [PATCH] librustc_codegen_ssa: deny(elided_lifetimes_in_paths) --- src/librustc_codegen_ssa/back/command.rs | 2 +- src/librustc_codegen_ssa/back/linker.rs | 4 ++-- src/librustc_codegen_ssa/back/symbol_export.rs | 10 +++++----- src/librustc_codegen_ssa/back/write.rs | 18 +++++++++--------- src/librustc_codegen_ssa/base.rs | 10 +++++----- src/librustc_codegen_ssa/common.rs | 2 +- src/librustc_codegen_ssa/lib.rs | 1 - src/librustc_codegen_ssa/mir/operand.rs | 2 +- src/librustc_codegen_ssa/traits/backend.rs | 9 +++++++-- src/librustc_codegen_ssa/traits/builder.rs | 2 +- src/librustc_codegen_ssa/traits/debuginfo.rs | 4 ++-- 11 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/librustc_codegen_ssa/back/command.rs b/src/librustc_codegen_ssa/back/command.rs index bc484ace58463..78570cce57dd9 100644 --- a/src/librustc_codegen_ssa/back/command.rs +++ b/src/librustc_codegen_ssa/back/command.rs @@ -159,7 +159,7 @@ impl Command { } impl fmt::Debug for Command { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.command().fmt(f) } } diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 356bb8d50ad0d..1f4c5543fa9aa 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -25,7 +25,7 @@ pub struct LinkerInfo { } impl LinkerInfo { - pub fn new(tcx: TyCtxt) -> LinkerInfo { + pub fn new(tcx: TyCtxt<'_, '_, '_>) -> LinkerInfo { LinkerInfo { exports: tcx.sess.crate_types.borrow().iter().map(|&c| { (c, exported_symbols(tcx, c)) @@ -1052,7 +1052,7 @@ impl<'a> Linker for WasmLd<'a> { } } -fn exported_symbols(tcx: TyCtxt, crate_type: CrateType) -> Vec { +fn exported_symbols(tcx: TyCtxt<'_, '_, '_>, crate_type: CrateType) -> Vec { if let Some(ref exports) = tcx.sess.target.target.options.override_export_symbols { return exports.clone() } diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index c372892c521be..16f5880b13f5b 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -22,7 +22,7 @@ pub type ExportedSymbols = FxHashMap< Arc>, >; -pub fn threshold(tcx: TyCtxt) -> SymbolExportLevel { +pub fn threshold(tcx: TyCtxt<'_, '_, '_>) -> SymbolExportLevel { crates_export_threshold(&tcx.sess.crate_types.borrow()) } @@ -342,7 +342,7 @@ fn upstream_monomorphizations_for_provider<'a, 'tcx>( .cloned() } -fn is_unreachable_local_definition_provider(tcx: TyCtxt, def_id: DefId) -> bool { +fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> bool { if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { !tcx.reachable_set(LOCAL_CRATE).0.contains(&node_id) } else { @@ -351,7 +351,7 @@ fn is_unreachable_local_definition_provider(tcx: TyCtxt, def_id: DefId) -> bool } } -pub fn provide(providers: &mut Providers) { +pub fn provide(providers: &mut Providers<'_>) { providers.reachable_non_generics = reachable_non_generics_provider; providers.is_reachable_non_generic = is_reachable_non_generic_provider_local; providers.exported_symbols = exported_symbols_provider_local; @@ -359,12 +359,12 @@ pub fn provide(providers: &mut Providers) { providers.is_unreachable_local_definition = is_unreachable_local_definition_provider; } -pub fn provide_extern(providers: &mut Providers) { +pub fn provide_extern(providers: &mut Providers<'_>) { providers.is_reachable_non_generic = is_reachable_non_generic_provider_extern; providers.upstream_monomorphizations_for = upstream_monomorphizations_for_provider; } -fn symbol_export_level(tcx: TyCtxt, sym_def_id: DefId) -> SymbolExportLevel { +fn symbol_export_level(tcx: TyCtxt<'_, '_, '_>, sym_def_id: DefId) -> SymbolExportLevel { // We export anything that's not mangled at the "C" layer as it probably has // to do with ABI concerns. We do not, however, apply such treatment to // special symbols in the standard library for various plumbing between diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 20842553c2666..908ee95efcba3 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -321,7 +321,7 @@ fn need_pre_lto_bitcode_for_incr_comp(sess: &Session) -> bool { pub fn start_async_codegen( backend: B, - tcx: TyCtxt, + tcx: TyCtxt<'_, '_, '_>, time_graph: Option, metadata: EncodedMetadata, coordinator_receive: Receiver>, @@ -947,7 +947,7 @@ enum MainThreadWorkerState { fn start_executing_work( backend: B, - tcx: TyCtxt, + tcx: TyCtxt<'_, '_, '_>, crate_info: &CrateInfo, shared_emitter: SharedEmitter, codegen_worker_send: Sender>, @@ -1683,7 +1683,7 @@ impl SharedEmitter { } impl Emitter for SharedEmitter { - fn emit(&mut self, db: &DiagnosticBuilder) { + fn emit(&mut self, db: &DiagnosticBuilder<'_>) { drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic { msg: db.message(), code: db.code.clone(), @@ -1822,7 +1822,7 @@ impl OngoingCodegen { } pub fn submit_pre_codegened_module_to_llvm(&self, - tcx: TyCtxt, + tcx: TyCtxt<'_, '_, '_>, module: ModuleCodegen) { self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); @@ -1832,7 +1832,7 @@ impl OngoingCodegen { submit_codegened_module_to_llvm(&self.backend, tcx, module, cost); } - pub fn codegen_finished(&self, tcx: TyCtxt) { + pub fn codegen_finished(&self, tcx: TyCtxt<'_, '_, '_>) { self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); drop(self.coordinator_send.send(Box::new(Message::CodegenComplete::))); @@ -1871,7 +1871,7 @@ impl OngoingCodegen { pub fn submit_codegened_module_to_llvm( _backend: &B, - tcx: TyCtxt, + tcx: TyCtxt<'_, '_, '_>, module: ModuleCodegen, cost: u64 ) { @@ -1884,7 +1884,7 @@ pub fn submit_codegened_module_to_llvm( pub fn submit_post_lto_module_to_llvm( _backend: &B, - tcx: TyCtxt, + tcx: TyCtxt<'_, '_, '_>, module: CachedModuleCodegen ) { let llvm_work_item = WorkItem::CopyPostLtoArtifacts(module); @@ -1896,7 +1896,7 @@ pub fn submit_post_lto_module_to_llvm( pub fn submit_pre_lto_module_to_llvm( _backend: &B, - tcx: TyCtxt, + tcx: TyCtxt<'_, '_, '_>, module: CachedModuleCodegen ) { let filename = pre_lto_bitcode_filename(&module.name); @@ -1921,7 +1921,7 @@ pub fn pre_lto_bitcode_filename(module_name: &str) -> String { format!("{}.{}", module_name, PRE_LTO_BC_EXT) } -fn msvc_imps_needed(tcx: TyCtxt) -> bool { +fn msvc_imps_needed(tcx: TyCtxt<'_, '_, '_>) -> bool { // This should never be true (because it's not supported). If it is true, // something is wrong with commandline arg validation. assert!(!(tcx.sess.opts.cg.linker_plugin_lto.enabled() && diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 92f5c39fe5a18..fad41a11a82ba 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -370,7 +370,7 @@ pub fn from_immediate<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( pub fn to_immediate<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, val: Bx::Value, - layout: layout::TyLayout, + layout: layout::TyLayout<'_>, ) -> Bx::Value { if let layout::Abi::Scalar(ref scalar) = layout.abi { return to_immediate_scalar(bx, val, scalar); @@ -802,7 +802,7 @@ fn assert_and_save_dep_graph<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>) { } impl CrateInfo { - pub fn new(tcx: TyCtxt) -> CrateInfo { + pub fn new(tcx: TyCtxt<'_, '_, '_>) -> CrateInfo { let mut info = CrateInfo { panic_runtime: None, compiler_builtins: None, @@ -880,7 +880,7 @@ impl CrateInfo { return info } - fn load_wasm_imports(&mut self, tcx: TyCtxt, cnum: CrateNum) { + fn load_wasm_imports(&mut self, tcx: TyCtxt<'_, '_, '_>, cnum: CrateNum) { self.wasm_imports.extend(tcx.wasm_import_module_map(cnum).iter().map(|(&id, module)| { let instance = Instance::mono(tcx, id); let import_name = tcx.symbol_name(instance); @@ -890,13 +890,13 @@ impl CrateInfo { } } -fn is_codegened_item(tcx: TyCtxt, id: DefId) -> bool { +fn is_codegened_item(tcx: TyCtxt<'_, '_, '_>, id: DefId) -> bool { let (all_mono_items, _) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); all_mono_items.contains(&id) } -pub fn provide_both(providers: &mut Providers) { +pub fn provide_both(providers: &mut Providers<'_>) { providers.backend_optimization_level = |tcx, cratenum| { let for_speed = match tcx.sess.opts.optimize { // If globally no optimisation is done, #[optimize] has no effect. diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index 1b87f160cc35d..db77074deef94 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -134,7 +134,7 @@ mod temp_stable_hash_impls { } } -pub fn langcall(tcx: TyCtxt, +pub fn langcall(tcx: TyCtxt<'_, '_, '_>, span: Option, msg: &str, li: LangItem) diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index 9e1744451465d..92fa2766f8727 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -11,7 +11,6 @@ #![allow(dead_code)] #![deny(rust_2018_idioms)] #![allow(explicit_outlives_requirements)] -#![allow(elided_lifetimes_in_paths)] #![recursion_limit="256"] diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index 3cac1befaf4ef..0e8cdc83b486e 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -48,7 +48,7 @@ pub struct OperandRef<'tcx, V> { } impl fmt::Debug for OperandRef<'tcx, V> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "OperandRef({:?} @ {:?})", self.val, self.layout) } } diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 6f92024ea8af3..00eae9098e74f 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -32,13 +32,18 @@ impl<'tcx, T> Backend<'tcx> for T where } pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Send { - fn new_metadata(&self, sess: TyCtxt, mod_name: &str) -> Self::Module; + fn new_metadata(&self, sess: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self::Module; fn write_metadata<'b, 'gcx>( &self, tcx: TyCtxt<'b, 'gcx, 'gcx>, metadata: &mut Self::Module, ) -> EncodedMetadata; - fn codegen_allocator(&self, tcx: TyCtxt, mods: &mut Self::Module, kind: AllocatorKind); + fn codegen_allocator( + &self, + tcx: TyCtxt<'_, '_, '_>, + mods: &mut Self::Module, + kind: AllocatorKind + ); fn compile_codegen_unit<'a, 'tcx: 'a>( &self, tcx: TyCtxt<'a, 'tcx, 'tcx>, diff --git a/src/librustc_codegen_ssa/traits/builder.rs b/src/librustc_codegen_ssa/traits/builder.rs index bda0f3dc77966..5099107a39303 100644 --- a/src/librustc_codegen_ssa/traits/builder.rs +++ b/src/librustc_codegen_ssa/traits/builder.rs @@ -100,7 +100,7 @@ pub trait BuilderMethods<'a, 'tcx: 'a>: fn checked_binop( &mut self, oop: OverflowOp, - ty: Ty, + ty: Ty<'_>, lhs: Self::Value, rhs: Self::Value, ) -> (Self::Value, Self::Value); diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index 0e606e744c629..135188e98c71c 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -22,12 +22,12 @@ pub trait DebugInfoMethods<'tcx>: BackendTypes { instance: Instance<'tcx>, sig: ty::FnSig<'tcx>, llfn: Self::Value, - mir: &mir::Mir, + mir: &mir::Mir<'_>, ) -> FunctionDebugContext; fn create_mir_scopes( &self, - mir: &mir::Mir, + mir: &mir::Mir<'_>, debug_context: &FunctionDebugContext, ) -> IndexVec>; fn extend_scope_to_file(