Skip to content

Commit 9661a81

Browse files
committed
librustc_codegen_llvm: deny(elided_lifetimes_in_paths)
1 parent c1911ba commit 9661a81

22 files changed

+73
-69
lines changed

src/librustc_codegen_llvm/allocator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy};
99
use crate::ModuleLlvm;
1010
use crate::llvm::{self, False, True};
1111

12-
pub(crate) unsafe fn codegen(tcx: TyCtxt, mods: &mut ModuleLlvm, kind: AllocatorKind) {
12+
pub(crate) unsafe fn codegen(tcx: TyCtxt<'_, '_, '_>, mods: &mut ModuleLlvm, kind: AllocatorKind) {
1313
let llcx = &*mods.llcx;
1414
let llmod = mods.llmod();
1515
let usize = match &tcx.sess.target.target.target_pointer_width[..] {

src/librustc_codegen_llvm/attributes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ pub fn from_fn_attrs(
308308
}
309309
}
310310

311-
pub fn provide(providers: &mut Providers) {
311+
pub fn provide(providers: &mut Providers<'_>) {
312312
providers.target_features_whitelist = |tcx, cnum| {
313313
assert_eq!(cnum, LOCAL_CRATE);
314314
if tcx.sess.opts.actually_rustdoc {
@@ -328,7 +328,7 @@ pub fn provide(providers: &mut Providers) {
328328
provide_extern(providers);
329329
}
330330

331-
pub fn provide_extern(providers: &mut Providers) {
331+
pub fn provide_extern(providers: &mut Providers<'_>) {
332332
providers.wasm_import_module_map = |tcx, cnum| {
333333
// Build up a map from DefId to a `NativeLibrary` structure, where
334334
// `NativeLibrary` internally contains information about
@@ -362,7 +362,7 @@ pub fn provide_extern(providers: &mut Providers) {
362362
};
363363
}
364364

365-
fn wasm_import_module(tcx: TyCtxt, id: DefId) -> Option<CString> {
365+
fn wasm_import_module(tcx: TyCtxt<'_, '_, '_>, id: DefId) -> Option<CString> {
366366
tcx.wasm_import_module_map(id.krate)
367367
.get(&id)
368368
.map(|s| CString::new(&s[..]).unwrap())

src/librustc_codegen_llvm/back/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ enum Addition {
4242
},
4343
}
4444

45-
fn is_relevant_child(c: &Child) -> bool {
45+
fn is_relevant_child(c: &Child<'_>) -> bool {
4646
match c.name() {
4747
Some(name) => !name.contains("SYMDEF"),
4848
None => false,

src/librustc_codegen_llvm/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdir: &
808808
}
809809

810810
impl<'a> fmt::Display for Escape<'a> {
811-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
811+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
812812
if self.is_like_msvc {
813813
// This is "documented" at
814814
// https://msdn.microsoft.com/en-us/library/4xdcbak7.aspx

src/librustc_codegen_llvm/back/rpath.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct RPathConfig<'a> {
1515
pub get_install_prefix_lib_path: &'a mut dyn FnMut() -> PathBuf,
1616
}
1717

18-
pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
18+
pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec<String> {
1919
// No rpath on windows
2020
if !config.has_rpath {
2121
return Vec::new();
@@ -52,7 +52,7 @@ fn rpaths_to_flags(rpaths: &[String]) -> Vec<String> {
5252
ret
5353
}
5454

55-
fn get_rpaths(config: &mut RPathConfig, libs: &[PathBuf]) -> Vec<String> {
55+
fn get_rpaths(config: &mut RPathConfig<'_>, libs: &[PathBuf]) -> Vec<String> {
5656
debug!("output: {:?}", config.out_filename.display());
5757
debug!("libs:");
5858
for libpath in libs {
@@ -86,12 +86,12 @@ fn get_rpaths(config: &mut RPathConfig, libs: &[PathBuf]) -> Vec<String> {
8686
rpaths
8787
}
8888

89-
fn get_rpaths_relative_to_output(config: &mut RPathConfig,
89+
fn get_rpaths_relative_to_output(config: &mut RPathConfig<'_>,
9090
libs: &[PathBuf]) -> Vec<String> {
9191
libs.iter().map(|a| get_rpath_relative_to_output(config, a)).collect()
9292
}
9393

94-
fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String {
94+
fn get_rpath_relative_to_output(config: &mut RPathConfig<'_>, lib: &Path) -> String {
9595
// Mac doesn't appear to support $ORIGIN
9696
let prefix = if config.is_like_osx {
9797
"@loader_path"
@@ -127,7 +127,7 @@ fn path_relative_from(path: &Path, base: &Path) -> Option<PathBuf> {
127127
} else {
128128
let mut ita = path.components();
129129
let mut itb = base.components();
130-
let mut comps: Vec<Component> = vec![];
130+
let mut comps: Vec<Component<'_>> = vec![];
131131
loop {
132132
match (ita.next(), itb.next()) {
133133
(None, None) => break,
@@ -154,7 +154,7 @@ fn path_relative_from(path: &Path, base: &Path) -> Option<PathBuf> {
154154
}
155155

156156

157-
fn get_install_prefix_rpath(config: &mut RPathConfig) -> String {
157+
fn get_install_prefix_rpath(config: &mut RPathConfig<'_>) -> String {
158158
let path = (config.get_install_prefix_lib_path)();
159159
let path = env::current_dir().unwrap().join(&path);
160160
// FIXME (#9639): This needs to handle non-utf8 paths

src/librustc_codegen_llvm/back/wasm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn rewrite_imports(path: &Path, import_map: &FxHashMap<String, String>) {
6060
fs::write(path, &ret.data).expect("failed to write wasm output");
6161

6262
fn rewrite_import_section(
63-
wasm: &mut WasmDecoder,
63+
wasm: &mut WasmDecoder<'_>,
6464
import_map: &FxHashMap<String, String>,
6565
)
6666
-> Vec<u8>
@@ -75,7 +75,7 @@ pub fn rewrite_imports(path: &Path, import_map: &FxHashMap<String, String>) {
7575
return dst.data
7676
}
7777

78-
fn rewrite_import_entry(wasm: &mut WasmDecoder,
78+
fn rewrite_import_entry(wasm: &mut WasmDecoder<'_>,
7979
dst: &mut WasmEncoder,
8080
import_map: &FxHashMap<String, String>) {
8181
// More info about the binary format here is available at:

src/librustc_codegen_llvm/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn write_output_file(
8383
}
8484

8585
pub fn create_target_machine(
86-
tcx: TyCtxt,
86+
tcx: TyCtxt<'_, '_, '_>,
8787
find_features: bool,
8888
) -> &'static mut llvm::TargetMachine {
8989
target_machine_factory(tcx.sess, tcx.backend_optimization_level(LOCAL_CRATE), find_features)()

src/librustc_codegen_llvm/base.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ pub fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
172172
let mono_items = cx.codegen_unit
173173
.items_in_deterministic_order(cx.tcx);
174174
for &(mono_item, (linkage, visibility)) in &mono_items {
175-
mono_item.predefine::<Builder>(&cx, linkage, visibility);
175+
mono_item.predefine::<Builder<'_, '_, '_>>(&cx, linkage, visibility);
176176
}
177177

178178
// ... and now that we have everything pre-defined, fill out those definitions.
179179
for &(mono_item, _) in &mono_items {
180-
mono_item.define::<Builder>(&cx);
180+
mono_item.define::<Builder<'_, '_, '_>>(&cx);
181181
}
182182

183183
// If this codegen unit contains the main function, also create the
184184
// wrapper here
185-
maybe_create_entry_wrapper::<Builder>(&cx);
185+
maybe_create_entry_wrapper::<Builder<'_, '_, '_>>(&cx);
186186

187187
// Run replace-all-uses-with for statics that need it
188188
for &(old_g, new_g) in cx.statics_to_rauw().borrow().iter() {

src/librustc_codegen_llvm/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
456456
fn checked_binop(
457457
&mut self,
458458
oop: OverflowOp,
459-
ty: Ty,
459+
ty: Ty<'_>,
460460
lhs: Self::Value,
461461
rhs: Self::Value,
462462
) -> (Self::Value, Self::Value) {

src/librustc_codegen_llvm/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn is_pie_binary(sess: &Session) -> bool {
144144
}
145145

146146
pub unsafe fn create_module(
147-
tcx: TyCtxt,
147+
tcx: TyCtxt<'_, '_, '_>,
148148
llcx: &'ll llvm::Context,
149149
mod_name: &str,
150150
) -> &'ll llvm::Module {

src/librustc_codegen_llvm/debuginfo/create_scope_map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use syntax_pos::BytePos;
2020
/// If debuginfo is disabled, the returned vector is empty.
2121
pub fn create_mir_scopes(
2222
cx: &CodegenCx<'ll, '_>,
23-
mir: &Mir,
23+
mir: &Mir<'_>,
2424
debug_context: &FunctionDebugContext<&'ll DISubprogram>,
2525
) -> IndexVec<SourceScope, MirDebugScope<&'ll DIScope>> {
2626
let null_scope = MirDebugScope {
@@ -55,7 +55,7 @@ pub fn create_mir_scopes(
5555
}
5656

5757
fn make_mir_scope(cx: &CodegenCx<'ll, '_>,
58-
mir: &Mir,
58+
mir: &Mir<'_>,
5959
has_variables: &BitSet<SourceScope>,
6060
debug_context: &FunctionDebugContextData<&'ll DISubprogram>,
6161
scope: SourceScope,

src/librustc_codegen_llvm/debuginfo/gdb.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use syntax::attr;
1313

1414
/// Inserts a side-effect free instruction sequence that makes sure that the
1515
/// .debug_gdb_scripts global is referenced, so it isn't removed by the linker.
16-
pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &mut Builder) {
16+
pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &mut Builder<'_, '_, '_>) {
1717
if needs_gdb_debug_scripts_section(bx) {
1818
let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx);
1919
// Load just the first byte as that's all that's necessary to force
@@ -64,7 +64,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(cx: &CodegenCx<'ll, '_>)
6464
})
6565
}
6666

67-
pub fn needs_gdb_debug_scripts_section(cx: &CodegenCx) -> bool {
67+
pub fn needs_gdb_debug_scripts_section(cx: &CodegenCx<'_, '_>) -> bool {
6868
let omit_gdb_pretty_printer_section =
6969
attr::contains_name(&cx.tcx.hir().krate_attrs(),
7070
"omit_gdb_pretty_printer_section");

src/librustc_codegen_llvm/debuginfo/metadata.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Hash for llvm::Metadata {
6060
}
6161

6262
impl fmt::Debug for llvm::Metadata {
63-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
63+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6464
(self as *const Self).fmt(f)
6565
}
6666
}
@@ -817,7 +817,7 @@ fn pointer_type_metadata(
817817
}
818818
}
819819

820-
pub fn compile_unit_metadata(tcx: TyCtxt,
820+
pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_, '_>,
821821
codegen_unit_name: &str,
822822
debug_context: &CrateDebugContext<'ll, '_>)
823823
-> &'ll DIDescriptor {
@@ -1162,7 +1162,7 @@ fn prepare_union_metadata(
11621162
// sometimes emit the old style rather than emit something completely
11631163
// useless when rust is compiled against LLVM 6 or older. This
11641164
// function decides which representation will be emitted.
1165-
fn use_enum_fallback(cx: &CodegenCx) -> bool {
1165+
fn use_enum_fallback(cx: &CodegenCx<'_, '_>) -> bool {
11661166
// On MSVC we have to use the fallback mode, because LLVM doesn't
11671167
// lower variant parts to PDB.
11681168
return cx.sess().target.target.options.is_like_msvc
@@ -1736,7 +1736,7 @@ fn prepare_enum_metadata(
17361736
}),
17371737
);
17381738

1739-
fn get_enum_discriminant_name(cx: &CodegenCx,
1739+
fn get_enum_discriminant_name(cx: &CodegenCx<'_, '_>,
17401740
def_id: DefId)
17411741
-> InternedString {
17421742
cx.tcx.item_name(def_id)
@@ -1863,7 +1863,7 @@ fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> Option<&'
18631863
}
18641864
return Some(create_DIArray(DIB(cx), &[]));
18651865

1866-
fn get_parameter_names(cx: &CodegenCx,
1866+
fn get_parameter_names(cx: &CodegenCx<'_, '_>,
18671867
generics: &ty::Generics)
18681868
-> Vec<InternedString> {
18691869
let mut names = generics.parent.map_or(vec![], |def_id| {

src/librustc_codegen_llvm/debuginfo/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
103103
}
104104

105105
/// Creates any deferred debug metadata nodes
106-
pub fn finalize(cx: &CodegenCx) {
106+
pub fn finalize(cx: &CodegenCx<'_, '_>) {
107107
if cx.dbg_cx.is_none() {
108108
return;
109109
}
@@ -233,7 +233,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
233233
instance: Instance<'tcx>,
234234
sig: ty::FnSig<'tcx>,
235235
llfn: &'ll Value,
236-
mir: &mir::Mir,
236+
mir: &mir::Mir<'_>,
237237
) -> FunctionDebugContext<&'ll DISubprogram> {
238238
if self.sess().opts.debuginfo == DebugInfo::None {
239239
return FunctionDebugContext::DebugInfoDisabled;
@@ -455,7 +455,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
455455
return create_DIArray(DIB(cx), &template_params[..]);
456456
}
457457

458-
fn get_parameter_names(cx: &CodegenCx,
458+
fn get_parameter_names(cx: &CodegenCx<'_, '_>,
459459
generics: &ty::Generics)
460460
-> Vec<InternedString> {
461461
let mut names = generics.parent.map_or(vec![], |def_id| {
@@ -518,7 +518,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
518518

519519
fn create_mir_scopes(
520520
&self,
521-
mir: &mir::Mir,
521+
mir: &mir::Mir<'_>,
522522
debug_context: &FunctionDebugContext<&'ll DISubprogram>,
523523
) -> IndexVec<mir::SourceScope, MirDebugScope<&'ll DIScope>> {
524524
create_scope_map::create_mir_scopes(self, mir, debug_context)

src/librustc_codegen_llvm/debuginfo/type_names.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
178178
}
179179
}
180180

181-
fn push_item_name(cx: &CodegenCx,
181+
fn push_item_name(cx: &CodegenCx<'_, '_>,
182182
def_id: DefId,
183183
qualified: bool,
184184
output: &mut String) {

src/librustc_codegen_llvm/debuginfo/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_codegen_ssa::traits::*;
1313

1414
use syntax_pos::Span;
1515

16-
pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool
16+
pub fn is_node_local_to_unit(cx: &CodegenCx<'_, '_>, def_id: DefId) -> bool
1717
{
1818
// The is_local_to_unit flag indicates whether a function is local to the
1919
// current compilation unit (i.e., if it is *static* in the C-sense). The
@@ -37,7 +37,7 @@ pub fn create_DIArray(
3737
}
3838

3939
/// Returns syntax_pos::Loc corresponding to the beginning of the span
40-
pub fn span_start(cx: &CodegenCx, span: Span) -> syntax_pos::Loc {
40+
pub fn span_start(cx: &CodegenCx<'_, '_>, span: Span) -> syntax_pos::Loc {
4141
cx.sess().source_map().lookup_char_pos(span.lo())
4242
}
4343

src/librustc_codegen_llvm/intrinsic.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1251,8 +1251,8 @@ fn generic_simd_intrinsic(
12511251

12521252
fn simd_simple_float_intrinsic(
12531253
name: &str,
1254-
in_elem: &::rustc::ty::TyS,
1255-
in_ty: &::rustc::ty::TyS,
1254+
in_elem: &::rustc::ty::TyS<'_>,
1255+
in_ty: &::rustc::ty::TyS<'_>,
12561256
in_len: usize,
12571257
bx: &mut Builder<'a, 'll, 'tcx>,
12581258
span: Span,
@@ -1362,7 +1362,7 @@ fn generic_simd_intrinsic(
13621362
// FIXME: use:
13631363
// https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Function.h#L182
13641364
// https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Intrinsics.h#L81
1365-
fn llvm_vector_str(elem_ty: ty::Ty, vec_len: usize, no_pointers: usize) -> String {
1365+
fn llvm_vector_str(elem_ty: ty::Ty<'_>, vec_len: usize, no_pointers: usize) -> String {
13661366
let p0s: String = "p0".repeat(no_pointers);
13671367
match elem_ty.sty {
13681368
ty::Int(v) => format!("v{}{}i{}", vec_len, p0s, v.bit_width().unwrap()),
@@ -1372,7 +1372,7 @@ fn generic_simd_intrinsic(
13721372
}
13731373
}
13741374

1375-
fn llvm_vector_ty(cx: &CodegenCx<'ll, '_>, elem_ty: ty::Ty, vec_len: usize,
1375+
fn llvm_vector_ty(cx: &CodegenCx<'ll, '_>, elem_ty: ty::Ty<'_>, vec_len: usize,
13761376
mut no_pointers: usize) -> &'ll Type {
13771377
// FIXME: use cx.layout_of(ty).llvm_type() ?
13781378
let mut elem_ty = match elem_ty.sty {
@@ -1418,15 +1418,15 @@ fn generic_simd_intrinsic(
14181418
in_ty, ret_ty);
14191419

14201420
// This counts how many pointers
1421-
fn ptr_count(t: ty::Ty) -> usize {
1421+
fn ptr_count(t: ty::Ty<'_>) -> usize {
14221422
match t.sty {
14231423
ty::RawPtr(p) => 1 + ptr_count(p.ty),
14241424
_ => 0,
14251425
}
14261426
}
14271427

14281428
// Non-ptr type
1429-
fn non_ptr(t: ty::Ty) -> ty::Ty {
1429+
fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> {
14301430
match t.sty {
14311431
ty::RawPtr(p) => non_ptr(p.ty),
14321432
_ => t,
@@ -1517,15 +1517,15 @@ fn generic_simd_intrinsic(
15171517
arg_tys[2].simd_size(tcx));
15181518

15191519
// This counts how many pointers
1520-
fn ptr_count(t: ty::Ty) -> usize {
1520+
fn ptr_count(t: ty::Ty<'_>) -> usize {
15211521
match t.sty {
15221522
ty::RawPtr(p) => 1 + ptr_count(p.ty),
15231523
_ => 0,
15241524
}
15251525
}
15261526

15271527
// Non-ptr type
1528-
fn non_ptr(t: ty::Ty) -> ty::Ty {
1528+
fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> {
15291529
match t.sty {
15301530
ty::RawPtr(p) => non_ptr(p.ty),
15311531
_ => t,
@@ -1901,7 +1901,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
19011901
// Returns None if the type is not an integer
19021902
// FIXME: there’s multiple of this functions, investigate using some of the already existing
19031903
// stuffs.
1904-
fn int_type_width_signed(ty: Ty, cx: &CodegenCx) -> Option<(u64, bool)> {
1904+
fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, bool)> {
19051905
match ty.sty {
19061906
ty::Int(t) => Some((match t {
19071907
ast::IntTy::Isize => cx.tcx.sess.target.isize_ty.bit_width().unwrap() as u64,

0 commit comments

Comments
 (0)