Skip to content

Commit bca51e3

Browse files
committed
Upgrade Chalk to 0.36
Quite a few changes, because Chalk got rid of the `ApplicationTy` nesting.
1 parent e7c8c60 commit bca51e3

File tree

7 files changed

+188
-329
lines changed

7 files changed

+188
-329
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ debug = 0 # Set this to 1 or 2 to get more useful backtraces in debugger.
2222
[patch.'crates-io']
2323
# rowan = { path = "../rowan" }
2424

25-
[patch.'https://github.com/rust-lang/chalk.git']
2625
# chalk-solve = { path = "../chalk/chalk-solve" }
27-
# chalk-rust-ir = { path = "../chalk/chalk-rust-ir" }
2826
# chalk-ir = { path = "../chalk/chalk-ir" }
27+
# chalk-recursive = { path = "../chalk/chalk-recursive" }

crates/hir_ty/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ ena = "0.14.0"
1717
log = "0.4.8"
1818
rustc-hash = "1.1.0"
1919
scoped-tls = "1"
20-
chalk-solve = { version = "0.34", default-features = false }
21-
chalk-ir = "0.34"
22-
chalk-recursive = "0.34"
20+
chalk-solve = { version = "0.36", default-features = false }
21+
chalk-ir = "0.36"
22+
chalk-recursive = "0.36"
2323

2424
stdx = { path = "../stdx", version = "0.0.0" }
2525
hir_def = { path = "../hir_def", version = "0.0.0" }

crates/hir_ty/src/traits/chalk.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33

44
use log::debug;
55

6-
use chalk_ir::{fold::shift::Shift, CanonicalVarKinds, GenericArg, TypeName};
6+
use chalk_ir::{fold::shift::Shift, CanonicalVarKinds, GenericArg};
77
use chalk_solve::rust_ir::{self, OpaqueTyDatumBound, WellKnownTrait};
88

99
use base_db::{salsa::InternKey, CrateId};
@@ -81,7 +81,10 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
8181

8282
let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone());
8383

84-
fn binder_kind(ty: &Ty, binders: &CanonicalVarKinds<Interner>) -> Option<chalk_ir::TyKind> {
84+
fn binder_kind(
85+
ty: &Ty,
86+
binders: &CanonicalVarKinds<Interner>,
87+
) -> Option<chalk_ir::TyVariableKind> {
8588
if let Ty::Bound(bv) = ty {
8689
let binders = binders.as_slice(&Interner);
8790
if bv.debruijn == DebruijnIndex::INNERMOST {
@@ -95,8 +98,8 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
9598

9699
let self_ty_fp = TyFingerprint::for_impl(&ty);
97100
let fps: &[TyFingerprint] = match binder_kind(&ty, binders) {
98-
Some(chalk_ir::TyKind::Integer) => &ALL_INT_FPS,
99-
Some(chalk_ir::TyKind::Float) => &ALL_FLOAT_FPS,
101+
Some(chalk_ir::TyVariableKind::Integer) => &ALL_INT_FPS,
102+
Some(chalk_ir::TyVariableKind::Float) => &ALL_FLOAT_FPS,
100103
_ => self_ty_fp.as_ref().map(std::slice::from_ref).unwrap_or(&[]),
101104
};
102105

@@ -129,12 +132,8 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
129132
debug!("impls_for_trait returned {} impls", result.len());
130133
result
131134
}
132-
fn impl_provided_for(
133-
&self,
134-
auto_trait_id: TraitId,
135-
application_ty: &chalk_ir::ApplicationTy<Interner>,
136-
) -> bool {
137-
debug!("impl_provided_for {:?}, {:?}", auto_trait_id, application_ty);
135+
fn impl_provided_for(&self, auto_trait_id: TraitId, kind: &chalk_ir::TyKind<Interner>) -> bool {
136+
debug!("impl_provided_for {:?}, {:?}", auto_trait_id, kind);
138137
false // FIXME
139138
}
140139
fn associated_ty_value(&self, id: AssociatedTyValueId) -> Arc<AssociatedTyValue> {
@@ -466,7 +465,7 @@ pub(crate) fn struct_datum_query(
466465
struct_id: AdtId,
467466
) -> Arc<StructDatum> {
468467
debug!("struct_datum {:?}", struct_id);
469-
let type_ctor: TypeCtor = from_chalk(db, TypeName::Adt(struct_id));
468+
let type_ctor = TypeCtor::Adt(from_chalk(db, struct_id));
470469
debug!("struct {:?} = {:?}", struct_id, type_ctor);
471470
let num_params = type_ctor.num_ty_params(db);
472471
let upstream = type_ctor.krate(db) != Some(krate);

crates/hir_ty/src/traits/chalk/interner.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ impl chalk_ir::interner::Interner for Interner {
122122
tls::with_current_program(|prog| Some(prog?.debug_program_clause_implication(pci, fmt)))
123123
}
124124

125-
fn debug_application_ty(
126-
application_ty: &chalk_ir::ApplicationTy<Interner>,
127-
fmt: &mut fmt::Formatter<'_>,
128-
) -> Option<fmt::Result> {
129-
tls::with_current_program(|prog| Some(prog?.debug_application_ty(application_ty, fmt)))
130-
}
131-
132125
fn debug_substitution(
133126
substitution: &chalk_ir::Substitution<Interner>,
134127
fmt: &mut fmt::Formatter<'_>,

0 commit comments

Comments
 (0)