rustc: Remove needless lifetimes
This commit is contained in:
parent
65bd2a6a73
commit
3dde32ca97
109 changed files with 266 additions and 320 deletions
|
@ -81,8 +81,8 @@ pub(in crate::build) struct PlaceBuilder<'tcx> {
|
|||
/// ProjectionElems `Downcast`, `ConstantIndex`, `Index`, or `Subslice` because those will never be
|
||||
/// part of a path that is captured by a closure. We stop applying projections once we see the first
|
||||
/// projection that isn't captured by a closure.
|
||||
fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
|
||||
mir_projections: &[PlaceElem<'tcx>],
|
||||
fn convert_to_hir_projections_and_truncate_for_capture(
|
||||
mir_projections: &[PlaceElem<'_>],
|
||||
) -> Vec<HirProjectionKind> {
|
||||
let mut hir_projections = Vec::new();
|
||||
let mut variant = None;
|
||||
|
|
|
@ -28,10 +28,10 @@ use rustc_target::spec::abi::Abi;
|
|||
|
||||
use super::lints;
|
||||
|
||||
pub(crate) fn mir_built<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(crate) fn mir_built(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx rustc_data_structures::steal::Steal<Body<'tcx>> {
|
||||
) -> &rustc_data_structures::steal::Steal<Body<'_>> {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_built(def);
|
||||
}
|
||||
|
@ -625,12 +625,12 @@ fn construct_const<'a, 'tcx>(
|
|||
///
|
||||
/// This is required because we may still want to run MIR passes on an item
|
||||
/// with type errors, but normal MIR construction can't handle that in general.
|
||||
fn construct_error<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn construct_error(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: LocalDefId,
|
||||
body_owner_kind: hir::BodyOwnerKind,
|
||||
err: ErrorGuaranteed,
|
||||
) -> Body<'tcx> {
|
||||
) -> Body<'_> {
|
||||
let span = tcx.def_span(def);
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def);
|
||||
let generator_kind = tcx.generator_kind(def);
|
||||
|
|
|
@ -703,7 +703,7 @@ impl UnsafeOpKind {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalDefId>) {
|
||||
pub fn check_unsafety(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) {
|
||||
// THIR unsafeck is gated under `-Z thir-unsafeck`
|
||||
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
|
||||
return;
|
||||
|
@ -749,7 +749,7 @@ pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalD
|
|||
visitor.visit_expr(&thir[expr]);
|
||||
}
|
||||
|
||||
pub(crate) fn thir_check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
pub(crate) fn thir_check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
|
||||
tcx.thir_check_unsafety_for_const_arg(def)
|
||||
} else {
|
||||
|
@ -757,8 +757,8 @@ pub(crate) fn thir_check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn thir_check_unsafety_for_const_arg<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(crate) fn thir_check_unsafety_for_const_arg(
|
||||
tcx: TyCtxt<'_>,
|
||||
(did, param_did): (LocalDefId, DefId),
|
||||
) {
|
||||
check_unsafety(tcx, ty::WithOptConstParam { did, const_param_did: Some(param_did) })
|
||||
|
|
|
@ -18,10 +18,10 @@ use rustc_middle::thir::*;
|
|||
use rustc_middle::ty::{self, RvalueScopes, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub(crate) fn thir_body<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(crate) fn thir_body(
|
||||
tcx: TyCtxt<'_>,
|
||||
owner_def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> Result<(&'tcx Steal<Thir<'tcx>>, ExprId), ErrorGuaranteed> {
|
||||
) -> Result<(&Steal<Thir<'_>>, ExprId), ErrorGuaranteed> {
|
||||
let hir = tcx.hir();
|
||||
let body = hir.body(hir.body_owned_by(owner_def.did));
|
||||
let mut cx = Cx::new(tcx, owner_def);
|
||||
|
@ -52,10 +52,7 @@ pub(crate) fn thir_body<'tcx>(
|
|||
Ok((tcx.alloc_steal_thir(cx.thir), expr))
|
||||
}
|
||||
|
||||
pub(crate) fn thir_tree<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
owner_def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> String {
|
||||
pub(crate) fn thir_tree(tcx: TyCtxt<'_>, owner_def: ty::WithOptConstParam<LocalDefId>) -> String {
|
||||
match thir_body(tcx, owner_def) {
|
||||
Ok((thir, _)) => format!("{:#?}", thir.steal()),
|
||||
Err(_) => "error".into(),
|
||||
|
|
|
@ -70,7 +70,7 @@ mod fallback_to_const_ref {
|
|||
/// hoops to get a reference to the value.
|
||||
pub(super) struct FallbackToConstRef(());
|
||||
|
||||
pub(super) fn fallback_to_const_ref<'tcx>(c2p: &super::ConstToPat<'tcx>) -> FallbackToConstRef {
|
||||
pub(super) fn fallback_to_const_ref(c2p: &super::ConstToPat<'_>) -> FallbackToConstRef {
|
||||
assert!(c2p.behind_reference.get());
|
||||
FallbackToConstRef(())
|
||||
}
|
||||
|
|
|
@ -404,7 +404,7 @@ impl SplitIntRange {
|
|||
}
|
||||
|
||||
/// Iterate over the contained ranges.
|
||||
fn iter<'a>(&'a self) -> impl Iterator<Item = IntRange> + Captures<'a> {
|
||||
fn iter(&self) -> impl Iterator<Item = IntRange> + Captures<'_> {
|
||||
use IntBorder::*;
|
||||
|
||||
let self_range = Self::to_borders(self.range.clone());
|
||||
|
@ -612,7 +612,7 @@ impl SplitVarLenSlice {
|
|||
}
|
||||
|
||||
/// Iterate over the partition of this slice.
|
||||
fn iter<'a>(&'a self) -> impl Iterator<Item = Slice> + Captures<'a> {
|
||||
fn iter(&self) -> impl Iterator<Item = Slice> + Captures<'_> {
|
||||
let smaller_lengths = match self.array_len {
|
||||
// The only admissible fixed-length slice is one of the array size. Whether `max_slice`
|
||||
// is fixed-length or variable-length, it will be the only relevant slice to output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue