Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ debug = 0 # Set this to 1 or 2 to get more useful backtraces in debugger.
[patch.'crates-io']
# rowan = { path = "../rowan" }

[patch.'https://github.com/rust-lang/chalk.git']
# chalk-solve = { path = "../chalk/chalk-solve" }
# chalk-rust-ir = { path = "../chalk/chalk-rust-ir" }
# chalk-ir = { path = "../chalk/chalk-ir" }
# chalk-recursive = { path = "../chalk/chalk-recursive" }
6 changes: 3 additions & 3 deletions crates/hir_ty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ ena = "0.14.0"
log = "0.4.8"
rustc-hash = "1.1.0"
scoped-tls = "1"
chalk-solve = { version = "0.34", default-features = false }
chalk-ir = "0.34"
chalk-recursive = "0.34"
chalk-solve = { version = "0.36", default-features = false }
chalk-ir = "0.36"
chalk-recursive = "0.36"

stdx = { path = "../stdx", version = "0.0.0" }
hir_def = { path = "../hir_def", version = "0.0.0" }
Expand Down
21 changes: 10 additions & 11 deletions crates/hir_ty/src/traits/chalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;

use log::debug;

use chalk_ir::{fold::shift::Shift, CanonicalVarKinds, GenericArg, TypeName};
use chalk_ir::{fold::shift::Shift, CanonicalVarKinds, GenericArg};
use chalk_solve::rust_ir::{self, OpaqueTyDatumBound, WellKnownTrait};

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

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

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

let self_ty_fp = TyFingerprint::for_impl(&ty);
let fps: &[TyFingerprint] = match binder_kind(&ty, binders) {
Some(chalk_ir::TyKind::Integer) => &ALL_INT_FPS,
Some(chalk_ir::TyKind::Float) => &ALL_FLOAT_FPS,
Some(chalk_ir::TyVariableKind::Integer) => &ALL_INT_FPS,
Some(chalk_ir::TyVariableKind::Float) => &ALL_FLOAT_FPS,
_ => self_ty_fp.as_ref().map(std::slice::from_ref).unwrap_or(&[]),
};

Expand Down Expand Up @@ -129,12 +132,8 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
debug!("impls_for_trait returned {} impls", result.len());
result
}
fn impl_provided_for(
&self,
auto_trait_id: TraitId,
application_ty: &chalk_ir::ApplicationTy<Interner>,
) -> bool {
debug!("impl_provided_for {:?}, {:?}", auto_trait_id, application_ty);
fn impl_provided_for(&self, auto_trait_id: TraitId, kind: &chalk_ir::TyKind<Interner>) -> bool {
debug!("impl_provided_for {:?}, {:?}", auto_trait_id, kind);
false // FIXME
}
fn associated_ty_value(&self, id: AssociatedTyValueId) -> Arc<AssociatedTyValue> {
Expand Down Expand Up @@ -466,7 +465,7 @@ pub(crate) fn struct_datum_query(
struct_id: AdtId,
) -> Arc<StructDatum> {
debug!("struct_datum {:?}", struct_id);
let type_ctor: TypeCtor = from_chalk(db, TypeName::Adt(struct_id));
let type_ctor = TypeCtor::Adt(from_chalk(db, struct_id));
debug!("struct {:?} = {:?}", struct_id, type_ctor);
let num_params = type_ctor.num_ty_params(db);
let upstream = type_ctor.krate(db) != Some(krate);
Expand Down
7 changes: 0 additions & 7 deletions crates/hir_ty/src/traits/chalk/interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@ impl chalk_ir::interner::Interner for Interner {
tls::with_current_program(|prog| Some(prog?.debug_program_clause_implication(pci, fmt)))
}

fn debug_application_ty(
application_ty: &chalk_ir::ApplicationTy<Interner>,
fmt: &mut fmt::Formatter<'_>,
) -> Option<fmt::Result> {
tls::with_current_program(|prog| Some(prog?.debug_application_ty(application_ty, fmt)))
}

fn debug_substitution(
substitution: &chalk_ir::Substitution<Interner>,
fmt: &mut fmt::Formatter<'_>,
Expand Down
Loading