Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk
rustc: Remove needless lifetimes
This commit is contained in:
commit
d23cb738d2
109 changed files with 266 additions and 320 deletions
|
@ -490,10 +490,10 @@ fn check_unused_unsafe(
|
|||
unused_unsafes
|
||||
}
|
||||
|
||||
fn unsafety_check_result<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn unsafety_check_result(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx UnsafetyCheckResult {
|
||||
) -> &UnsafetyCheckResult {
|
||||
debug!("unsafety_violations({:?})", def);
|
||||
|
||||
// N.B., this borrow is valid because all the consumers of
|
||||
|
|
|
@ -533,10 +533,10 @@ fn make_code_region(
|
|||
}
|
||||
}
|
||||
|
||||
fn fn_sig_and_body<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn fn_sig_and_body(
|
||||
tcx: TyCtxt<'_>,
|
||||
def_id: DefId,
|
||||
) -> (Option<&'tcx rustc_hir::FnSig<'tcx>>, &'tcx rustc_hir::Body<'tcx>) {
|
||||
) -> (Option<&rustc_hir::FnSig<'_>>, &rustc_hir::Body<'_>) {
|
||||
// FIXME(#79625): Consider improving MIR to provide the information needed, to avoid going back
|
||||
// to HIR for it.
|
||||
let hir_node = tcx.hir().get_if_local(def_id).expect("expected DefId is local");
|
||||
|
|
|
@ -136,7 +136,7 @@ fn coverageinfo<'tcx>(tcx: TyCtxt<'tcx>, instance_def: ty::InstanceDef<'tcx>) ->
|
|||
coverage_visitor.info
|
||||
}
|
||||
|
||||
fn covered_code_regions<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Vec<&'tcx CodeRegion> {
|
||||
fn covered_code_regions(tcx: TyCtxt<'_>, def_id: DefId) -> Vec<&CodeRegion> {
|
||||
let body = mir_body(tcx, def_id);
|
||||
body.basic_blocks
|
||||
.iter()
|
||||
|
@ -163,7 +163,7 @@ fn is_inlined(body: &Body<'_>, statement: &Statement<'_>) -> bool {
|
|||
/// This function ensures we obtain the correct MIR for the given item irrespective of
|
||||
/// whether that means const mir or runtime mir. For `const fn` this opts for runtime
|
||||
/// mir.
|
||||
fn mir_body<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx mir::Body<'tcx> {
|
||||
fn mir_body(tcx: TyCtxt<'_>, def_id: DefId) -> &mir::Body<'_> {
|
||||
let id = ty::WithOptConstParam::unknown(def_id);
|
||||
let def = ty::InstanceDef::Item(id);
|
||||
tcx.instance_mir(def)
|
||||
|
|
|
@ -169,7 +169,7 @@ impl<'tcx> MockBlocks<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn debug_basic_blocks<'tcx>(mir_body: &Body<'tcx>) -> String {
|
||||
fn debug_basic_blocks(mir_body: &Body<'_>) -> String {
|
||||
format!(
|
||||
"{:?}",
|
||||
mir_body
|
||||
|
|
|
@ -129,7 +129,7 @@ impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
|
|||
}
|
||||
|
||||
/// Returns true if values of a given type will never be passed indirectly, regardless of ABI.
|
||||
fn type_will_always_be_passed_directly<'tcx>(ty: Ty<'tcx>) -> bool {
|
||||
fn type_will_always_be_passed_directly(ty: Ty<'_>) -> bool {
|
||||
matches!(
|
||||
ty.kind(),
|
||||
ty::Bool
|
||||
|
|
|
@ -658,7 +658,7 @@ impl WriteInfo {
|
|||
}
|
||||
}
|
||||
|
||||
fn add_place<'tcx>(&mut self, place: Place<'tcx>) {
|
||||
fn add_place(&mut self, place: Place<'_>) {
|
||||
self.writes.push(place.local);
|
||||
}
|
||||
|
||||
|
|
|
@ -266,10 +266,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) ->
|
|||
/// Make MIR ready for const evaluation. This is run on all MIR, not just on consts!
|
||||
/// FIXME(oli-obk): it's unclear whether we still need this phase (and its corresponding query).
|
||||
/// We used to have this for pre-miri MIR based const eval.
|
||||
fn mir_const<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx Steal<Body<'tcx>> {
|
||||
fn mir_const(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> &Steal<Body<'_>> {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_const(def);
|
||||
}
|
||||
|
@ -308,10 +305,10 @@ fn mir_const<'tcx>(
|
|||
}
|
||||
|
||||
/// Compute the main MIR body and the list of MIR bodies of the promoteds.
|
||||
fn mir_promoted<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn mir_promoted(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> (&'tcx Steal<Body<'tcx>>, &'tcx Steal<IndexVec<Promoted, Body<'tcx>>>) {
|
||||
) -> (&Steal<Body<'_>>, &Steal<IndexVec<Promoted, Body<'_>>>) {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_promoted(def);
|
||||
}
|
||||
|
@ -350,7 +347,7 @@ fn mir_promoted<'tcx>(
|
|||
}
|
||||
|
||||
/// Compute the MIR that is used during CTFE (and thus has no optimizations run on it)
|
||||
fn mir_for_ctfe<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Body<'tcx> {
|
||||
fn mir_for_ctfe(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
|
||||
let did = def_id.expect_local();
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(did, tcx) {
|
||||
tcx.mir_for_ctfe_of_const_arg(def)
|
||||
|
@ -364,10 +361,7 @@ fn mir_for_ctfe<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Body<'tcx> {
|
|||
/// we'd get cycle errors with `mir_for_ctfe`, because typeck would need to typeck
|
||||
/// the const parameter while type checking the main body, which in turn would try
|
||||
/// to type check the main body again.
|
||||
fn mir_for_ctfe_of_const_arg<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
(did, param_did): (LocalDefId, DefId),
|
||||
) -> &'tcx Body<'tcx> {
|
||||
fn mir_for_ctfe_of_const_arg(tcx: TyCtxt<'_>, (did, param_did): (LocalDefId, DefId)) -> &Body<'_> {
|
||||
tcx.arena.alloc(inner_mir_for_ctfe(
|
||||
tcx,
|
||||
ty::WithOptConstParam { did, const_param_did: Some(param_did) },
|
||||
|
@ -424,10 +418,10 @@ fn inner_mir_for_ctfe(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -
|
|||
/// Obtain just the main MIR (no promoteds) and run some cleanups on it. This also runs
|
||||
/// mir borrowck *before* doing so in order to ensure that borrowck can be run and doesn't
|
||||
/// end up missing the source MIR due to stealing happening.
|
||||
fn mir_drops_elaborated_and_const_checked<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn mir_drops_elaborated_and_const_checked(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx Steal<Body<'tcx>> {
|
||||
) -> &Steal<Body<'_>> {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_drops_elaborated_and_const_checked(def);
|
||||
}
|
||||
|
@ -597,7 +591,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
|||
}
|
||||
|
||||
/// Optimize the MIR and prepare it for codegen.
|
||||
fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> &'tcx Body<'tcx> {
|
||||
fn optimized_mir(tcx: TyCtxt<'_>, did: DefId) -> &Body<'_> {
|
||||
let did = did.expect_local();
|
||||
assert_eq!(ty::WithOptConstParam::try_lookup(did, tcx), None);
|
||||
tcx.arena.alloc(inner_optimized_mir(tcx, did))
|
||||
|
@ -634,10 +628,10 @@ fn inner_optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> Body<'_> {
|
|||
|
||||
/// Fetch all the promoteds of an item and prepare their MIR bodies to be ready for
|
||||
/// constant evaluation once all substitutions become known.
|
||||
fn promoted_mir<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn promoted_mir(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx IndexVec<Promoted, Body<'tcx>> {
|
||||
) -> &IndexVec<Promoted, Body<'_>> {
|
||||
if tcx.is_constructor(def.did.to_def_id()) {
|
||||
return tcx.arena.alloc(IndexVec::new());
|
||||
}
|
||||
|
|
|
@ -532,7 +532,7 @@ struct VarField<'tcx> {
|
|||
}
|
||||
|
||||
/// Match on `((_LOCAL as Variant).FIELD: TY)`.
|
||||
fn match_variant_field_place<'tcx>(place: Place<'tcx>) -> Option<(Local, VarField<'tcx>)> {
|
||||
fn match_variant_field_place(place: Place<'_>) -> Option<(Local, VarField<'_>)> {
|
||||
match place.as_ref() {
|
||||
PlaceRef {
|
||||
local,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue