@@ -240,7 +240,7 @@ impl<I: Interner> Or<I> {
240240}
241241impl < I : Interner , S : Clone + std:: hash:: Hash + std:: fmt:: Debug + Eq > Or < I , S > {
242242 pub fn new_true ( ) -> Self {
243- Self ( Box :: new ( [ And :: new ( [ ] ) ] ) )
243+ Self ( Box :: new ( [ And :: new_true ( ) ] ) )
244244 }
245245
246246 pub fn is_true ( & self ) -> bool {
@@ -323,6 +323,10 @@ impl<I: Interner> And<I> {
323323 }
324324}
325325impl < I : Interner , S : Clone + std:: hash:: Hash + std:: fmt:: Debug + Eq > And < I , S > {
326+ pub fn new_true ( ) -> Self {
327+ Self ( Box :: new ( [ ] ) )
328+ }
329+
326330 pub fn new ( i : impl IntoIterator < Item = LeafRegionConstraint < I , S > > ) -> Self {
327331 let mut seen = IndexSet :: new ( ) ;
328332 And ( i
@@ -406,7 +410,7 @@ impl<I: Interner, S: Clone + std::fmt::Debug + Eq + std::hash::Hash> RegionConst
406410 } ) ) ;
407411
408412 Self {
409- and_constraint : if or_constraint. is_false ( ) { And :: new ( [ ] ) } else { and_constraint } ,
413+ and_constraint : if or_constraint. is_false ( ) { And :: new_true ( ) } else { and_constraint } ,
410414 or_constraint,
411415 }
412416 }
@@ -422,7 +426,7 @@ impl<I: Interner, S: Clone + std::fmt::Debug + Eq + std::hash::Hash> RegionConst
422426 let or_constraint = Or :: build_and ( a. or_constraint , b. or_constraint ) ;
423427
424428 Self {
425- and_constraint : if or_constraint. is_false ( ) { And :: new ( [ ] ) } else { and_constraint } ,
429+ and_constraint : if or_constraint. is_false ( ) { And :: new_true ( ) } else { and_constraint } ,
426430 or_constraint,
427431 }
428432 }
@@ -432,15 +436,15 @@ impl<I: Interner, S: Clone + std::fmt::Debug + Eq + std::hash::Hash> RegionConst
432436 }
433437
434438 pub fn new_true ( ) -> Self {
435- Self { and_constraint : And :: new ( [ ] ) , or_constraint : Or :: new_true ( ) }
439+ Self { and_constraint : And :: new_true ( ) , or_constraint : Or :: new_true ( ) }
436440 }
437441
438442 pub fn is_true ( & self ) -> bool {
439443 self . and_constraint . 0 . is_empty ( ) && self . or_constraint . is_true ( )
440444 }
441445
442446 pub fn new_false ( ) -> Self {
443- Self { and_constraint : And :: new ( [ ] ) , or_constraint : Or :: new_false ( ) }
447+ Self { and_constraint : And :: new_true ( ) , or_constraint : Or :: new_false ( ) }
444448 }
445449
446450 pub fn is_false ( & self ) -> bool {
@@ -477,12 +481,6 @@ impl<I: Interner, S: Clone + std::fmt::Debug + Eq + std::hash::Hash> RegionConst
477481 }
478482}
479483
480- impl < I : Interner > Default for RegionConstraint < I > {
481- fn default ( ) -> Self {
482- Self :: new_true ( )
483- }
484- }
485-
486484impl < I : Interner , S : Clone + std:: fmt:: Debug > LeafRegionConstraint < I , S > {
487485 pub fn is_ambig ( & self ) -> bool {
488486 matches ! ( self , Self :: Ambiguity ( _) )
0 commit comments