From 632a22ae621079beaee6bbb155997e763c6b068d Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 29 Oct 2019 13:01:33 +0100 Subject: Upgrade Chalk, make use of TypeName::Error variant --- crates/ra_hir/Cargo.toml | 6 +++--- crates/ra_hir/src/ty/traits/chalk.rs | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'crates') 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" } test_utils = { path = "../test_utils" } ra_prof = { path = "../ra_prof" } -chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } -chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } -chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "1e5c1929364dfbb7c0c7ac0956b8250abe7c2cae" } +chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" } +chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" } +chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "8314f2fcec8582a58c24b638f1a259d4145a0809" } lalrpop-intern = "0.15.1" [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 { } Ty::Bound(idx) => chalk_ir::Ty::BoundVar(idx as usize), Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), - // FIXME this is clearly incorrect, but probably not too incorrect - // and I'm not sure what to actually do with Ty::Unknown - // maybe an alternative would be `for T`? (meaningless in rust, but expressible in chalk's Ty) // FIXME use Chalk's Dyn/Opaque once the bugs with that are fixed Ty::Unknown | Ty::Dyn(_) | Ty::Opaque(_) => { - PlaceholderIndex { ui: UniverseIndex::ROOT, idx: usize::max_value() } - .to_ty::() + let parameters = Vec::new(); + let name = TypeName::Error; + chalk_ir::ApplicationTy { name, parameters }.cast() } } } @@ -92,6 +90,7 @@ impl ToChalk for Ty { let parameters = from_chalk(db, apply_ty.parameters); Ty::Apply(ApplicationTy { ctor, parameters }) } + TypeName::Error => Ty::Unknown, // FIXME handle TypeKindId::Trait/Type here TypeName::TypeKindId(_) => unimplemented!(), TypeName::Placeholder(idx) => { @@ -323,9 +322,9 @@ where } impl ToChalk for Arc { - type Chalk = Arc>; + type Chalk = chalk_ir::Environment; - fn to_chalk(self, db: &impl HirDatabase) -> Arc> { + fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Environment { let mut clauses = Vec::new(); for pred in &self.predicates { if pred.is_error() { @@ -340,7 +339,7 @@ impl ToChalk for Arc { fn from_chalk( _db: &impl HirDatabase, - _env: Arc>, + _env: chalk_ir::Environment, ) -> Arc { unimplemented!() } -- cgit v1.2.3