Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librustc_codegen_ssa: #![deny(elided_lifetimes_in_paths)] #58720

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -1052,7 +1052,7 @@ impl<'a> Linker for WasmLd<'a> {
}
}

fn exported_symbols(tcx: TyCtxt, crate_type: CrateType) -> Vec<String> {
fn exported_symbols(tcx: TyCtxt<'_, '_, '_>, crate_type: CrateType) -> Vec<String> {
if let Some(ref exports) = tcx.sess.target.target.options.override_export_symbols {
return exports.clone()
}
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_codegen_ssa/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub type ExportedSymbols = FxHashMap<
Arc<Vec<(String, SymbolExportLevel)>>,
>;

pub fn threshold(tcx: TyCtxt) -> SymbolExportLevel {
pub fn threshold(tcx: TyCtxt<'_, '_, '_>) -> SymbolExportLevel {
crates_export_threshold(&tcx.sess.crate_types.borrow())
}

Expand Down Expand Up @@ -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 {
Expand All @@ -351,20 +351,20 @@ 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;
providers.upstream_monomorphizations = upstream_monomorphizations_provider;
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
Expand Down
18 changes: 9 additions & 9 deletions src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ fn need_pre_lto_bitcode_for_incr_comp(sess: &Session) -> bool {

pub fn start_async_codegen<B: ExtraBackendMethods>(
backend: B,
tcx: TyCtxt,
tcx: TyCtxt<'_, '_, '_>,
time_graph: Option<TimeGraph>,
metadata: EncodedMetadata,
coordinator_receive: Receiver<Box<dyn Any + Send>>,
Expand Down Expand Up @@ -947,7 +947,7 @@ enum MainThreadWorkerState {

fn start_executing_work<B: ExtraBackendMethods>(
backend: B,
tcx: TyCtxt,
tcx: TyCtxt<'_, '_, '_>,
crate_info: &CrateInfo,
shared_emitter: SharedEmitter,
codegen_worker_send: Sender<Message<B>>,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -1822,7 +1822,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
}

pub fn submit_pre_codegened_module_to_llvm(&self,
tcx: TyCtxt,
tcx: TyCtxt<'_, '_, '_>,
module: ModuleCodegen<B::Module>) {
self.wait_for_signal_to_codegen_item();
self.check_for_errors(tcx.sess);
Expand All @@ -1832,7 +1832,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
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::<B>)));
Expand Down Expand Up @@ -1871,7 +1871,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {

pub fn submit_codegened_module_to_llvm<B: ExtraBackendMethods>(
_backend: &B,
tcx: TyCtxt,
tcx: TyCtxt<'_, '_, '_>,
module: ModuleCodegen<B::Module>,
cost: u64
) {
Expand All @@ -1884,7 +1884,7 @@ pub fn submit_codegened_module_to_llvm<B: ExtraBackendMethods>(

pub fn submit_post_lto_module_to_llvm<B: ExtraBackendMethods>(
_backend: &B,
tcx: TyCtxt,
tcx: TyCtxt<'_, '_, '_>,
module: CachedModuleCodegen
) {
let llvm_work_item = WorkItem::CopyPostLtoArtifacts(module);
Expand All @@ -1896,7 +1896,7 @@ pub fn submit_post_lto_module_to_llvm<B: ExtraBackendMethods>(

pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
_backend: &B,
tcx: TyCtxt,
tcx: TyCtxt<'_, '_, '_>,
module: CachedModuleCodegen
) {
let filename = pre_lto_bitcode_filename(&module.name);
Expand All @@ -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() &&
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ mod temp_stable_hash_impls {
}
}

pub fn langcall(tcx: TyCtxt,
pub fn langcall(tcx: TyCtxt<'_, '_, '_>,
span: Option<Span>,
msg: &str,
li: LangItem)
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#![allow(dead_code)]
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
#![allow(elided_lifetimes_in_paths)]

#![recursion_limit="256"]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct OperandRef<'tcx, V> {
}

impl<V: CodegenObject> 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)
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/librustc_codegen_ssa/traits/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/traits/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/traits/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self::DIScope>;

fn create_mir_scopes(
&self,
mir: &mir::Mir,
mir: &mir::Mir<'_>,
debug_context: &FunctionDebugContext<Self::DIScope>,
) -> IndexVec<mir::SourceScope, MirDebugScope<Self::DIScope>>;
fn extend_scope_to_file(
Expand Down