Skip to content

Commit 867d39c

Browse files
committedJan 21, 2024
Auto merge of #120100 - oli-obk:astconv_lifetimes, r=BoxyUwU
Don't forget that the lifetime on hir types is `'tcx` This PR just tracks the `'tcx` lifetime to wherever the original objects actually have that lifetime. This code is needed for #107606 (now #120131) so that `ast_ty_to_ty` can invoke `lit_to_const` on an argument passed to it. Currently the argument is `&hir::Ty<'_>`, but after this PR it is `&'tcx hir::Ty<'tcx>`.
·
1.91.01.77.0
2 parents 4cb17b4 + e532b0d commit 867d39c

File tree

26 files changed

+105
-98
lines changed

26 files changed

+105
-98
lines changed
 

‎compiler/rustc_hir/src/hir.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub struct InferArg {
248248
}
249249

250250
impl InferArg {
251-
pub fn to_ty(&self) -> Ty<'_> {
251+
pub fn to_ty(&self) -> Ty<'static> {
252252
Ty { kind: TyKind::Infer, span: self.span, hir_id: self.hir_id }
253253
}
254254
}

‎compiler/rustc_hir_analysis/src/astconv/bounds.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,16 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
108108
/// `param_ty` and `ast_bounds`. See `instantiate_poly_trait_ref`
109109
/// for more details.
110110
#[instrument(level = "debug", skip(self, ast_bounds, bounds))]
111-
pub(crate) fn add_bounds<'hir, I: Iterator<Item = &'hir hir::GenericBound<'hir>>>(
111+
pub(crate) fn add_bounds<'hir, I: Iterator<Item = &'hir hir::GenericBound<'tcx>>>(
112112
&self,
113113
param_ty: Ty<'tcx>,
114114
ast_bounds: I,
115115
bounds: &mut Bounds<'tcx>,
116116
bound_vars: &'tcx ty::List<ty::BoundVariableKind>,
117117
only_self_bounds: OnlySelfBounds,
118-
) {
118+
) where
119+
'tcx: 'hir,
120+
{
119121
for ast_bound in ast_bounds {
120122
match ast_bound {
121123
hir::GenericBound::Trait(poly_trait_ref, modifier) => {
@@ -179,7 +181,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
179181
pub(crate) fn compute_bounds(
180182
&self,
181183
param_ty: Ty<'tcx>,
182-
ast_bounds: &[hir::GenericBound<'_>],
184+
ast_bounds: &[hir::GenericBound<'tcx>],
183185
filter: PredicateFilter,
184186
) -> Bounds<'tcx> {
185187
let mut bounds = Bounds::default();

‎compiler/rustc_hir_analysis/src/astconv/generics.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn generic_arg_mismatch_err(
168168
/// instantiate a `GenericArg`.
169169
/// - `inferred_kind`: if no parameter was provided, and inference is enabled, then
170170
/// creates a suitable inference variable.
171-
pub fn create_args_for_parent_generic_args<'tcx, 'a>(
171+
pub fn create_args_for_parent_generic_args<'tcx: 'a, 'a>(
172172
tcx: TyCtxt<'tcx>,
173173
def_id: DefId,
174174
parent_args: &[ty::GenericArg<'tcx>],

‎compiler/rustc_hir_analysis/src/astconv/mod.rs‎

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub trait AstConv<'tcx> {
122122
&self,
123123
span: Span,
124124
item_def_id: DefId,
125-
item_segment: &hir::PathSegment<'_>,
125+
item_segment: &hir::PathSegment<'tcx>,
126126
poly_trait_ref: ty::PolyTraitRef<'tcx>,
127127
) -> Ty<'tcx>;
128128

@@ -156,14 +156,14 @@ struct ConvertedBinding<'a, 'tcx> {
156156
hir_id: hir::HirId,
157157
item_name: Ident,
158158
kind: ConvertedBindingKind<'a, 'tcx>,
159-
gen_args: &'a GenericArgs<'a>,
159+
gen_args: &'tcx GenericArgs<'tcx>,
160160
span: Span,
161161
}
162162

163163
#[derive(Debug)]
164164
enum ConvertedBindingKind<'a, 'tcx> {
165165
Equality(Spanned<ty::Term<'tcx>>),
166-
Constraint(&'a [hir::GenericBound<'a>]),
166+
Constraint(&'a [hir::GenericBound<'tcx>]),
167167
}
168168

169169
/// New-typed boolean indicating whether explicit late-bound lifetimes
@@ -215,12 +215,12 @@ pub struct GenericArgCountResult {
215215
}
216216

217217
pub trait CreateSubstsForGenericArgsCtxt<'a, 'tcx> {
218-
fn args_for_def_id(&mut self, def_id: DefId) -> (Option<&'a GenericArgs<'a>>, bool);
218+
fn args_for_def_id(&mut self, def_id: DefId) -> (Option<&'a GenericArgs<'tcx>>, bool);
219219

220220
fn provided_kind(
221221
&mut self,
222222
param: &ty::GenericParamDef,
223-
arg: &GenericArg<'_>,
223+
arg: &GenericArg<'tcx>,
224224
) -> ty::GenericArg<'tcx>;
225225

226226
fn inferred_kind(
@@ -294,7 +294,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
294294
&self,
295295
span: Span,
296296
def_id: DefId,
297-
item_segment: &hir::PathSegment<'_>,
297+
item_segment: &hir::PathSegment<'tcx>,
298298
) -> GenericArgsRef<'tcx> {
299299
let (args, _) = self.create_args_for_ast_path(
300300
span,
@@ -351,7 +351,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
351351
def_id: DefId,
352352
parent_args: &[ty::GenericArg<'tcx>],
353353
seg: &hir::PathSegment<'_>,
354-
generic_args: &'a hir::GenericArgs<'_>,
354+
generic_args: &'a hir::GenericArgs<'tcx>,
355355
infer_args: bool,
356356
self_ty: Option<Ty<'tcx>>,
357357
constness: ty::BoundConstness,
@@ -406,14 +406,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
406406
struct SubstsForAstPathCtxt<'a, 'tcx> {
407407
astconv: &'a (dyn AstConv<'tcx> + 'a),
408408
def_id: DefId,
409-
generic_args: &'a GenericArgs<'a>,
409+
generic_args: &'a GenericArgs<'tcx>,
410410
span: Span,
411411
inferred_params: Vec<Span>,
412412
infer_args: bool,
413413
}
414414

415415
impl<'a, 'tcx> CreateSubstsForGenericArgsCtxt<'a, 'tcx> for SubstsForAstPathCtxt<'a, 'tcx> {
416-
fn args_for_def_id(&mut self, did: DefId) -> (Option<&'a GenericArgs<'a>>, bool) {
416+
fn args_for_def_id(&mut self, did: DefId) -> (Option<&'a GenericArgs<'tcx>>, bool) {
417417
if did == self.def_id {
418418
(Some(self.generic_args), self.infer_args)
419419
} else {
@@ -425,11 +425,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
425425
fn provided_kind(
426426
&mut self,
427427
param: &ty::GenericParamDef,
428-
arg: &GenericArg<'_>,
428+
arg: &GenericArg<'tcx>,
429429
) -> ty::GenericArg<'tcx> {
430430
let tcx = self.astconv.tcx();
431431

432-
let mut handle_ty_args = |has_default, ty: &hir::Ty<'_>| {
432+
let mut handle_ty_args = |has_default, ty: &hir::Ty<'tcx>| {
433433
if has_default {
434434
tcx.check_optional_stability(
435435
param.def_id,
@@ -592,7 +592,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
592592

593593
fn create_assoc_bindings_for_generic_args<'a>(
594594
&self,
595-
generic_args: &'a hir::GenericArgs<'_>,
595+
generic_args: &'a hir::GenericArgs<'tcx>,
596596
) -> Vec<ConvertedBinding<'a, 'tcx>> {
597597
// Convert associated-type bindings or constraints into a separate vector.
598598
// Example: Given this:
@@ -640,7 +640,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
640640
&self,
641641
span: Span,
642642
item_def_id: DefId,
643-
item_segment: &hir::PathSegment<'_>,
643+
item_segment: &hir::PathSegment<'tcx>,
644644
parent_args: GenericArgsRef<'tcx>,
645645
) -> GenericArgsRef<'tcx> {
646646
debug!(
@@ -673,7 +673,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
673673
/// are disallowed. Otherwise, they are pushed onto the vector given.
674674
pub fn instantiate_mono_trait_ref(
675675
&self,
676-
trait_ref: &hir::TraitRef<'_>,
676+
trait_ref: &hir::TraitRef<'tcx>,
677677
self_ty: Ty<'tcx>,
678678
) -> ty::TraitRef<'tcx> {
679679
self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1.iter(), |_| {});
@@ -710,7 +710,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
710710
#[instrument(level = "debug", skip(self, span, constness, bounds, speculative))]
711711
pub(crate) fn instantiate_poly_trait_ref(
712712
&self,
713-
trait_ref: &hir::TraitRef<'_>,
713+
trait_ref: &hir::TraitRef<'tcx>,
714714
span: Span,
715715
constness: ty::BoundConstness,
716716
polarity: ty::ImplPolarity,
@@ -788,7 +788,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
788788
span: Span,
789789
trait_def_id: DefId,
790790
self_ty: Ty<'tcx>,
791-
trait_segment: &hir::PathSegment<'_>,
791+
trait_segment: &hir::PathSegment<'tcx>,
792792
is_impl: bool,
793793
// FIXME(effects) move all host param things in astconv to hir lowering
794794
constness: ty::BoundConstness,
@@ -813,7 +813,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
813813
span: Span,
814814
trait_def_id: DefId,
815815
self_ty: Ty<'tcx>,
816-
trait_segment: &'a hir::PathSegment<'a>,
816+
trait_segment: &'a hir::PathSegment<'tcx>,
817817
is_impl: bool,
818818
constness: ty::BoundConstness,
819819
) -> (GenericArgsRef<'tcx>, GenericArgCountResult) {
@@ -847,7 +847,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
847847
&self,
848848
span: Span,
849849
did: DefId,
850-
item_segment: &hir::PathSegment<'_>,
850+
item_segment: &hir::PathSegment<'tcx>,
851851
) -> Ty<'tcx> {
852852
let tcx = self.tcx();
853853
let args = self.ast_path_args_for_ty(span, did, item_segment);
@@ -1153,7 +1153,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
11531153
span: Span,
11541154
qself_ty: Ty<'tcx>,
11551155
qself: &hir::Ty<'_>,
1156-
assoc_segment: &hir::PathSegment<'_>,
1156+
assoc_segment: &hir::PathSegment<'tcx>,
11571157
permit_variants: bool,
11581158
) -> Result<(Ty<'tcx>, DefKind, DefId), ErrorGuaranteed> {
11591159
let tcx = self.tcx();
@@ -1428,7 +1428,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
14281428
fn lookup_inherent_assoc_ty(
14291429
&self,
14301430
name: Ident,
1431-
segment: &hir::PathSegment<'_>,
1431+
segment: &hir::PathSegment<'tcx>,
14321432
adt_did: DefId,
14331433
self_ty: Ty<'tcx>,
14341434
block: hir::HirId,
@@ -1702,8 +1702,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
17021702
span: Span,
17031703
opt_self_ty: Option<Ty<'tcx>>,
17041704
item_def_id: DefId,
1705-
trait_segment: &hir::PathSegment<'_>,
1706-
item_segment: &hir::PathSegment<'_>,
1705+
trait_segment: &hir::PathSegment<'tcx>,
1706+
item_segment: &hir::PathSegment<'tcx>,
17071707
constness: ty::BoundConstness,
17081708
) -> Ty<'tcx> {
17091709
let tcx = self.tcx();
@@ -2021,7 +2021,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
20212021
pub fn res_to_ty(
20222022
&self,
20232023
opt_self_ty: Option<Ty<'tcx>>,
2024-
path: &hir::Path<'_>,
2024+
path: &hir::Path<'tcx>,
20252025
hir_id: hir::HirId,
20262026
permit_variants: bool,
20272027
) -> Ty<'tcx> {
@@ -2311,13 +2311,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
23112311

23122312
/// Parses the programmer's textual representation of a type into our
23132313
/// internal notion of a type.
2314-
pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty<'_>) -> Ty<'tcx> {
2314+
pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
23152315
self.ast_ty_to_ty_inner(ast_ty, false, false)
23162316
}
23172317

23182318
/// Parses the programmer's textual representation of a type into our
23192319
/// internal notion of a type. This is meant to be used within a path.
2320-
pub fn ast_ty_to_ty_in_path(&self, ast_ty: &hir::Ty<'_>) -> Ty<'tcx> {
2320+
pub fn ast_ty_to_ty_in_path(&self, ast_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
23212321
self.ast_ty_to_ty_inner(ast_ty, false, true)
23222322
}
23232323

@@ -2432,7 +2432,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
24322432
/// Turns a `hir::Ty` into a `Ty`. For diagnostics' purposes we keep track of whether trait
24332433
/// objects are borrowed like `&dyn Trait` to avoid emitting redundant errors.
24342434
#[instrument(level = "debug", skip(self), ret)]
2435-
fn ast_ty_to_ty_inner(&self, ast_ty: &hir::Ty<'_>, borrowed: bool, in_path: bool) -> Ty<'tcx> {
2435+
fn ast_ty_to_ty_inner(
2436+
&self,
2437+
ast_ty: &hir::Ty<'tcx>,
2438+
borrowed: bool,
2439+
in_path: bool,
2440+
) -> Ty<'tcx> {
24362441
let tcx = self.tcx();
24372442

24382443
let result_ty = match &ast_ty.kind {
@@ -2609,7 +2614,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
26092614
}
26102615
}
26112616

2612-
pub fn ty_of_arg(&self, ty: &hir::Ty<'_>, expected_ty: Option<Ty<'tcx>>) -> Ty<'tcx> {
2617+
pub fn ty_of_arg(&self, ty: &hir::Ty<'tcx>, expected_ty: Option<Ty<'tcx>>) -> Ty<'tcx> {
26132618
match ty.kind {
26142619
hir::TyKind::Infer if expected_ty.is_some() => {
26152620
self.record_ty(ty.hir_id, expected_ty.unwrap(), ty.span);
@@ -2625,7 +2630,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
26252630
hir_id: hir::HirId,
26262631
unsafety: hir::Unsafety,
26272632
abi: abi::Abi,
2628-
decl: &hir::FnDecl<'_>,
2633+
decl: &hir::FnDecl<'tcx>,
26292634
generics: Option<&hir::Generics<'_>>,
26302635
hir_ty: Option<&hir::Ty<'_>>,
26312636
) -> ty::PolyFnSig<'tcx> {

‎compiler/rustc_hir_analysis/src/astconv/object_safety.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2222
&self,
2323
span: Span,
2424
hir_id: hir::HirId,
25-
hir_trait_bounds: &[hir::PolyTraitRef<'_>],
25+
hir_trait_bounds: &[hir::PolyTraitRef<'tcx>],
2626
lifetime: &hir::Lifetime,
2727
borrowed: bool,
2828
representation: DynKind,

‎compiler/rustc_hir_analysis/src/check/wfcheck.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ fn receiver_is_implemented<'tcx>(
17901790
fn check_variances_for_type_defn<'tcx>(
17911791
tcx: TyCtxt<'tcx>,
17921792
item: &hir::Item<'tcx>,
1793-
hir_generics: &hir::Generics<'_>,
1793+
hir_generics: &hir::Generics<'tcx>,
17941794
) {
17951795
let identity_args = ty::GenericArgs::identity_for_item(tcx, item.owner_id);
17961796

‎compiler/rustc_hir_analysis/src/collect.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl<'tcx> ItemCtxt<'tcx> {
348348
ItemCtxt { tcx, item_def_id, tainted_by_errors: Cell::new(None) }
349349
}
350350

351-
pub fn to_ty(&self, ast_ty: &hir::Ty<'_>) -> Ty<'tcx> {
351+
pub fn to_ty(&self, ast_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
352352
self.astconv().ast_ty_to_ty(ast_ty)
353353
}
354354

@@ -412,7 +412,7 @@ impl<'tcx> AstConv<'tcx> for ItemCtxt<'tcx> {
412412
&self,
413413
span: Span,
414414
item_def_id: DefId,
415-
item_segment: &hir::PathSegment<'_>,
415+
item_segment: &hir::PathSegment<'tcx>,
416416
poly_trait_ref: ty::PolyTraitRef<'tcx>,
417417
) -> Ty<'tcx> {
418418
if let Some(trait_ref) = poly_trait_ref.no_bound_vars() {
@@ -1148,7 +1148,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<ty::PolyFnSig<
11481148

11491149
fn infer_return_ty_for_fn_sig<'tcx>(
11501150
tcx: TyCtxt<'tcx>,
1151-
sig: &hir::FnSig<'_>,
1151+
sig: &hir::FnSig<'tcx>,
11521152
generics: &hir::Generics<'_>,
11531153
def_id: LocalDefId,
11541154
icx: &ItemCtxt<'tcx>,
@@ -1352,14 +1352,14 @@ fn impl_trait_ref(
13521352
let last_arg = args.args.len() - 1;
13531353
assert!(matches!(args.args[last_arg], hir::GenericArg::Const(anon_const) if anon_const.is_desugared_from_effects));
13541354
args.args = &args.args[..args.args.len() - 1];
1355-
path_segments[last_segment].args = Some(&args);
1355+
path_segments[last_segment].args = Some(tcx.hir_arena.alloc(args));
13561356
let path = hir::Path {
13571357
span: ast_trait_ref.path.span,
13581358
res: ast_trait_ref.path.res,
1359-
segments: &path_segments,
1359+
segments: tcx.hir_arena.alloc_slice(&path_segments),
13601360
};
1361-
let trait_ref = hir::TraitRef { path: &path, hir_ref_id: ast_trait_ref.hir_ref_id };
1362-
icx.astconv().instantiate_mono_trait_ref(&trait_ref, selfty)
1361+
let trait_ref = tcx.hir_arena.alloc(hir::TraitRef { path: tcx.hir_arena.alloc(path), hir_ref_id: ast_trait_ref.hir_ref_id });
1362+
icx.astconv().instantiate_mono_trait_ref(trait_ref, selfty)
13631363
} else {
13641364
icx.astconv().instantiate_mono_trait_ref(ast_trait_ref, selfty)
13651365
}

‎compiler/rustc_hir_analysis/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
221221

222222
/// A quasi-deprecated helper used in rustdoc and clippy to get
223223
/// the type from a HIR node.
224-
pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
224+
pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
225225
// In case there are any projections, etc., find the "environment"
226226
// def-ID that will be used to determine the traits/predicates in
227227
// scope. This is derived from the enclosing item-like thing.
@@ -232,7 +232,7 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
232232

233233
pub fn hir_trait_to_predicates<'tcx>(
234234
tcx: TyCtxt<'tcx>,
235-
hir_trait: &hir::TraitRef<'_>,
235+
hir_trait: &hir::TraitRef<'tcx>,
236236
self_ty: Ty<'tcx>,
237237
) -> Bounds<'tcx> {
238238
// In case there are any projections, etc., find the "environment"

‎compiler/rustc_hir_typeck/src/closure.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
373373
fn sig_of_closure(
374374
&self,
375375
expr_def_id: LocalDefId,
376-
decl: &hir::FnDecl<'_>,
376+
decl: &hir::FnDecl<'tcx>,
377377
closure_kind: hir::ClosureKind,
378378
expected_sig: Option<ExpectedSig<'tcx>>,
379379
) -> ClosureSignatures<'tcx> {
@@ -390,7 +390,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
390390
fn sig_of_closure_no_expectation(
391391
&self,
392392
expr_def_id: LocalDefId,
393-
decl: &hir::FnDecl<'_>,
393+
decl: &hir::FnDecl<'tcx>,
394394
closure_kind: hir::ClosureKind,
395395
) -> ClosureSignatures<'tcx> {
396396
let bound_sig = self.supplied_sig_of_closure(expr_def_id, decl, closure_kind);
@@ -449,7 +449,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
449449
fn sig_of_closure_with_expectation(
450450
&self,
451451
expr_def_id: LocalDefId,
452-
decl: &hir::FnDecl<'_>,
452+
decl: &hir::FnDecl<'tcx>,
453453
closure_kind: hir::ClosureKind,
454454
expected_sig: ExpectedSig<'tcx>,
455455
) -> ClosureSignatures<'tcx> {
@@ -506,7 +506,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
506506
fn sig_of_closure_with_mismatched_number_of_arguments(
507507
&self,
508508
expr_def_id: LocalDefId,
509-
decl: &hir::FnDecl<'_>,
509+
decl: &hir::FnDecl<'tcx>,
510510
expected_sig: ExpectedSig<'tcx>,
511511
) -> ClosureSignatures<'tcx> {
512512
let expr_map_node = self.tcx.hir_node_by_def_id(expr_def_id);
@@ -547,7 +547,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
547547
fn merge_supplied_sig_with_expectation(
548548
&self,
549549
expr_def_id: LocalDefId,
550-
decl: &hir::FnDecl<'_>,
550+
decl: &hir::FnDecl<'tcx>,
551551
closure_kind: hir::ClosureKind,
552552
mut expected_sigs: ClosureSignatures<'tcx>,
553553
) -> InferResult<'tcx, ClosureSignatures<'tcx>> {
@@ -641,7 +641,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
641641
fn supplied_sig_of_closure(
642642
&self,
643643
expr_def_id: LocalDefId,
644-
decl: &hir::FnDecl<'_>,
644+
decl: &hir::FnDecl<'tcx>,
645645
closure_kind: hir::ClosureKind,
646646
) -> ty::PolyFnSig<'tcx> {
647647
let astconv: &dyn AstConv<'_> = self;
@@ -843,7 +843,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
843843
/// all parameters are of type `ty::Error`.
844844
fn error_sig_of_closure(
845845
&self,
846-
decl: &hir::FnDecl<'_>,
846+
decl: &hir::FnDecl<'tcx>,
847847
guar: ErrorGuaranteed,
848848
) -> ty::PolyFnSig<'tcx> {
849849
let astconv: &dyn AstConv<'_> = self;

‎compiler/rustc_hir_typeck/src/expr.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13151315
fn check_method_call(
13161316
&self,
13171317
expr: &'tcx hir::Expr<'tcx>,
1318-
segment: &hir::PathSegment<'_>,
1318+
segment: &'tcx hir::PathSegment<'tcx>,
13191319
rcvr: &'tcx hir::Expr<'tcx>,
13201320
args: &'tcx [hir::Expr<'tcx>],
13211321
expected: Expectation<'tcx>,
@@ -1627,7 +1627,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16271627
&self,
16281628
expr: &hir::Expr<'_>,
16291629
expected: Expectation<'tcx>,
1630-
qpath: &QPath<'_>,
1630+
qpath: &QPath<'tcx>,
16311631
fields: &'tcx [hir::ExprField<'tcx>],
16321632
base_expr: &'tcx Option<&'tcx hir::Expr<'tcx>>,
16331633
) -> Ty<'tcx> {

‎compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
377377
RawTy { raw: ty, normalized: self.normalize(span, ty) }
378378
}
379379

380-
pub fn to_ty(&self, ast_t: &hir::Ty<'_>) -> RawTy<'tcx> {
380+
pub fn to_ty(&self, ast_t: &hir::Ty<'tcx>) -> RawTy<'tcx> {
381381
let t = self.astconv().ast_ty_to_ty(ast_t);
382382
self.register_wf_obligation(t.into(), ast_t.span, traits::WellFormed(None));
383383
self.handle_raw_ty(ast_t.span, t)
384384
}
385385

386-
pub fn to_ty_saving_user_provided_ty(&self, ast_ty: &hir::Ty<'_>) -> Ty<'tcx> {
386+
pub fn to_ty_saving_user_provided_ty(&self, ast_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
387387
let ty = self.to_ty(ast_ty);
388388
debug!("to_ty_saving_user_provided_ty: ty={:?}", ty);
389389

@@ -1073,7 +1073,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10731073
#[instrument(skip(self, span), level = "debug")]
10741074
pub fn instantiate_value_path(
10751075
&self,
1076-
segments: &[hir::PathSegment<'_>],
1076+
segments: &'tcx [hir::PathSegment<'tcx>],
10771077
self_ty: Option<RawTy<'tcx>>,
10781078
res: Res,
10791079
span: Span,
@@ -1260,13 +1260,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12601260
span: Span,
12611261
path_segs: &'a [PathSeg],
12621262
infer_args_for_err: &'a FxHashSet<usize>,
1263-
segments: &'a [hir::PathSegment<'a>],
1263+
segments: &'tcx [hir::PathSegment<'tcx>],
12641264
}
12651265
impl<'tcx, 'a> CreateSubstsForGenericArgsCtxt<'a, 'tcx> for CreateCtorSubstsContext<'a, 'tcx> {
12661266
fn args_for_def_id(
12671267
&mut self,
12681268
def_id: DefId,
1269-
) -> (Option<&'a hir::GenericArgs<'a>>, bool) {
1269+
) -> (Option<&'a hir::GenericArgs<'tcx>>, bool) {
12701270
if let Some(&PathSeg(_, index)) =
12711271
self.path_segs.iter().find(|&PathSeg(did, _)| *did == def_id)
12721272
{
@@ -1287,7 +1287,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12871287
fn provided_kind(
12881288
&mut self,
12891289
param: &ty::GenericParamDef,
1290-
arg: &GenericArg<'_>,
1290+
arg: &GenericArg<'tcx>,
12911291
) -> ty::GenericArg<'tcx> {
12921292
match (&param.kind, arg) {
12931293
(GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {

‎compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13271327

13281328
pub fn check_struct_path(
13291329
&self,
1330-
qpath: &QPath<'_>,
1330+
qpath: &QPath<'tcx>,
13311331
hir_id: hir::HirId,
13321332
) -> Result<(&'tcx ty::VariantDef, Ty<'tcx>), ErrorGuaranteed> {
13331333
let path_span = qpath.span();
@@ -1783,7 +1783,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17831783
// The newly resolved definition is written into `type_dependent_defs`.
17841784
fn finish_resolving_struct_path(
17851785
&self,
1786-
qpath: &QPath<'_>,
1786+
qpath: &QPath<'tcx>,
17871787
path_span: Span,
17881788
hir_id: hir::HirId,
17891789
) -> (Res, RawTy<'tcx>) {

‎compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
283283
&self,
284284
span: Span,
285285
item_def_id: DefId,
286-
item_segment: &hir::PathSegment<'_>,
286+
item_segment: &hir::PathSegment<'tcx>,
287287
poly_trait_ref: ty::PolyTraitRef<'tcx>,
288288
) -> Ty<'tcx> {
289289
let trait_ref = self.instantiate_binder_with_fresh_vars(

‎compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
784784
pub(in super::super) fn suggest_missing_return_type(
785785
&self,
786786
err: &mut Diagnostic,
787-
fn_decl: &hir::FnDecl<'_>,
787+
fn_decl: &hir::FnDecl<'tcx>,
788788
expected: Ty<'tcx>,
789789
found: Ty<'tcx>,
790790
can_suggest: bool,
@@ -995,7 +995,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
995995
&self,
996996
err: &mut Diagnostic,
997997
expr: &'tcx hir::Expr<'tcx>,
998-
fn_decl: &hir::FnDecl<'_>,
998+
fn_decl: &hir::FnDecl<'tcx>,
999999
expected: Ty<'tcx>,
10001000
found: Ty<'tcx>,
10011001
id: hir::HirId,
@@ -1468,7 +1468,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14681468
pub(crate) fn suggest_associated_const(
14691469
&self,
14701470
err: &mut Diagnostic,
1471-
expr: &hir::Expr<'_>,
1471+
expr: &hir::Expr<'tcx>,
14721472
expected_ty: Ty<'tcx>,
14731473
) -> bool {
14741474
let Some((DefKind::AssocFn, old_def_id)) =

‎compiler/rustc_hir_typeck/src/method/confirm.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5050
call_expr: &'tcx hir::Expr<'tcx>,
5151
unadjusted_self_ty: Ty<'tcx>,
5252
pick: &probe::Pick<'tcx>,
53-
segment: &hir::PathSegment<'_>,
53+
segment: &'tcx hir::PathSegment<'tcx>,
5454
) -> ConfirmResult<'tcx> {
5555
debug!(
5656
"confirm(unadjusted_self_ty={:?}, pick={:?}, generic_args={:?})",
@@ -68,7 +68,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
6868
call_expr: &'tcx hir::Expr<'tcx>,
6969
unadjusted_self_ty: Ty<'tcx>,
7070
pick: &probe::Pick<'tcx>,
71-
segment: &hir::PathSegment<'_>,
71+
segment: &hir::PathSegment<'tcx>,
7272
) -> ConfirmResult<'tcx> {
7373
let mut confirm_cx = ConfirmContext::new(self, span, self_expr, call_expr);
7474
confirm_cx.skip_record_for_diagnostics = true;
@@ -90,7 +90,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
9090
&mut self,
9191
unadjusted_self_ty: Ty<'tcx>,
9292
pick: &probe::Pick<'tcx>,
93-
segment: &hir::PathSegment<'_>,
93+
segment: &hir::PathSegment<'tcx>,
9494
) -> ConfirmResult<'tcx> {
9595
// Adjust the self expression the user provided and obtain the adjusted type.
9696
let self_ty = self.adjust_self_ty(unadjusted_self_ty, pick);
@@ -346,7 +346,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
346346
fn instantiate_method_args(
347347
&mut self,
348348
pick: &probe::Pick<'tcx>,
349-
seg: &hir::PathSegment<'_>,
349+
seg: &hir::PathSegment<'tcx>,
350350
parent_args: GenericArgsRef<'tcx>,
351351
) -> GenericArgsRef<'tcx> {
352352
// Determine the values for the generic parameters of the method.
@@ -370,13 +370,13 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
370370
struct MethodSubstsCtxt<'a, 'tcx> {
371371
cfcx: &'a ConfirmContext<'a, 'tcx>,
372372
pick: &'a probe::Pick<'tcx>,
373-
seg: &'a hir::PathSegment<'a>,
373+
seg: &'a hir::PathSegment<'tcx>,
374374
}
375375
impl<'a, 'tcx> CreateSubstsForGenericArgsCtxt<'a, 'tcx> for MethodSubstsCtxt<'a, 'tcx> {
376376
fn args_for_def_id(
377377
&mut self,
378378
def_id: DefId,
379-
) -> (Option<&'a hir::GenericArgs<'a>>, bool) {
379+
) -> (Option<&'a hir::GenericArgs<'tcx>>, bool) {
380380
if def_id == self.pick.item.def_id {
381381
if let Some(data) = self.seg.args {
382382
return (Some(data), false);
@@ -388,7 +388,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
388388
fn provided_kind(
389389
&mut self,
390390
param: &ty::GenericParamDef,
391-
arg: &GenericArg<'_>,
391+
arg: &GenericArg<'tcx>,
392392
) -> ty::GenericArg<'tcx> {
393393
match (&param.kind, arg) {
394394
(GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {

‎compiler/rustc_hir_typeck/src/method/mod.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
177177
pub fn lookup_method(
178178
&self,
179179
self_ty: Ty<'tcx>,
180-
segment: &hir::PathSegment<'_>,
180+
segment: &'tcx hir::PathSegment<'tcx>,
181181
span: Span,
182182
call_expr: &'tcx hir::Expr<'tcx>,
183183
self_expr: &'tcx hir::Expr<'tcx>,
@@ -255,7 +255,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
255255
pub fn lookup_method_for_diagnostic(
256256
&self,
257257
self_ty: Ty<'tcx>,
258-
segment: &hir::PathSegment<'_>,
258+
segment: &hir::PathSegment<'tcx>,
259259
span: Span,
260260
call_expr: &'tcx hir::Expr<'tcx>,
261261
self_expr: &'tcx hir::Expr<'tcx>,

‎compiler/rustc_hir_typeck/src/pat.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
858858
fn check_pat_struct(
859859
&self,
860860
pat: &'tcx Pat<'tcx>,
861-
qpath: &hir::QPath<'_>,
861+
qpath: &hir::QPath<'tcx>,
862862
fields: &'tcx [hir::PatField<'tcx>],
863863
has_rest_pat: bool,
864864
expected: Ty<'tcx>,

‎src/tools/clippy/clippy_lints/src/default_union_representation.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultUnionRepresentation {
7575
/// (ZST fields having an arbitrary offset is completely inconsequential, and
7676
/// if there is only one field left after ignoring ZST fields then the offset
7777
/// of that field does not matter either.)
78-
fn is_union_with_two_non_zst_fields(cx: &LateContext<'_>, item: &Item<'_>) -> bool {
78+
fn is_union_with_two_non_zst_fields<'tcx>(cx: &LateContext<'tcx>, item: &Item<'tcx>) -> bool {
7979
if let ItemKind::Union(..) = &item.kind
8080
&& let ty::Adt(adt_def, args) = cx.tcx.type_of(item.owner_id).instantiate_identity().kind()
8181
{

‎src/tools/clippy/clippy_lints/src/implicit_hasher.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ enum ImplicitHasherType<'tcx> {
210210

211211
impl<'tcx> ImplicitHasherType<'tcx> {
212212
/// Checks that `ty` is a target type without a `BuildHasher`.
213-
fn new(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'_>) -> Option<Self> {
213+
fn new(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>) -> Option<Self> {
214214
if let TyKind::Path(QPath::Resolved(None, path)) = hir_ty.kind {
215215
let params: Vec<_> = path
216216
.segments

‎src/tools/clippy/clippy_lints/src/types/mod.rs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ impl_lint_pass!(Types => [BOX_COLLECTION, VEC_BOX, OPTION_OPTION, LINKEDLIST, BO
314314
impl<'tcx> LateLintPass<'tcx> for Types {
315315
fn check_fn(
316316
&mut self,
317-
cx: &LateContext<'_>,
317+
cx: &LateContext<'tcx>,
318318
fn_kind: FnKind<'_>,
319-
decl: &FnDecl<'_>,
319+
decl: &FnDecl<'tcx>,
320320
_: &Body<'_>,
321321
_: Span,
322322
def_id: LocalDefId,
@@ -346,7 +346,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
346346
);
347347
}
348348

349-
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
349+
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
350350
let is_exported = cx.effective_visibilities.is_exported(item.owner_id.def_id);
351351

352352
match item.kind {
@@ -363,7 +363,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
363363
}
364364
}
365365

366-
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
366+
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'tcx>) {
367367
match item.kind {
368368
ImplItemKind::Const(ty, _) => {
369369
let is_in_trait_impl = if let Some(hir::Node::Item(item)) = cx
@@ -391,7 +391,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
391391
}
392392
}
393393

394-
fn check_field_def(&mut self, cx: &LateContext<'_>, field: &hir::FieldDef<'_>) {
394+
fn check_field_def(&mut self, cx: &LateContext<'tcx>, field: &hir::FieldDef<'tcx>) {
395395
let is_exported = cx.effective_visibilities.is_exported(field.def_id);
396396

397397
self.check_ty(
@@ -404,7 +404,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
404404
);
405405
}
406406

407-
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &TraitItem<'_>) {
407+
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &TraitItem<'tcx>) {
408408
let is_exported = cx.effective_visibilities.is_exported(item.owner_id.def_id);
409409

410410
let context = CheckTyContext {
@@ -421,7 +421,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
421421
}
422422
}
423423

424-
fn check_local(&mut self, cx: &LateContext<'_>, local: &Local<'_>) {
424+
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &Local<'tcx>) {
425425
if let Some(ty) = local.ty {
426426
self.check_ty(
427427
cx,
@@ -444,7 +444,7 @@ impl Types {
444444
}
445445
}
446446

447-
fn check_fn_decl(&mut self, cx: &LateContext<'_>, decl: &FnDecl<'_>, context: CheckTyContext) {
447+
fn check_fn_decl<'tcx>(&mut self, cx: &LateContext<'tcx>, decl: &FnDecl<'tcx>, context: CheckTyContext) {
448448
// Ignore functions in trait implementations as they are usually forced by the trait definition.
449449
//
450450
// FIXME: ideally we would like to warn *if the complicated type can be simplified*, but it's hard
@@ -466,7 +466,7 @@ impl Types {
466466
/// lint found.
467467
///
468468
/// The parameter `is_local` distinguishes the context of the type.
469-
fn check_ty(&mut self, cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, mut context: CheckTyContext) {
469+
fn check_ty<'tcx>(&mut self, cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>, mut context: CheckTyContext) {
470470
if hir_ty.span.from_expansion() {
471471
return;
472472
}

‎src/tools/clippy/clippy_lints/src/types/redundant_allocation.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_span::symbol::sym;
1111

1212
use super::{utils, REDUNDANT_ALLOCATION};
1313

14-
pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, qpath: &QPath<'_>, def_id: DefId) -> bool {
14+
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>, qpath: &QPath<'tcx>, def_id: DefId) -> bool {
1515
let mut applicability = Applicability::MaybeIncorrect;
1616
let outer_sym = if Some(def_id) == cx.tcx.lang_items().owned_box() {
1717
"Box"

‎src/tools/clippy/clippy_lints/src/types/vec_box.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ use rustc_span::symbol::sym;
1313

1414
use super::VEC_BOX;
1515

16-
pub(super) fn check(
17-
cx: &LateContext<'_>,
16+
pub(super) fn check<'tcx>(
17+
cx: &LateContext<'tcx>,
1818
hir_ty: &hir::Ty<'_>,
19-
qpath: &QPath<'_>,
19+
qpath: &QPath<'tcx>,
2020
def_id: DefId,
2121
box_size_threshold: u64,
2222
) -> bool {

‎src/tools/clippy/clippy_lints/src/unconditional_recursion.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn get_ty_def_id(ty: Ty<'_>) -> Option<DefId> {
7777
}
7878
}
7979

80-
fn get_hir_ty_def_id(tcx: TyCtxt<'_>, hir_ty: rustc_hir::Ty<'_>) -> Option<DefId> {
80+
fn get_hir_ty_def_id<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: rustc_hir::Ty<'tcx>) -> Option<DefId> {
8181
let TyKind::Path(qpath) = hir_ty.kind else { return None };
8282
match qpath {
8383
QPath::Resolved(_, path) => path.res.opt_def_id(),
@@ -229,7 +229,7 @@ fn check_to_string(cx: &LateContext<'_>, method_span: Span, method_def_id: Local
229229
}
230230
}
231231

232-
fn is_default_method_on_current_ty(tcx: TyCtxt<'_>, qpath: QPath<'_>, implemented_ty_id: DefId) -> bool {
232+
fn is_default_method_on_current_ty<'tcx>(tcx: TyCtxt<'tcx>, qpath: QPath<'tcx>, implemented_ty_id: DefId) -> bool {
233233
match qpath {
234234
QPath::Resolved(_, path) => match path.segments {
235235
[first, .., last] => last.ident.name == kw::Default && first.res.opt_def_id() == Some(implemented_ty_id),

‎src/tools/clippy/clippy_lints/src/uninhabited_references.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ impl LateLintPass<'_> for UninhabitedReferences {
5757
}
5858
}
5959

60-
fn check_fn(
60+
fn check_fn<'tcx>(
6161
&mut self,
62-
cx: &LateContext<'_>,
62+
cx: &LateContext<'tcx>,
6363
kind: FnKind<'_>,
64-
fndecl: &'_ FnDecl<'_>,
64+
fndecl: &'_ FnDecl<'tcx>,
6565
_: &'_ Body<'_>,
6666
span: Span,
6767
_: LocalDefId,

‎src/tools/clippy/clippy_lints/src/use_self.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
207207
}
208208
}
209209

210-
fn check_ty(&mut self, cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>) {
210+
fn check_ty(&mut self, cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>) {
211211
if !hir_ty.span.from_expansion()
212212
&& self.msrv.meets(msrvs::TYPE_ALIAS_ENUM_VARIANTS)
213213
&& let Some(&StackItem::Check {

‎src/tools/clippy/clippy_lints/src/zero_sized_map_values.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ declare_clippy_lint! {
4444
declare_lint_pass!(ZeroSizedMapValues => [ZERO_SIZED_MAP_VALUES]);
4545

4646
impl LateLintPass<'_> for ZeroSizedMapValues {
47-
fn check_ty(&mut self, cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>) {
47+
fn check_ty<'tcx>(&mut self, cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>) {
4848
if !hir_ty.span.from_expansion()
4949
&& !in_trait_impl(cx, hir_ty.hir_id)
5050
&& let ty = ty_from_hir_ty(cx, hir_ty)
@@ -82,7 +82,7 @@ fn in_trait_impl(cx: &LateContext<'_>, hir_id: HirId) -> bool {
8282
false
8383
}
8484

85-
fn ty_from_hir_ty<'tcx>(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
85+
fn ty_from_hir_ty<'tcx>(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
8686
cx.maybe_typeck_results()
8787
.and_then(|results| {
8888
if results.hir_owner == hir_ty.hir_id.owner {

0 commit comments

Comments
 (0)
Please sign in to comment.