mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Add RegionInferenceContext::outlives_constraints
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
use crate::borrow_set::BorrowSet;
|
||||
|
||||
pub use super::{
|
||||
constraints::OutlivesConstraint,
|
||||
dataflow::{calculate_borrows_out_of_scope_at_location, BorrowIndex, Borrows},
|
||||
facts::{AllFacts as PoloniusInput, RustcFacts},
|
||||
location::{LocationTable, RichLocation},
|
||||
|
||||
@@ -585,6 +585,11 @@ pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
|
||||
self.universal_regions.to_region_vid(r)
|
||||
}
|
||||
|
||||
/// Returns an iterator over all the outlives constraints.
|
||||
pub fn outlives_constraints(&self) -> impl Iterator<Item = OutlivesConstraint<'tcx>> + '_ {
|
||||
self.constraints.outlives().iter().copied()
|
||||
}
|
||||
|
||||
/// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`.
|
||||
pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diagnostic) {
|
||||
self.universal_regions.annotate(tcx, err)
|
||||
@@ -698,7 +703,7 @@ pub(super) fn solve(
|
||||
#[instrument(skip(self, _body), level = "debug")]
|
||||
fn propagate_constraints(&mut self, _body: &Body<'tcx>) {
|
||||
debug!("constraints={:#?}", {
|
||||
let mut constraints: Vec<_> = self.constraints.outlives().iter().collect();
|
||||
let mut constraints: Vec<_> = self.outlives_constraints().collect();
|
||||
constraints.sort_by_key(|c| (c.sup, c.sub));
|
||||
constraints
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user