revert(lifetime): Add "needless" lifetime(s) and allow it in clippy

This reverts commit ad97b8c061.
This commit is contained in:
tempdragon 2024-03-16 10:17:35 +08:00
parent 878f572d0e
commit 390f9064e1
7 changed files with 15 additions and 14 deletions

View File

@ -691,7 +691,7 @@ fn reg_to_gcc(reg: InlineAsmRegOrRegClass) -> ConstraintOrRegister {
/// Type to use for outputs that are discarded. It doesn't really matter what
/// the type is, as long as it is valid for the constraint code.
fn dummy_output_type<'gcc>(cx: &CodegenCx<'gcc, '_>, reg: InlineAsmRegClass) -> Type<'gcc> {
fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegClass) -> Type<'gcc> {
match reg {
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg) => cx.type_i32(),
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg) => unimplemented!(),

View File

@ -976,8 +976,8 @@ fn load_operand(
return OperandRef::zero_sized(place.layout);
}
fn scalar_load_metadata<'gcc>(
bx: &mut Builder<'_, 'gcc, '_>,
fn scalar_load_metadata<'a, 'gcc, 'tcx>(
bx: &mut Builder<'a, 'gcc, 'tcx>,
load: RValue<'gcc>,
scalar: &abi::Scalar,
) {

View File

@ -30,7 +30,7 @@ fn global_string(&self, string: &str) -> LValue<'gcc> {
}
}
pub fn bytes_in_context<'gcc>(cx: &CodegenCx<'gcc, '_>, bytes: &[u8]) -> RValue<'gcc> {
pub fn bytes_in_context<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, bytes: &[u8]) -> RValue<'gcc> {
let context = &cx.context;
let byte_type = context.new_type::<u8>();
let typ = context.new_array_type(None, byte_type, bytes.len() as u64);

View File

@ -5,8 +5,8 @@
use crate::{builder::Builder, context::CodegenCx};
pub fn adjust_intrinsic_arguments<'b, 'gcc>(
builder: &Builder<'_, 'gcc, '_>,
pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(
builder: &Builder<'a, 'gcc, 'tcx>,
gcc_func: FunctionPtrType<'gcc>,
mut args: Cow<'b, [RValue<'gcc>]>,
func_name: &str,
@ -479,8 +479,8 @@ pub fn adjust_intrinsic_arguments<'b, 'gcc>(
args
}
pub fn adjust_intrinsic_return_value<'gcc>(
builder: &Builder<'_, 'gcc, '_>,
pub fn adjust_intrinsic_return_value<'a, 'gcc, 'tcx>(
builder: &Builder<'a, 'gcc, 'tcx>,
mut return_value: RValue<'gcc>,
func_name: &str,
args: &[RValue<'gcc>],
@ -628,7 +628,7 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
}
#[cfg(feature = "master")]
pub fn intrinsic<'gcc>(name: &str, cx: &CodegenCx<'gcc, '_>) -> Function<'gcc> {
pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function<'gcc> {
if name == "llvm.prefetch" {
let gcc_name = "__builtin_prefetch";
let func = cx.context.get_builtin_function(gcc_name);

View File

@ -1093,8 +1093,8 @@ fn saturating_sub(
}
}
fn try_intrinsic<'gcc>(
bx: &mut Builder<'_, 'gcc, '_>,
fn try_intrinsic<'a, 'b, 'gcc, 'tcx>(
bx: &'b mut Builder<'a, 'gcc, 'tcx>,
try_func: RValue<'gcc>,
data: RValue<'gcc>,
_catch_func: RValue<'gcc>,

View File

@ -692,11 +692,11 @@ fn vector_ty<'gcc, 'tcx>(
}
#[cfg(feature = "master")]
fn gather<'gcc>(
fn gather<'a, 'gcc, 'tcx>(
default: RValue<'gcc>,
pointers: RValue<'gcc>,
mask: RValue<'gcc>,
bx: &mut Builder<'_, 'gcc, '_>,
bx: &mut Builder<'a, 'gcc, 'tcx>,
in_len: u64,
invert: bool,
) -> RValue<'gcc> {

View File

@ -29,6 +29,7 @@
#![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)]
#![deny(clippy::pattern_type_mismatch)]
#![allow(clippy::needless_lifetimes)]
extern crate rustc_apfloat;
extern crate rustc_ast;
@ -270,7 +271,7 @@ fn target_features(&self, sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
}
}
fn new_context<'gcc>(tcx: TyCtxt<'_>) -> Context<'gcc> {
fn new_context<'gcc, 'tcx>(tcx: TyCtxt<'tcx>) -> Context<'gcc> {
let context = Context::default();
if tcx.sess.target.arch == "x86" || tcx.sess.target.arch == "x86_64" {
context.add_command_line_option("-masm=intel");