use type alias impl trait in outlives_bounds::InferCtxtExt
This commit is contained in:
parent
d037f1843e
commit
d39fefdd69
@ -256,6 +256,7 @@ fn apply_switch_int_edge_effects(
|
||||
/// .iterate_to_fixpoint()
|
||||
/// .into_results_cursor(body);
|
||||
/// ```
|
||||
#[inline]
|
||||
fn into_engine<'mir>(
|
||||
self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
@ -413,7 +414,7 @@ fn apply_switch_int_edge_effects(
|
||||
}
|
||||
|
||||
/* Extension methods */
|
||||
|
||||
#[inline]
|
||||
fn into_engine<'mir>(
|
||||
self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
@ -699,7 +699,7 @@ fn resolve_regions_with_wf_tys<'tcx>(
|
||||
let outlives_environment = OutlivesEnvironment::with_bounds(
|
||||
param_env,
|
||||
Some(&infcx),
|
||||
infcx.implied_bounds_tys(param_env, id, wf_tys.iter().map(|ty| *ty)),
|
||||
infcx.implied_bounds_tys(param_env, id, wf_tys.clone()),
|
||||
);
|
||||
let region_bound_pairs = outlives_environment.region_bound_pairs();
|
||||
|
||||
|
@ -158,6 +158,16 @@ fn get_impl_substs<'tcx>(
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let errors = ocx.select_all_or_error();
|
||||
if !errors.is_empty() {
|
||||
ocx.infcx.report_fulfillment_errors(&errors, None, false);
|
||||
|
@ -72,6 +72,7 @@
|
||||
#![feature(slice_partition_dedup)]
|
||||
#![feature(try_blocks)]
|
||||
#![feature(is_some_with)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -1,3 +1,4 @@
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::HirId;
|
||||
use rustc_middle::ty::{self, ParamEnv, Ty};
|
||||
@ -8,6 +9,7 @@
|
||||
|
||||
pub use rustc_middle::traits::query::OutlivesBound;
|
||||
|
||||
type Bounds<'a, 'tcx: 'a> = impl Iterator<Item = OutlivesBound<'tcx>> + 'a;
|
||||
pub trait InferCtxtExt<'a, 'tcx> {
|
||||
fn implied_outlives_bounds(
|
||||
&self,
|
||||
@ -20,8 +22,8 @@ fn implied_bounds_tys(
|
||||
&'a self,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body_id: hir::HirId,
|
||||
tys: impl IntoIterator<Item = Ty<'tcx>> + 'a,
|
||||
) -> Box<dyn Iterator<Item = OutlivesBound<'tcx>> + 'a>;
|
||||
tys: FxHashSet<Ty<'tcx>>,
|
||||
) -> Bounds<'a, 'tcx>;
|
||||
}
|
||||
|
||||
impl<'a, 'cx, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
@ -100,15 +102,13 @@ fn implied_bounds_tys(
|
||||
&'a self,
|
||||
param_env: ParamEnv<'tcx>,
|
||||
body_id: HirId,
|
||||
tys: impl IntoIterator<Item = Ty<'tcx>> + 'a,
|
||||
) -> Box<dyn Iterator<Item = OutlivesBound<'tcx>> + 'a> {
|
||||
Box::new(
|
||||
tys.into_iter()
|
||||
.map(move |ty| {
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
self.implied_outlives_bounds(param_env, body_id, ty)
|
||||
})
|
||||
.flatten(),
|
||||
)
|
||||
tys: FxHashSet<Ty<'tcx>>,
|
||||
) -> Bounds<'a, 'tcx> {
|
||||
tys.into_iter()
|
||||
.map(move |ty| {
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
self.implied_outlives_bounds(param_env, body_id, ty)
|
||||
})
|
||||
.flatten()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user