Greatly simplify lifetime captures in edition 2024
This commit is contained in:
parent
46420c9607
commit
12e3911d81
84 changed files with 223 additions and 294 deletions
|
@ -10,7 +10,6 @@
|
|||
use std::fmt::Debug;
|
||||
use std::iter;
|
||||
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_index::{Idx, IndexVec};
|
||||
use rustc_middle::arena::ArenaAllocatable;
|
||||
use rustc_middle::mir::ConstraintCategory;
|
||||
|
@ -541,13 +540,13 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
|
||||
/// Converts the region constraints resulting from a query into an
|
||||
/// iterator of obligations.
|
||||
fn query_outlives_constraints_into_obligations<'a>(
|
||||
&'a self,
|
||||
cause: &'a ObligationCause<'tcx>,
|
||||
fn query_outlives_constraints_into_obligations(
|
||||
&self,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
uninstantiated_region_constraints: &'a [QueryOutlivesConstraint<'tcx>],
|
||||
result_args: &'a CanonicalVarValues<'tcx>,
|
||||
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a + Captures<'tcx> {
|
||||
uninstantiated_region_constraints: &[QueryOutlivesConstraint<'tcx>],
|
||||
result_args: &CanonicalVarValues<'tcx>,
|
||||
) -> impl Iterator<Item = PredicateObligation<'tcx>> {
|
||||
uninstantiated_region_constraints.iter().map(move |&constraint| {
|
||||
let predicate = instantiate_value(self.tcx, result_args, constraint);
|
||||
self.query_outlives_constraint_to_obligation(predicate, cause.clone(), param_env)
|
||||
|
|
|
@ -38,7 +38,7 @@ pub struct FreeRegionMap<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> FreeRegionMap<'tcx> {
|
||||
pub fn elements(&self) -> impl Iterator<Item = Region<'tcx>> + '_ {
|
||||
pub fn elements(&self) -> impl Iterator<Item = Region<'tcx>> {
|
||||
self.relation.elements().copied()
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ use region_constraints::{
|
|||
};
|
||||
pub use relate::StructurallyRelateAliases;
|
||||
pub use relate::combine::PredicateEmittingRelation;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_data_structures::undo_log::{Rollback, UndoLogs};
|
||||
use rustc_data_structures::unify as ut;
|
||||
|
@ -233,7 +232,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
|
|||
// while looping through this.
|
||||
pub fn iter_opaque_types(
|
||||
&self,
|
||||
) -> impl Iterator<Item = (ty::OpaqueTypeKey<'tcx>, ty::OpaqueHiddenType<'tcx>)> + '_ {
|
||||
) -> impl Iterator<Item = (ty::OpaqueTypeKey<'tcx>, ty::OpaqueHiddenType<'tcx>)> {
|
||||
self.opaque_type_storage.opaque_types.iter().map(|(&k, &v)| (k, v))
|
||||
}
|
||||
}
|
||||
|
@ -1295,9 +1294,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
/// The returned function is used in a fast path. If it returns `true` the variable is
|
||||
/// unchanged, `false` indicates that the status is unknown.
|
||||
#[inline]
|
||||
pub fn is_ty_infer_var_definitely_unchanged<'a>(
|
||||
&'a self,
|
||||
) -> (impl Fn(TyOrConstInferVar) -> bool + Captures<'tcx> + 'a) {
|
||||
pub fn is_ty_infer_var_definitely_unchanged(&self) -> impl Fn(TyOrConstInferVar) -> bool {
|
||||
// This hoists the borrow/release out of the loop body.
|
||||
let inner = self.inner.try_borrow();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pub(crate) mod verify;
|
|||
#[instrument(level = "debug", skip(param_env), ret)]
|
||||
pub fn explicit_outlives_bounds<'tcx>(
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
|
||||
) -> impl Iterator<Item = OutlivesBound<'tcx>> {
|
||||
param_env
|
||||
.caller_bounds()
|
||||
.into_iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue