aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs15
1 files changed, 7 insertions, 8 deletions
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 }