aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-10-10 19:51:50 +0100
committerkjeremy <[email protected]>2019-10-10 19:51:50 +0100
commit4ba2c5b2de0d1815007d109b3897ccaf6dda0ab5 (patch)
tree35f4277c88afd6f2a19b29faa3fb08f2e1c7e998 /crates/ra_hir
parentda190278e900b2f9302fd0ae898d904e3134d938 (diff)
Chalk update to simplified IR
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs58
1 files changed, 34 insertions, 24 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index 2642a54bf..9168de709 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -491,15 +491,16 @@ pub(crate) fn trait_datum_query(
491 }, 491 },
492 associated_ty_ids: Vec::new(), 492 associated_ty_ids: Vec::new(),
493 where_clauses: Vec::new(), 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 let trait_: Trait = from_chalk(db, trait_id); 505 let trait_: Trait = from_chalk(db, trait_id);
505 debug!("trait {:?} = {:?}", trait_id, trait_.name(db)); 506 debug!("trait {:?} = {:?}", trait_id, trait_.name(db));
@@ -525,8 +526,9 @@ pub(crate) fn trait_datum_query(
525 .map(|type_alias| type_alias.to_chalk(db)) 526 .map(|type_alias| type_alias.to_chalk(db))
526 .collect(); 527 .collect();
527 let trait_datum_bound = 528 let trait_datum_bound =
528 chalk_rust_ir::TraitDatumBound { trait_ref, where_clauses, flags, associated_ty_ids }; 529 chalk_rust_ir::TraitDatumBound { trait_ref, where_clauses, associated_ty_ids };
529 let trait_datum = TraitDatum { binders: make_binders(trait_datum_bound, bound_vars.len()) }; 530 let trait_datum =
531 TraitDatum { binders: make_binders(trait_datum_bound, bound_vars.len()), flags };
530 Arc::new(trait_datum) 532 Arc::new(trait_datum)
531} 533}
532 534
@@ -632,18 +634,20 @@ fn impl_block_datum(
632 }) 634 })
633 .collect(); 635 .collect();
634 636
635 let impl_datum_bound = chalk_rust_ir::ImplDatumBound { 637 let polarity = if negative {
636 trait_ref: if negative { 638 chalk_rust_ir::Polarity::Negative
637 chalk_rust_ir::PolarizedTraitRef::Negative(trait_ref) 639 } else {
638 } else { 640 chalk_rust_ir::Polarity::Positive
639 chalk_rust_ir::PolarizedTraitRef::Positive(trait_ref)
640 },
641 where_clauses,
642 associated_ty_values,
643 impl_type,
644 }; 641 };
642
643 let impl_datum_bound =
644 chalk_rust_ir::ImplDatumBound { trait_ref, where_clauses, associated_ty_values };
645 debug!("impl_datum: {:?}", impl_datum_bound); 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 Arc::new(impl_datum) 651 Arc::new(impl_datum)
648} 652}
649 653
@@ -653,12 +657,15 @@ fn invalid_impl_datum() -> Arc<ImplDatum> {
653 parameters: vec![chalk_ir::Ty::BoundVar(0).cast()], 657 parameters: vec![chalk_ir::Ty::BoundVar(0).cast()],
654 }; 658 };
655 let impl_datum_bound = chalk_rust_ir::ImplDatumBound { 659 let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
656 trait_ref: chalk_rust_ir::PolarizedTraitRef::Positive(trait_ref), 660 trait_ref,
657 where_clauses: Vec::new(), 661 where_clauses: Vec::new(),
658 associated_ty_values: Vec::new(), 662 associated_ty_values: Vec::new(),
663 };
664 let impl_datum = ImplDatum {
665 binders: make_binders(impl_datum_bound, 1),
659 impl_type: chalk_rust_ir::ImplType::External, 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 Arc::new(impl_datum) 669 Arc::new(impl_datum)
663} 670}
664 671
@@ -713,12 +720,15 @@ fn closure_fn_trait_impl_datum(
713 let impl_type = chalk_rust_ir::ImplType::External; 720 let impl_type = chalk_rust_ir::ImplType::External;
714 721
715 let impl_datum_bound = chalk_rust_ir::ImplDatumBound { 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 where_clauses: Vec::new(), 724 where_clauses: Vec::new(),
718 associated_ty_values: vec![output_ty_value], 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 impl_type, 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 Some(Arc::new(impl_datum)) 732 Some(Arc::new(impl_datum))
723} 733}
724 734