aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock11
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs58
2 files changed, 39 insertions, 30 deletions
diff --git a/Cargo.lock b/Cargo.lock
index fd8d4721f..965d5aaa0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -122,7 +122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
122[[package]] 122[[package]]
123name = "chalk-engine" 123name = "chalk-engine"
124version = "0.9.0" 124version = "0.9.0"
125source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc" 125source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
126dependencies = [ 126dependencies = [
127 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)", 127 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
128 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 128 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -132,7 +132,7 @@ dependencies = [
132[[package]] 132[[package]]
133name = "chalk-ir" 133name = "chalk-ir"
134version = "0.1.0" 134version = "0.1.0"
135source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc" 135source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
136dependencies = [ 136dependencies = [
137 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)", 137 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
138 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)", 138 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
@@ -142,7 +142,7 @@ dependencies = [
142[[package]] 142[[package]]
143name = "chalk-macros" 143name = "chalk-macros"
144version = "0.1.1" 144version = "0.1.1"
145source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc" 145source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
146dependencies = [ 146dependencies = [
147 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 147 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
148] 148]
@@ -150,7 +150,7 @@ dependencies = [
150[[package]] 150[[package]]
151name = "chalk-rust-ir" 151name = "chalk-rust-ir"
152version = "0.1.0" 152version = "0.1.0"
153source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc" 153source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
154dependencies = [ 154dependencies = [
155 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)", 155 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
156 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)", 156 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
@@ -160,13 +160,12 @@ dependencies = [
160[[package]] 160[[package]]
161name = "chalk-solve" 161name = "chalk-solve"
162version = "0.1.0" 162version = "0.1.0"
163source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc" 163source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
164dependencies = [ 164dependencies = [
165 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)", 165 "chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
166 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)", 166 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
167 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)", 167 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
168 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)", 168 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
169 "derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
170 "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", 169 "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
171 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 170 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
172 "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", 171 "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
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