3 use self::CombineMapType::*;
7 InferCtxtUndoLogs, MiscVariable, RegionVariableOrigin, Rollback, Snapshot, SubregionOrigin,
10 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
11 use rustc_data_structures::intern::Interned;
12 use rustc_data_structures::sync::Lrc;
13 use rustc_data_structures::undo_log::UndoLogs;
14 use rustc_data_structures::unify as ut;
15 use rustc_hir::def_id::DefId;
16 use rustc_index::vec::IndexVec;
17 use rustc_middle::infer::unify_key::{RegionVidKey, UnifiedRegion};
18 use rustc_middle::ty::ReStatic;
19 use rustc_middle::ty::{self, Ty, TyCtxt};
20 use rustc_middle::ty::{ReLateBound, ReVar};
21 use rustc_middle::ty::{Region, RegionVid};
24 use std::collections::BTreeMap;
26 use std::{cmp, fmt, mem};
30 pub use rustc_middle::infer::MemberConstraint;
32 #[derive(Clone, Default)]
33 pub struct RegionConstraintStorage<'tcx> {
34 /// For each `RegionVid`, the corresponding `RegionVariableOrigin`.
35 var_infos: IndexVec<RegionVid, RegionVariableInfo>,
37 data: RegionConstraintData<'tcx>,
39 /// For a given pair of regions (R1, R2), maps to a region R3 that
40 /// is designated as their LUB (edges R1 <= R3 and R2 <= R3
41 /// exist). This prevents us from making many such regions.
42 lubs: CombineMap<'tcx>,
44 /// For a given pair of regions (R1, R2), maps to a region R3 that
45 /// is designated as their GLB (edges R3 <= R1 and R3 <= R2
46 /// exist). This prevents us from making many such regions.
47 glbs: CombineMap<'tcx>,
49 /// When we add a R1 == R2 constraint, we currently add (a) edges
50 /// R1 <= R2 and R2 <= R1 and (b) we unify the two regions in this
51 /// table. You can then call `opportunistic_resolve_var` early
52 /// which will map R1 and R2 to some common region (i.e., either
53 /// R1 or R2). This is important when fulfillment, dropck and other such
54 /// code is iterating to a fixed point, because otherwise we sometimes
55 /// would wind up with a fresh stream of region variables that have been
56 /// equated but appear distinct.
57 pub(super) unification_table: ut::UnificationTableStorage<RegionVidKey<'tcx>>,
59 /// a flag set to true when we perform any unifications; this is used
60 /// to micro-optimize `take_and_reset_data`
61 any_unifications: bool,
64 pub struct RegionConstraintCollector<'a, 'tcx> {
65 storage: &'a mut RegionConstraintStorage<'tcx>,
66 undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
69 impl<'tcx> std::ops::Deref for RegionConstraintCollector<'_, 'tcx> {
70 type Target = RegionConstraintStorage<'tcx>;
72 fn deref(&self) -> &RegionConstraintStorage<'tcx> {
77 impl<'tcx> std::ops::DerefMut for RegionConstraintCollector<'_, 'tcx> {
79 fn deref_mut(&mut self) -> &mut RegionConstraintStorage<'tcx> {
84 pub type VarInfos = IndexVec<RegionVid, RegionVariableInfo>;
86 /// The full set of region constraints gathered up by the collector.
87 /// Describes constraints between the region variables and other
88 /// regions, as well as other conditions that must be verified, or
89 /// assumptions that can be made.
90 #[derive(Debug, Default, Clone)]
91 pub struct RegionConstraintData<'tcx> {
92 /// Constraints of the form `A <= B`, where either `A` or `B` can
93 /// be a region variable (or neither, as it happens).
94 pub constraints: BTreeMap<Constraint<'tcx>, SubregionOrigin<'tcx>>,
96 /// Constraints of the form `R0 member of [R1, ..., Rn]`, meaning that
97 /// `R0` must be equal to one of the regions `R1..Rn`. These occur
98 /// with `impl Trait` quite frequently.
99 pub member_constraints: Vec<MemberConstraint<'tcx>>,
101 /// A "verify" is something that we need to verify after inference
102 /// is done, but which does not directly affect inference in any
105 /// An example is a `A <= B` where neither `A` nor `B` are
106 /// inference variables.
107 pub verifys: Vec<Verify<'tcx>>,
109 /// A "given" is a relationship that is known to hold. In
110 /// particular, we often know from closure fn signatures that a
111 /// particular free region must be a subregion of a region
114 /// foo.iter().filter(<'a> |x: &'a &'b T| ...)
116 /// In situations like this, `'b` is in fact a region variable
117 /// introduced by the call to `iter()`, and `'a` is a bound region
118 /// on the closure (as indicated by the `<'a>` prefix). If we are
119 /// naive, we wind up inferring that `'b` must be `'static`,
120 /// because we require that it be greater than `'a` and we do not
121 /// know what `'a` is precisely.
123 /// This hashmap is used to avoid that naive scenario. Basically
124 /// we record the fact that `'a <= 'b` is implied by the fn
125 /// signature, and then ignore the constraint when solving
126 /// equations. This is a bit of a hack but seems to work.
127 pub givens: FxHashSet<(Region<'tcx>, ty::RegionVid)>,
130 /// Represents a constraint that influences the inference process.
131 #[derive(Clone, Copy, PartialEq, Eq, Debug, PartialOrd, Ord)]
132 pub enum Constraint<'tcx> {
133 /// A region variable is a subregion of another.
134 VarSubVar(RegionVid, RegionVid),
136 /// A concrete region is a subregion of region variable.
137 RegSubVar(Region<'tcx>, RegionVid),
139 /// A region variable is a subregion of a concrete region. This does not
140 /// directly affect inference, but instead is checked after
141 /// inference is complete.
142 VarSubReg(RegionVid, Region<'tcx>),
144 /// A constraint where neither side is a variable. This does not
145 /// directly affect inference, but instead is checked after
146 /// inference is complete.
147 RegSubReg(Region<'tcx>, Region<'tcx>),
150 impl Constraint<'_> {
151 pub fn involves_placeholders(&self) -> bool {
153 Constraint::VarSubVar(_, _) => false,
154 Constraint::VarSubReg(_, r) | Constraint::RegSubVar(r, _) => r.is_placeholder(),
155 Constraint::RegSubReg(r, s) => r.is_placeholder() || s.is_placeholder(),
160 #[derive(Debug, Clone)]
161 pub struct Verify<'tcx> {
162 pub kind: GenericKind<'tcx>,
163 pub origin: SubregionOrigin<'tcx>,
164 pub region: Region<'tcx>,
165 pub bound: VerifyBound<'tcx>,
168 #[derive(Copy, Clone, PartialEq, Eq, Hash, TypeFoldable)]
169 pub enum GenericKind<'tcx> {
171 Projection(ty::ProjectionTy<'tcx>),
174 /// Describes the things that some `GenericKind` value `G` is known to
175 /// outlive. Each variant of `VerifyBound` can be thought of as a
178 /// fn(min: Region) -> bool { .. }
180 /// where `true` means that the region `min` meets that `G: min`.
181 /// (False means nothing.)
183 /// So, for example, if we have the type `T` and we have in scope that
184 /// `T: 'a` and `T: 'b`, then the verify bound might be:
186 /// fn(min: Region) -> bool {
187 /// ('a: min) || ('b: min)
190 /// This is described with an `AnyRegion('a, 'b)` node.
191 #[derive(Debug, Clone)]
192 pub enum VerifyBound<'tcx> {
193 /// Given a kind K and a bound B, expands to a function like the
194 /// following, where `G` is the generic for which this verify
195 /// bound was created:
198 /// fn(min) -> bool {
207 /// In other words, if the generic `G` that we are checking is
208 /// equal to `K`, then check the associated verify bound
209 /// (otherwise, false).
211 /// This is used when we have something in the environment that
212 /// may or may not be relevant, depending on the region inference
213 /// results. For example, we may have `where <T as
214 /// Trait<'a>>::Item: 'b` in our where-clauses. If we are
215 /// generating the verify-bound for `<T as Trait<'0>>::Item`, then
216 /// this where-clause is only relevant if `'0` winds up inferred
219 /// So we would compile to a verify-bound like
222 /// IfEq(<T as Trait<'a>>::Item, AnyRegion('a))
225 /// meaning, if the subject G is equal to `<T as Trait<'a>>::Item`
226 /// (after inference), and `'a: min`, then `G: min`.
227 IfEq(Ty<'tcx>, Box<VerifyBound<'tcx>>),
229 /// Given a region `R`, expands to the function:
232 /// fn(min) -> bool {
237 /// This is used when we can establish that `G: R` -- therefore,
238 /// if `R: min`, then by transitivity `G: min`.
239 OutlivedBy(Region<'tcx>),
241 /// Given a region `R`, true if it is `'empty`.
244 /// Given a set of bounds `B`, expands to the function:
247 /// fn(min) -> bool {
248 /// exists (b in B) { b(min) }
252 /// In other words, if we meet some bound in `B`, that suffices.
253 /// This is used when all the bounds in `B` are known to apply to `G`.
254 AnyBound(Vec<VerifyBound<'tcx>>),
256 /// Given a set of bounds `B`, expands to the function:
259 /// fn(min) -> bool {
260 /// forall (b in B) { b(min) }
264 /// In other words, if we meet *all* bounds in `B`, that suffices.
265 /// This is used when *some* bound in `B` is known to suffice, but
266 /// we don't know which.
267 AllBounds(Vec<VerifyBound<'tcx>>),
270 #[derive(Copy, Clone, PartialEq, Eq, Hash)]
271 pub(crate) struct TwoRegions<'tcx> {
276 #[derive(Copy, Clone, PartialEq)]
277 pub(crate) enum UndoLog<'tcx> {
278 /// We added `RegionVid`.
281 /// We added the given `constraint`.
282 AddConstraint(Constraint<'tcx>),
284 /// We added the given `verify`.
287 /// We added the given `given`.
288 AddGiven(Region<'tcx>, ty::RegionVid),
290 /// We added a GLB/LUB "combination variable".
291 AddCombination(CombineMapType, TwoRegions<'tcx>),
294 #[derive(Copy, Clone, PartialEq)]
295 pub(crate) enum CombineMapType {
300 type CombineMap<'tcx> = FxHashMap<TwoRegions<'tcx>, RegionVid>;
302 #[derive(Debug, Clone, Copy)]
303 pub struct RegionVariableInfo {
304 pub origin: RegionVariableOrigin,
305 pub universe: ty::UniverseIndex,
308 pub struct RegionSnapshot {
309 any_unifications: bool,
312 impl<'tcx> RegionConstraintStorage<'tcx> {
313 pub fn new() -> Self {
318 pub(crate) fn with_log<'a>(
320 undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
321 ) -> RegionConstraintCollector<'a, 'tcx> {
322 RegionConstraintCollector { storage: self, undo_log }
325 fn rollback_undo_entry(&mut self, undo_entry: UndoLog<'tcx>) {
328 self.var_infos.pop().unwrap();
329 assert_eq!(self.var_infos.len(), vid.index() as usize);
331 AddConstraint(ref constraint) => {
332 self.data.constraints.remove(constraint);
334 AddVerify(index) => {
335 self.data.verifys.pop();
336 assert_eq!(self.data.verifys.len(), index);
338 AddGiven(sub, sup) => {
339 self.data.givens.remove(&(sub, sup));
341 AddCombination(Glb, ref regions) => {
342 self.glbs.remove(regions);
344 AddCombination(Lub, ref regions) => {
345 self.lubs.remove(regions);
351 impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
352 pub fn num_region_vars(&self) -> usize {
356 pub fn region_constraint_data(&self) -> &RegionConstraintData<'tcx> {
360 /// Once all the constraints have been gathered, extract out the final data.
362 /// Not legal during a snapshot.
363 pub fn into_infos_and_data(self) -> (VarInfos, RegionConstraintData<'tcx>) {
364 assert!(!UndoLogs::<super::UndoLog<'_>>::in_snapshot(&self.undo_log));
365 (mem::take(&mut self.storage.var_infos), mem::take(&mut self.storage.data))
368 /// Takes (and clears) the current set of constraints. Note that
369 /// the set of variables remains intact, but all relationships
370 /// between them are reset. This is used during NLL checking to
371 /// grab the set of constraints that arose from a particular
374 /// We don't want to leak relationships between variables between
375 /// points because just because (say) `r1 == r2` was true at some
376 /// point P in the graph doesn't imply that it will be true at
377 /// some other point Q, in NLL.
379 /// Not legal during a snapshot.
380 pub fn take_and_reset_data(&mut self) -> RegionConstraintData<'tcx> {
381 assert!(!UndoLogs::<super::UndoLog<'_>>::in_snapshot(&self.undo_log));
383 // If you add a new field to `RegionConstraintCollector`, you
384 // should think carefully about whether it needs to be cleared
385 // or updated in some way.
386 let RegionConstraintStorage {
391 unification_table: _,
395 // Clear the tables of (lubs, glbs), so that we will create
396 // fresh regions if we do a LUB operation. As it happens,
397 // LUB/GLB are not performed by the MIR type-checker, which is
398 // the one that uses this method, but it's good to be correct.
402 let data = mem::take(data);
404 // Clear all unifications and recreate the variables a "now
405 // un-unified" state. Note that when we unify `a` and `b`, we
406 // also insert `a <= b` and a `b <= a` edges, so the
407 // `RegionConstraintData` contains the relationship here.
408 if *any_unifications {
409 *any_unifications = false;
410 self.unification_table().reset_unifications(|_| UnifiedRegion(None));
416 pub fn data(&self) -> &RegionConstraintData<'tcx> {
420 pub fn start_snapshot(&mut self) -> RegionSnapshot {
421 debug!("RegionConstraintCollector: start_snapshot");
422 RegionSnapshot { any_unifications: self.any_unifications }
425 pub fn rollback_to(&mut self, snapshot: RegionSnapshot) {
426 debug!("RegionConstraintCollector: rollback_to({:?})", snapshot);
427 self.any_unifications = snapshot.any_unifications;
430 pub fn new_region_var(
432 universe: ty::UniverseIndex,
433 origin: RegionVariableOrigin,
435 let vid = self.var_infos.push(RegionVariableInfo { origin, universe });
437 let u_vid = self.unification_table().new_key(UnifiedRegion(None));
438 assert_eq!(vid, u_vid.vid);
439 self.undo_log.push(AddVar(vid));
440 debug!("created new region variable {:?} in {:?} with origin {:?}", vid, universe, origin);
444 /// Returns the universe for the given variable.
445 pub fn var_universe(&self, vid: RegionVid) -> ty::UniverseIndex {
446 self.var_infos[vid].universe
449 /// Returns the origin for the given variable.
450 pub fn var_origin(&self, vid: RegionVid) -> RegionVariableOrigin {
451 self.var_infos[vid].origin
454 fn add_constraint(&mut self, constraint: Constraint<'tcx>, origin: SubregionOrigin<'tcx>) {
455 // cannot add constraints once regions are resolved
456 debug!("RegionConstraintCollector: add_constraint({:?})", constraint);
458 // never overwrite an existing (constraint, origin) - only insert one if it isn't
459 // present in the map yet. This prevents origins from outside the snapshot being
460 // replaced with "less informative" origins e.g., during calls to `can_eq`
461 let undo_log = &mut self.undo_log;
462 self.storage.data.constraints.entry(constraint).or_insert_with(|| {
463 undo_log.push(AddConstraint(constraint));
468 fn add_verify(&mut self, verify: Verify<'tcx>) {
469 // cannot add verifys once regions are resolved
470 debug!("RegionConstraintCollector: add_verify({:?})", verify);
472 // skip no-op cases known to be satisfied
473 if let VerifyBound::AllBounds(ref bs) = verify.bound && bs.is_empty() {
477 let index = self.data.verifys.len();
478 self.data.verifys.push(verify);
479 self.undo_log.push(AddVerify(index));
482 pub fn add_given(&mut self, sub: Region<'tcx>, sup: ty::RegionVid) {
483 // cannot add givens once regions are resolved
484 if self.data.givens.insert((sub, sup)) {
485 debug!("add_given({:?} <= {:?})", sub, sup);
487 self.undo_log.push(AddGiven(sub, sup));
491 pub fn make_eqregion(
493 origin: SubregionOrigin<'tcx>,
498 // Eventually, it would be nice to add direct support for
500 self.make_subregion(origin.clone(), sub, sup);
501 self.make_subregion(origin, sup, sub);
504 (Region(Interned(ReVar(sub), _)), Region(Interned(ReVar(sup), _))) => {
505 debug!("make_eqregion: unifying {:?} with {:?}", sub, sup);
506 self.unification_table().union(*sub, *sup);
507 self.any_unifications = true;
509 (Region(Interned(ReVar(vid), _)), value)
510 | (value, Region(Interned(ReVar(vid), _))) => {
511 debug!("make_eqregion: unifying {:?} with {:?}", vid, value);
512 self.unification_table().union_value(*vid, UnifiedRegion(Some(value)));
513 self.any_unifications = true;
520 pub fn member_constraint(
522 opaque_type_def_id: DefId,
523 definition_span: Span,
525 member_region: ty::Region<'tcx>,
526 choice_regions: &Lrc<Vec<ty::Region<'tcx>>>,
528 debug!("member_constraint({:?} in {:#?})", member_region, choice_regions);
530 if choice_regions.iter().any(|&r| r == member_region) {
534 self.data.member_constraints.push(MemberConstraint {
539 choice_regions: choice_regions.clone(),
543 #[instrument(skip(self, origin), level = "debug")]
544 pub fn make_subregion(
546 origin: SubregionOrigin<'tcx>,
550 // cannot add constraints once regions are resolved
551 debug!("origin = {:#?}", origin);
554 (ReLateBound(..), _) | (_, ReLateBound(..)) => {
555 span_bug!(origin.span(), "cannot relate bound region: {:?} <= {:?}", sub, sup);
558 // all regions are subregions of static, so we can ignore this
560 (ReVar(sub_id), ReVar(sup_id)) => {
561 self.add_constraint(Constraint::VarSubVar(sub_id, sup_id), origin);
563 (_, ReVar(sup_id)) => {
564 self.add_constraint(Constraint::RegSubVar(sub, sup_id), origin);
566 (ReVar(sub_id), _) => {
567 self.add_constraint(Constraint::VarSubReg(sub_id, sup), origin);
570 self.add_constraint(Constraint::RegSubReg(sub, sup), origin);
575 pub fn verify_generic_bound(
577 origin: SubregionOrigin<'tcx>,
578 kind: GenericKind<'tcx>,
580 bound: VerifyBound<'tcx>,
582 self.add_verify(Verify { kind, origin, region: sub, bound });
588 origin: SubregionOrigin<'tcx>,
592 // cannot add constraints once regions are resolved
593 debug!("RegionConstraintCollector: lub_regions({:?}, {:?})", a, b);
594 if a.is_static() || b.is_static() {
595 a // nothing lives longer than static
599 self.combine_vars(tcx, Lub, a, b, origin)
606 origin: SubregionOrigin<'tcx>,
610 // cannot add constraints once regions are resolved
611 debug!("RegionConstraintCollector: glb_regions({:?}, {:?})", a, b);
613 b // static lives longer than everything else
614 } else if b.is_static() {
615 a // static lives longer than everything else
619 self.combine_vars(tcx, Glb, a, b, origin)
623 /// Resolves the passed RegionVid to the root RegionVid in the unification table
624 pub fn opportunistic_resolve_var(&mut self, rid: ty::RegionVid) -> ty::RegionVid {
625 self.unification_table().find(rid).vid
628 /// If the Region is a `ReVar`, then resolves it either to the root value in
629 /// the unification table, if it exists, or to the root `ReVar` in the table.
630 /// If the Region is not a `ReVar`, just returns the Region itself.
631 pub fn opportunistic_resolve_region(
634 region: ty::Region<'tcx>,
635 ) -> ty::Region<'tcx> {
638 let unified_region = self.unification_table().probe_value(rid);
639 unified_region.0.unwrap_or_else(|| {
640 let root = self.unification_table().find(rid).vid;
641 tcx.reuse_or_mk_region(region, ty::ReVar(root))
648 fn combine_map(&mut self, t: CombineMapType) -> &mut CombineMap<'tcx> {
650 Glb => &mut self.glbs,
651 Lub => &mut self.lubs,
661 origin: SubregionOrigin<'tcx>,
663 let vars = TwoRegions { a, b };
664 if let Some(&c) = self.combine_map(t).get(&vars) {
665 return tcx.mk_region(ReVar(c));
667 let a_universe = self.universe(a);
668 let b_universe = self.universe(b);
669 let c_universe = cmp::max(a_universe, b_universe);
670 let c = self.new_region_var(c_universe, MiscVariable(origin.span()));
671 self.combine_map(t).insert(vars, c);
672 self.undo_log.push(AddCombination(t, vars));
673 let new_r = tcx.mk_region(ReVar(c));
674 for old_r in [a, b] {
676 Glb => self.make_subregion(origin.clone(), new_r, old_r),
677 Lub => self.make_subregion(origin.clone(), old_r, new_r),
680 debug!("combine_vars() c={:?}", c);
684 pub fn universe(&self, region: Region<'tcx>) -> ty::UniverseIndex {
686 ty::ReStatic | ty::ReErased | ty::ReFree(..) | ty::ReEarlyBound(..) => {
687 ty::UniverseIndex::ROOT
689 ty::ReEmpty(ui) => ui,
690 ty::RePlaceholder(placeholder) => placeholder.universe,
691 ty::ReVar(vid) => self.var_universe(vid),
692 ty::ReLateBound(..) => bug!("universe(): encountered bound region {:?}", region),
696 pub fn vars_since_snapshot(
699 ) -> (Range<RegionVid>, Vec<RegionVariableOrigin>) {
700 let range = RegionVid::from(value_count)..RegionVid::from(self.unification_table.len());
703 (range.start.index()..range.end.index())
704 .map(|index| self.var_infos[ty::RegionVid::from(index)].origin)
709 /// See `InferCtxt::region_constraints_added_in_snapshot`.
710 pub fn region_constraints_added_in_snapshot(&self, mark: &Snapshot<'tcx>) -> Option<bool> {
712 .region_constraints_in_snapshot(mark)
713 .map(|&elt| match elt {
714 AddConstraint(constraint) => Some(constraint.involves_placeholders()),
722 fn unification_table(&mut self) -> super::UnificationTable<'_, 'tcx, RegionVidKey<'tcx>> {
723 ut::UnificationTable::with_log(&mut self.storage.unification_table, self.undo_log)
727 impl fmt::Debug for RegionSnapshot {
728 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
729 write!(f, "RegionSnapshot")
733 impl<'tcx> fmt::Debug for GenericKind<'tcx> {
734 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
736 GenericKind::Param(ref p) => write!(f, "{:?}", p),
737 GenericKind::Projection(ref p) => write!(f, "{:?}", p),
742 impl<'tcx> fmt::Display for GenericKind<'tcx> {
743 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
745 GenericKind::Param(ref p) => write!(f, "{}", p),
746 GenericKind::Projection(ref p) => write!(f, "{}", p),
751 impl<'tcx> GenericKind<'tcx> {
752 pub fn to_ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
754 GenericKind::Param(ref p) => p.to_ty(tcx),
755 GenericKind::Projection(ref p) => tcx.mk_projection(p.item_def_id, p.substs),
760 impl<'tcx> VerifyBound<'tcx> {
761 pub fn must_hold(&self) -> bool {
763 VerifyBound::IfEq(..) => false,
764 VerifyBound::OutlivedBy(re) => re.is_static(),
765 VerifyBound::IsEmpty => false,
766 VerifyBound::AnyBound(bs) => bs.iter().any(|b| b.must_hold()),
767 VerifyBound::AllBounds(bs) => bs.iter().all(|b| b.must_hold()),
771 pub fn cannot_hold(&self) -> bool {
773 VerifyBound::IfEq(_, b) => b.cannot_hold(),
774 VerifyBound::IsEmpty => false,
775 VerifyBound::OutlivedBy(_) => false,
776 VerifyBound::AnyBound(bs) => bs.iter().all(|b| b.cannot_hold()),
777 VerifyBound::AllBounds(bs) => bs.iter().any(|b| b.cannot_hold()),
781 pub fn or(self, vb: VerifyBound<'tcx>) -> VerifyBound<'tcx> {
782 if self.must_hold() || vb.cannot_hold() {
784 } else if self.cannot_hold() || vb.must_hold() {
787 VerifyBound::AnyBound(vec![self, vb])
792 impl<'tcx> RegionConstraintData<'tcx> {
793 /// Returns `true` if this region constraint data contains no constraints, and `false`
795 pub fn is_empty(&self) -> bool {
796 let RegionConstraintData { constraints, member_constraints, verifys, givens } = self;
797 constraints.is_empty()
798 && member_constraints.is_empty()
799 && verifys.is_empty()
804 impl<'tcx> Rollback<UndoLog<'tcx>> for RegionConstraintStorage<'tcx> {
805 fn reverse(&mut self, undo: UndoLog<'tcx>) {
806 self.rollback_undo_entry(undo)