Skip to content

Commit 291c75d

Browse files
committed
Enable the rust_2018_idioms and unused_lifetimes lints and fix all warnings
They are set to deny by default in the rust-lang/rust repo
1 parent fd3be6d commit 291c75d

File tree

17 files changed

+44
-36
lines changed

17 files changed

+44
-36
lines changed

src/abi/comments.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::mir;
55
use crate::abi::pass_mode::*;
66
use crate::prelude::*;
77

8-
pub(super) fn add_args_header_comment(fx: &mut FunctionCx<impl Backend>) {
8+
pub(super) fn add_args_header_comment(fx: &mut FunctionCx<'_, '_, impl Backend>) {
99
fx.add_global_comment(format!(
1010
"kind loc.idx param pass mode ty"
1111
));
@@ -49,7 +49,7 @@ pub(super) fn add_arg_comment<'tcx>(
4949
));
5050
}
5151

52-
pub(super) fn add_locals_header_comment(fx: &mut FunctionCx<impl Backend>) {
52+
pub(super) fn add_locals_header_comment(fx: &mut FunctionCx<'_, '_, impl Backend>) {
5353
fx.add_global_comment(String::new());
5454
fx.add_global_comment(format!(
5555
"kind local ty size align (abi,pref)"

src/abi/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn clif_sig_from_fn_sig<'tcx>(
9292
}
9393
abi => abi,
9494
};
95-
let (call_conv, inputs, output): (CallConv, Vec<Ty>, Ty) = match abi {
95+
let (call_conv, inputs, output): (CallConv, Vec<Ty<'tcx>>, Ty<'tcx>) = match abi {
9696
Abi::Rust => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
9797
Abi::C => (CallConv::triple_default(triple), sig.inputs().to_vec(), sig.output()),
9898
Abi::RustCall => {
@@ -101,7 +101,7 @@ fn clif_sig_from_fn_sig<'tcx>(
101101
ty::Tuple(ref tupled_arguments) => tupled_arguments,
102102
_ => bug!("argument to function with \"rust-call\" ABI is not a tuple"),
103103
};
104-
let mut inputs: Vec<Ty> = vec![sig.inputs()[0]];
104+
let mut inputs: Vec<Ty<'tcx>> = vec![sig.inputs()[0]];
105105
inputs.extend(extra_args.types());
106106
(CallConv::triple_default(triple), inputs, sig.output())
107107
}
@@ -288,7 +288,11 @@ fn local_place<'tcx>(
288288
fx.local_map[&local]
289289
}
290290

291-
pub(crate) fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_block: Block, should_codegen_locals: bool) {
291+
pub(crate) fn codegen_fn_prelude<'tcx>(
292+
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
293+
start_block: Block,
294+
should_codegen_locals: bool,
295+
) {
292296
let ssa_analyzed = crate::analyze::analyze(fx);
293297

294298
#[cfg(debug_assertions)]
@@ -332,7 +336,7 @@ pub(crate) fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, star
332336
(local, ArgKind::Normal(param), arg_ty)
333337
}
334338
})
335-
.collect::<Vec<(Local, ArgKind, Ty)>>();
339+
.collect::<Vec<(Local, ArgKind<'tcx>, Ty<'tcx>)>>();
336340

337341
assert!(fx.caller_location.is_none());
338342
if fx.instance.def.requires_caller_location(fx.tcx) {

src/abi/returning.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(crate) fn can_return_to_ssa_var<'tcx>(tcx: TyCtxt<'tcx>, dest_layout: TyAndL
1414
}
1515

1616
pub(super) fn codegen_return_param(
17-
fx: &mut FunctionCx<impl Backend>,
17+
fx: &mut FunctionCx<'_, '_, impl Backend>,
1818
ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
1919
start_block: Block,
2020
) {
@@ -101,7 +101,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx, B: Backend, T>(
101101
(call_inst, meta)
102102
}
103103

104-
pub(crate) fn codegen_return(fx: &mut FunctionCx<impl Backend>) {
104+
pub(crate) fn codegen_return(fx: &mut FunctionCx<'_, '_, impl Backend>) {
105105
match get_pass_mode(fx.tcx, return_layout(fx)) {
106106
PassMode::NoPass | PassMode::ByRef { sized: true } => {
107107
fx.bcx.ins().return_(&[]);

src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub(crate) fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
209209
context.clear();
210210
}
211211

212-
pub(crate) fn verify_func(tcx: TyCtxt, writer: &crate::pretty_clif::CommentWriter, func: &Function) {
212+
pub(crate) fn verify_func(tcx: TyCtxt<'_>, writer: &crate::pretty_clif::CommentWriter, func: &Function) {
213213
tcx.sess.time("verify clif ir", || {
214214
let flags = settings::Flags::new(settings::builder());
215215
match ::cranelift_codegen::verify_function(&func, &flags) {

src/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub(crate) fn mir_var(loc: Local) -> Variable {
1010
Variable::with_u32(loc.index() as u32)
1111
}
1212

13-
pub(crate) fn pointer_ty(tcx: TyCtxt) -> types::Type {
13+
pub(crate) fn pointer_ty(tcx: TyCtxt<'_>) -> types::Type {
1414
match tcx.data_layout.pointer_size.bits() {
1515
16 => types::I16,
1616
32 => types::I32,
@@ -19,7 +19,7 @@ pub(crate) fn pointer_ty(tcx: TyCtxt) -> types::Type {
1919
}
2020
}
2121

22-
pub(crate) fn scalar_to_clif_type(tcx: TyCtxt, scalar: Scalar) -> Type {
22+
pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type {
2323
match scalar.value {
2424
Primitive::Int(int, _sign) => match int {
2525
Integer::I8 => types::I8,

src/debuginfo/emit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct WriterRelocate {
6161
}
6262

6363
impl WriterRelocate {
64-
fn new(ctx: &DebugContext) -> Self {
64+
fn new(ctx: &DebugContext<'_>) -> Self {
6565
WriterRelocate {
6666
relocs: Vec::new(),
6767
writer: EndianVec::new(ctx.endian),

src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use gimli::{Encoding, Format, LineEncoding, RunTimeEndian, X86_64};
1515

1616
pub(crate) use emit::{DebugReloc, DebugRelocName};
1717

18-
fn target_endian(tcx: TyCtxt) -> RunTimeEndian {
18+
fn target_endian(tcx: TyCtxt<'_>) -> RunTimeEndian {
1919
use rustc_target::abi::Endian;
2020

2121
match tcx.data_layout.endian {

src/driver/aot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn emit_module<B: Backend>(
3131
name: String,
3232
kind: ModuleKind,
3333
mut module: Module<B>,
34-
debug: Option<DebugContext>,
34+
debug: Option<DebugContext<'_>>,
3535
) -> ModuleCodegenResult
3636
where B::Product: Emit + WriteDebugInfo,
3737
{
@@ -72,7 +72,7 @@ fn emit_module<B: Backend>(
7272

7373
fn reuse_workproduct_for_cgu(
7474
tcx: TyCtxt<'_>,
75-
cgu: &CodegenUnit,
75+
cgu: &CodegenUnit<'_>,
7676
work_products: &mut FxHashMap<WorkProductId, WorkProduct>,
7777
) -> CompiledModule {
7878
let incr_comp_session_dir = tcx.sess.incr_comp_session_dir();

src/driver/jit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn load_imported_symbols_for_jit(tcx: TyCtxt<'_>) -> Vec<(String, *const u8)> {
128128
} else {
129129
&name
130130
};
131-
let symbol: libloading::Symbol<*const u8> =
131+
let symbol: libloading::Symbol<'_, *const u8> =
132132
unsafe { lib.get(dlsym_name.as_bytes()) }.unwrap();
133133
Some((name, *symbol))
134134
}));

src/intrinsics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
691691
};
692692
bswap, <T> (v arg) {
693693
// FIXME(CraneStation/cranelift#794) add bswap instruction to cranelift
694-
fn swap(bcx: &mut FunctionBuilder, v: Value) -> Value {
694+
fn swap(bcx: &mut FunctionBuilder<'_>, v: Value) -> Value {
695695
match bcx.func.dfg.value_type(v) {
696696
types::I8 => v,
697697

0 commit comments

Comments
 (0)