diff options
| author | Michael Goulet <michael@errs.io> | 2025-07-13 20:43:29 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-07-15 16:02:26 +0000 |
| commit | e3f643c70670a3e1567b0816502ab247565305f8 (patch) | |
| tree | 6184ddb319b840211b847d94c09b63d28c2ab201 /compiler/rustc_infer/src/infer/outlives/env.rs | |
| parent | 3e7dfaa51027d33f3613ed0203df495784b21f19 (diff) | |
| download | rust-e3f643c70670a3e1567b0816502ab247565305f8.tar.gz rust-e3f643c70670a3e1567b0816502ab247565305f8.zip | |
Consider outlives assumptions when proving auto traits for coroutine interiors
Diffstat (limited to 'compiler/rustc_infer/src/infer/outlives/env.rs')
| -rw-r--r-- | compiler/rustc_infer/src/infer/outlives/env.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/infer/outlives/env.rs b/compiler/rustc_infer/src/infer/outlives/env.rs index cb5a33c5c97..2175ff1b4ae 100644 --- a/compiler/rustc_infer/src/infer/outlives/env.rs +++ b/compiler/rustc_infer/src/infer/outlives/env.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; use rustc_data_structures::transitive_relation::TransitiveRelationBuilder; use rustc_middle::{bug, ty}; use tracing::debug; @@ -39,6 +39,9 @@ pub struct OutlivesEnvironment<'tcx> { /// optimized in the future, though. region_bound_pairs: RegionBoundPairs<'tcx>, known_type_outlives: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>, + /// Assumptions that come from the well-formedness of coroutines that we prove + /// auto trait bounds for during the type checking of this body. + higher_ranked_assumptions: FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>, } /// "Region-bound pairs" tracks outlives relations that are known to @@ -52,6 +55,7 @@ impl<'tcx> OutlivesEnvironment<'tcx> { param_env: ty::ParamEnv<'tcx>, known_type_outlives: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>, extra_bounds: impl IntoIterator<Item = OutlivesBound<'tcx>>, + higher_ranked_assumptions: FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>, ) -> Self { let mut region_relation = TransitiveRelationBuilder::default(); let mut region_bound_pairs = RegionBoundPairs::default(); @@ -88,6 +92,7 @@ impl<'tcx> OutlivesEnvironment<'tcx> { known_type_outlives, free_region_map: FreeRegionMap { relation: region_relation.freeze() }, region_bound_pairs, + higher_ranked_assumptions, } } @@ -102,4 +107,10 @@ impl<'tcx> OutlivesEnvironment<'tcx> { pub fn known_type_outlives(&self) -> &[ty::PolyTypeOutlivesPredicate<'tcx>] { &self.known_type_outlives } + + pub fn higher_ranked_assumptions( + &self, + ) -> &FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> { + &self.higher_ranked_assumptions + } } |
