@@ -491,15 +491,16 @@ pub(crate) fn trait_datum_query(
491
491
} ,
492
492
associated_ty_ids : Vec :: new ( ) ,
493
493
where_clauses : Vec :: new ( ) ,
494
- flags : chalk_rust_ir:: TraitFlags {
495
- non_enumerable : true ,
496
- auto : false ,
497
- marker : false ,
498
- upstream : true ,
499
- fundamental : false ,
500
- } ,
501
494
} ;
502
- return Arc :: new ( TraitDatum { binders : make_binders ( trait_datum_bound, 1 ) } ) ;
495
+
496
+ let flags = chalk_rust_ir:: TraitFlags {
497
+ auto : false ,
498
+ marker : false ,
499
+ upstream : true ,
500
+ fundamental : false ,
501
+ non_enumerable : true ,
502
+ } ;
503
+ return Arc :: new ( TraitDatum { binders : make_binders ( trait_datum_bound, 1 ) , flags } ) ;
503
504
}
504
505
let trait_: Trait = from_chalk ( db, trait_id) ;
505
506
debug ! ( "trait {:?} = {:?}" , trait_id, trait_. name( db) ) ;
@@ -525,8 +526,9 @@ pub(crate) fn trait_datum_query(
525
526
. map ( |type_alias| type_alias. to_chalk ( db) )
526
527
. collect ( ) ;
527
528
let trait_datum_bound =
528
- chalk_rust_ir:: TraitDatumBound { trait_ref, where_clauses, flags, associated_ty_ids } ;
529
- let trait_datum = TraitDatum { binders : make_binders ( trait_datum_bound, bound_vars. len ( ) ) } ;
529
+ chalk_rust_ir:: TraitDatumBound { trait_ref, where_clauses, associated_ty_ids } ;
530
+ let trait_datum =
531
+ TraitDatum { binders : make_binders ( trait_datum_bound, bound_vars. len ( ) ) , flags } ;
530
532
Arc :: new ( trait_datum)
531
533
}
532
534
@@ -632,18 +634,20 @@ fn impl_block_datum(
632
634
} )
633
635
. collect ( ) ;
634
636
635
- let impl_datum_bound = chalk_rust_ir:: ImplDatumBound {
636
- trait_ref : if negative {
637
- chalk_rust_ir:: PolarizedTraitRef :: Negative ( trait_ref)
638
- } else {
639
- chalk_rust_ir:: PolarizedTraitRef :: Positive ( trait_ref)
640
- } ,
641
- where_clauses,
642
- associated_ty_values,
643
- impl_type,
637
+ let polarity = if negative {
638
+ chalk_rust_ir:: Polarity :: Negative
639
+ } else {
640
+ chalk_rust_ir:: Polarity :: Positive
644
641
} ;
642
+
643
+ let impl_datum_bound =
644
+ chalk_rust_ir:: ImplDatumBound { trait_ref, where_clauses, associated_ty_values } ;
645
645
debug ! ( "impl_datum: {:?}" , impl_datum_bound) ;
646
- let impl_datum = ImplDatum { binders : make_binders ( impl_datum_bound, bound_vars. len ( ) ) } ;
646
+ let impl_datum = ImplDatum {
647
+ binders : make_binders ( impl_datum_bound, bound_vars. len ( ) ) ,
648
+ impl_type,
649
+ polarity,
650
+ } ;
647
651
Arc :: new ( impl_datum)
648
652
}
649
653
@@ -653,12 +657,15 @@ fn invalid_impl_datum() -> Arc<ImplDatum> {
653
657
parameters : vec ! [ chalk_ir:: Ty :: BoundVar ( 0 ) . cast( ) ] ,
654
658
} ;
655
659
let impl_datum_bound = chalk_rust_ir:: ImplDatumBound {
656
- trait_ref : chalk_rust_ir :: PolarizedTraitRef :: Positive ( trait_ref ) ,
660
+ trait_ref,
657
661
where_clauses : Vec :: new ( ) ,
658
662
associated_ty_values : Vec :: new ( ) ,
663
+ } ;
664
+ let impl_datum = ImplDatum {
665
+ binders : make_binders ( impl_datum_bound, 1 ) ,
659
666
impl_type : chalk_rust_ir:: ImplType :: External ,
667
+ polarity : chalk_rust_ir:: Polarity :: Positive ,
660
668
} ;
661
- let impl_datum = ImplDatum { binders : make_binders ( impl_datum_bound, 1 ) } ;
662
669
Arc :: new ( impl_datum)
663
670
}
664
671
@@ -713,12 +720,15 @@ fn closure_fn_trait_impl_datum(
713
720
let impl_type = chalk_rust_ir:: ImplType :: External ;
714
721
715
722
let impl_datum_bound = chalk_rust_ir:: ImplDatumBound {
716
- trait_ref : chalk_rust_ir :: PolarizedTraitRef :: Positive ( trait_ref. to_chalk ( db) ) ,
723
+ trait_ref : trait_ref. to_chalk ( db) ,
717
724
where_clauses : Vec :: new ( ) ,
718
725
associated_ty_values : vec ! [ output_ty_value] ,
726
+ } ;
727
+ let impl_datum = ImplDatum {
728
+ binders : make_binders ( impl_datum_bound, num_args as usize + 1 ) ,
719
729
impl_type,
730
+ polarity : chalk_rust_ir:: Polarity :: Positive ,
720
731
} ;
721
- let impl_datum = ImplDatum { binders : make_binders ( impl_datum_bound, num_args as usize + 1 ) } ;
722
732
Some ( Arc :: new ( impl_datum) )
723
733
}
724
734
0 commit comments