From 56a8a7645f9d6c872e9598b5a2617805f387e2a6 Mon Sep 17 00:00:00 2001 From: Casey Primozic Date: Tue, 6 Oct 2020 15:05:20 -0700 Subject: [PATCH 1/4] Bump chalk to use latest git to get fix * Chalk very recently (like an hour ago) merged a fix that prevents rust analyzer from panicking. This allows it to be usable again for code that hits those situations. See #6134, #6145, Probably #6120 --- Cargo.lock | 20 ++++++++------------ crates/hir_ty/Cargo.toml | 6 +++--- crates/hir_ty/src/traits/chalk.rs | 12 ++++++++++++ crates/hir_ty/src/traits/chalk/mapping.rs | 1 + editors/code/package.json | 2 +- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 49022502d92..9c921902c78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,9 +162,8 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chalk-derive" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6696d18587b7470c1e357a3fa120a2b7e6ac95e91d5c408f087455f7dc31f8b" +version = "0.32.0-dev.0" +source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" dependencies = [ "proc-macro2", "quote", @@ -174,9 +173,8 @@ dependencies = [ [[package]] name = "chalk-ir" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9538918d3e1fd6edda042d717c969a4099af67a40372dfb0a00b45d3a5a946" +version = "0.32.0-dev.0" +source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" dependencies = [ "chalk-derive", "lazy_static", @@ -184,9 +182,8 @@ dependencies = [ [[package]] name = "chalk-recursive" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8d95c808f2b540c39da889536e1ae0d15182107f61fe80000ec3a5c3959a" +version = "0.32.0-dev.0" +source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" dependencies = [ "chalk-derive", "chalk-ir", @@ -197,9 +194,8 @@ dependencies = [ [[package]] name = "chalk-solve" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f373dff4bcff66004424b72bcc56ae62889c21887c1cac875f083f69a7da4448" +version = "0.32.0-dev.0" +source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" dependencies = [ "chalk-derive", "chalk-ir", diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml index ed1c911c2d5..15c536c898f 100644 --- a/crates/hir_ty/Cargo.toml +++ b/crates/hir_ty/Cargo.toml @@ -17,9 +17,9 @@ ena = "0.14.0" log = "0.4.8" rustc-hash = "1.1.0" scoped-tls = "1" -chalk-solve = { version = "0.30.0" } -chalk-ir = { version = "0.30.0" } -chalk-recursive = { version = "0.30.0" } +chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev="ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" } +chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev="ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" } +chalk-recursive = { git = "https://github.com/rust-lang/chalk.git", rev="ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" } stdx = { path = "../stdx", version = "0.0.0" } hir_def = { path = "../hir_def", version = "0.0.0" } diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index 009b17a7f5f..98021816201 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs @@ -330,6 +330,18 @@ fn opaque_type_name(&self, opaque_ty_id: chalk_ir::OpaqueTyId) -> Stri fn fn_def_name(&self, fn_def_id: chalk_ir::FnDefId) -> String { format!("fn_{}", fn_def_id.0) } + fn generator_datum( + &self, + _: chalk_ir::GeneratorId, + ) -> std::sync::Arc> { + todo!() + } + fn generator_witness_datum( + &self, + _: chalk_ir::GeneratorId, + ) -> std::sync::Arc> { + todo!() + } } pub(crate) fn program_clauses_for_chalk_env_query( diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index d42f4bba9e5..140b20213c0 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs @@ -399,6 +399,7 @@ fn from_chalk(db: &dyn HirDatabase, type_name: TypeName) -> TypeCtor { // this should not be reached, since we don't represent TypeName::Error with TypeCtor unreachable!() } + _ => todo!(), } } } diff --git a/editors/code/package.json b/editors/code/package.json index 1f0e7550b5e..6a712a8a82f 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -1048,4 +1048,4 @@ ] } } -} \ No newline at end of file +} From f40e86e1412206dd3b097ef9bd0c22fd1c358293 Mon Sep 17 00:00:00 2001 From: Casey Primozic Date: Tue, 6 Oct 2020 15:19:34 -0700 Subject: [PATCH 2/4] `todo!()` -> `unimplemented!() // FIXME` for CI --- crates/hir_ty/src/traits/chalk.rs | 6 ++++-- crates/hir_ty/src/traits/chalk/mapping.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index 98021816201..cbe5cd7dd63 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs @@ -334,13 +334,15 @@ fn generator_datum( &self, _: chalk_ir::GeneratorId, ) -> std::sync::Arc> { - todo!() + // FIXME + unimplemented!() } fn generator_witness_datum( &self, _: chalk_ir::GeneratorId, ) -> std::sync::Arc> { - todo!() + // FIXME + unimplemented!() } } diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index 140b20213c0..31c902de65b 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs @@ -399,7 +399,7 @@ fn from_chalk(db: &dyn HirDatabase, type_name: TypeName) -> TypeCtor { // this should not be reached, since we don't represent TypeName::Error with TypeCtor unreachable!() } - _ => todo!(), + _ => unimplemented!(), // FIXME } } } From 13bdadb515fa08a3a24362c92cfc658b8cf159de Mon Sep 17 00:00:00 2001 From: Casey Primozic Date: Tue, 6 Oct 2020 23:56:31 -0700 Subject: [PATCH 3/4] Make unimplemented match variants explicit --- crates/hir_ty/src/traits/chalk/mapping.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index 31c902de65b..be33013132f 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs @@ -399,7 +399,8 @@ fn from_chalk(db: &dyn HirDatabase, type_name: TypeName) -> TypeCtor { // this should not be reached, since we don't represent TypeName::Error with TypeCtor unreachable!() } - _ => unimplemented!(), // FIXME + TypeName::Generator(_) => unimplemented!(), // FIXME + TypeName::GeneratorWitness(_) => unimplemented!(), // FIXME } } } From 37df2138ecb4a66aa8547467c7774dc9d378567b Mon Sep 17 00:00:00 2001 From: Casey Primozic Date: Wed, 7 Oct 2020 12:11:22 -0700 Subject: [PATCH 4/4] Switch from git to latest tagged release of chalk deps --- Cargo.lock | 20 ++++++++++++-------- crates/hir_ty/Cargo.toml | 6 +++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c921902c78..a1786d201ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,8 +162,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chalk-derive" -version = "0.32.0-dev.0" -source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d072b2ba723f0bada7c515d8b3725224bc4f5052d2a92dcbeb0b118ff37084a" dependencies = [ "proc-macro2", "quote", @@ -173,8 +174,9 @@ dependencies = [ [[package]] name = "chalk-ir" -version = "0.32.0-dev.0" -source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60cdb0e18c5455cb6a85e8464aad3622b70476018edfa8845691df66f7e9a05" dependencies = [ "chalk-derive", "lazy_static", @@ -182,8 +184,9 @@ dependencies = [ [[package]] name = "chalk-recursive" -version = "0.32.0-dev.0" -source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b14f40242102e7c0e2791a2cc86dbbc213a1d7b7acc0e22b7da329f4957d1722" dependencies = [ "chalk-derive", "chalk-ir", @@ -194,8 +197,9 @@ dependencies = [ [[package]] name = "chalk-solve" -version = "0.32.0-dev.0" -source = "git+https://github.com/rust-lang/chalk.git?rev=ebe62c2bc46899a0a92eabb456b38ad2d40abbd0#ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "981534d499a8476ecc0b520be4d3864757f96211826a75360fbf2cb6fae362ab" dependencies = [ "chalk-derive", "chalk-ir", diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml index 15c536c898f..0f3c85926af 100644 --- a/crates/hir_ty/Cargo.toml +++ b/crates/hir_ty/Cargo.toml @@ -17,9 +17,9 @@ ena = "0.14.0" log = "0.4.8" rustc-hash = "1.1.0" scoped-tls = "1" -chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev="ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" } -chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev="ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" } -chalk-recursive = { git = "https://github.com/rust-lang/chalk.git", rev="ebe62c2bc46899a0a92eabb456b38ad2d40abbd0" } +chalk-solve = "0.32" +chalk-ir = "0.32" +chalk-recursive = "0.32" stdx = { path = "../stdx", version = "0.0.0" } hir_def = { path = "../hir_def", version = "0.0.0" }