aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-10-29 12:01:33 +0000
committerFlorian Diebold <[email protected]>2019-10-29 12:01:33 +0000
commit632a22ae621079beaee6bbb155997e763c6b068d (patch)
tree44d0e6988d95b7cc62fa5a8e173c42ee228386c8 /crates/ra_hir
parent4f22d2f3b0852f32c0ba5e4545ec8cc2d986cfcc (diff)
Upgrade Chalk, make use of TypeName::Error variant
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/Cargo.toml6
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs15
2 files changed, 10 insertions, 11 deletions
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml
index 82720da9e..67f8c4946 100644
--- a/crates/ra_hir/Cargo.toml
+++ b/crates/ra_hir/Cargo.toml
@@ -23,9 +23,9 @@ hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
23test_utils = { path = "../test_utils" } 23test_utils = { path = "../test_utils" }
24ra_prof = { path = "../ra_prof" } 24ra_prof = { path = "../ra_prof" }
25 25
26chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } 26chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" }
27chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } 27chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" }
28chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } 28chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" }
29lalrpop-intern = "0.15.1" 29lalrpop-intern = "0.15.1"
30 30
31[dev-dependencies] 31[dev-dependencies]
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index ad7c11a5a..e18c28cf6 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -66,13 +66,11 @@ impl ToChalk for Ty {
66 } 66 }
67 Ty::Bound(idx) => chalk_ir::Ty::BoundVar(idx as usize), 67 Ty::Bound(idx) => chalk_ir::Ty::BoundVar(idx as usize),
68 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), 68 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"),
69 // FIXME this is clearly incorrect, but probably not too incorrect
70 // and I'm not sure what to actually do with Ty::Unknown
71 // maybe an alternative would be `for<T> T`? (meaningless in rust, but expressible in chalk's Ty)
72 // FIXME use Chalk's Dyn/Opaque once the bugs with that are fixed 69 // FIXME use Chalk's Dyn/Opaque once the bugs with that are fixed
73 Ty::Unknown | Ty::Dyn(_) | Ty::Opaque(_) => { 70 Ty::Unknown | Ty::Dyn(_) | Ty::Opaque(_) => {
74 PlaceholderIndex { ui: UniverseIndex::ROOT, idx: usize::max_value() } 71 let parameters = Vec::new();
75 .to_ty::<ChalkIr>() 72 let name = TypeName::Error;
73 chalk_ir::ApplicationTy { name, parameters }.cast()
76 } 74 }
77 } 75 }
78 } 76 }
@@ -92,6 +90,7 @@ impl ToChalk for Ty {
92 let parameters = from_chalk(db, apply_ty.parameters); 90 let parameters = from_chalk(db, apply_ty.parameters);
93 Ty::Apply(ApplicationTy { ctor, parameters }) 91 Ty::Apply(ApplicationTy { ctor, parameters })
94 } 92 }
93 TypeName::Error => Ty::Unknown,
95 // FIXME handle TypeKindId::Trait/Type here 94 // FIXME handle TypeKindId::Trait/Type here
96 TypeName::TypeKindId(_) => unimplemented!(), 95 TypeName::TypeKindId(_) => unimplemented!(),
97 TypeName::Placeholder(idx) => { 96 TypeName::Placeholder(idx) => {
@@ -323,9 +322,9 @@ where
323} 322}
324 323
325impl ToChalk for Arc<super::TraitEnvironment> { 324impl ToChalk for Arc<super::TraitEnvironment> {
326 type Chalk = Arc<chalk_ir::Environment<ChalkIr>>; 325 type Chalk = chalk_ir::Environment<ChalkIr>;
327 326
328 fn to_chalk(self, db: &impl HirDatabase) -> Arc<chalk_ir::Environment<ChalkIr>> { 327 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Environment<ChalkIr> {
329 let mut clauses = Vec::new(); 328 let mut clauses = Vec::new();
330 for pred in &self.predicates { 329 for pred in &self.predicates {
331 if pred.is_error() { 330 if pred.is_error() {
@@ -340,7 +339,7 @@ impl ToChalk for Arc<super::TraitEnvironment> {
340 339
341 fn from_chalk( 340 fn from_chalk(
342 _db: &impl HirDatabase, 341 _db: &impl HirDatabase,
343 _env: Arc<chalk_ir::Environment<ChalkIr>>, 342 _env: chalk_ir::Environment<ChalkIr>,
344 ) -> Arc<super::TraitEnvironment> { 343 ) -> Arc<super::TraitEnvironment> {
345 unimplemented!() 344 unimplemented!()
346 } 345 }