From 797cdb00d91a221d62438b23dfd625a78163a58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 30 Jul 2020 20:37:28 +0300 Subject: Bump chalk --- crates/ra_hir_ty/Cargo.toml | 6 +++--- crates/ra_hir_ty/src/traits/chalk.rs | 19 ++++++++----------- crates/ra_hir_ty/src/traits/chalk/mapping.rs | 22 ++++++++++++++++------ 3 files changed, 27 insertions(+), 20 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 7242e2cb6..623ce261a 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml @@ -28,9 +28,9 @@ test_utils = { path = "../test_utils" } scoped-tls = "1" -chalk-solve = { version = "0.18.0" } -chalk-ir = { version = "0.18.0" } -chalk-recursive = { version = "0.18.0" } +chalk-solve = { version = "0.19.0" } +chalk-ir = { version = "0.19.0" } +chalk-recursive = { version = "0.19.0" } [dev-dependencies] expect = { path = "../expect" } diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 5298dbecf..1c7065364 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs @@ -183,6 +183,7 @@ impl<'a> chalk_solve::RustIrDatabase for ChalkContext<'a> { .collect(), 1, ), + where_clauses: make_binders(vec![], 0), }; let num_vars = datas.num_binders; Arc::new(OpaqueTyDatum { opaque_ty_id: id, bound: make_binders(bound, num_vars) }) @@ -193,15 +194,6 @@ impl<'a> chalk_solve::RustIrDatabase for ChalkContext<'a> { Ty::Unknown.to_chalk(self.db) } - fn force_impl_for( - &self, - _well_known: rust_ir::WellKnownTrait, - _ty: &chalk_ir::TyData, - ) -> Option { - // this method is mostly for rustc - None - } - fn is_object_safe(&self, _trait_id: chalk_ir::TraitId) -> bool { // FIXME: implement actual object safety true @@ -547,8 +539,13 @@ pub(crate) fn fn_def_datum_query( ), where_clauses, }; - let datum = - FnDefDatum { id: fn_def_id, binders: make_binders(bound, sig.num_binders), abi: () }; + let datum = FnDefDatum { + id: fn_def_id, + abi: (), + safety: chalk_ir::Safety::Safe, + variadic: sig.value.is_varargs, + binders: make_binders(bound, sig.num_binders), + }; Arc::new(datum) } diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs index 09d8347ca..b3e92993d 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs @@ -30,11 +30,16 @@ impl ToChalk for Ty { Ty::Apply(apply_ty) => match apply_ty.ctor { TypeCtor::Ref(m) => ref_to_chalk(db, m, apply_ty.parameters), TypeCtor::Array => array_to_chalk(db, apply_ty.parameters), - TypeCtor::FnPtr { num_args: _, is_varargs: _ } => { - // FIXME: handle is_varargs + TypeCtor::FnPtr { num_args: _, is_varargs } => { let substitution = apply_ty.parameters.to_chalk(db).shifted_in(&Interner); - chalk_ir::TyData::Function(chalk_ir::Fn { num_binders: 0, substitution }) - .intern(&Interner) + chalk_ir::TyData::Function(chalk_ir::FnPointer { + num_binders: 0, + abi: (), + safety: chalk_ir::Safety::Safe, + variadic: is_varargs, + substitution, + }) + .intern(&Interner) } _ => { let name = apply_ty.ctor.to_chalk(db); @@ -118,7 +123,12 @@ impl ToChalk for Ty { let parameters = from_chalk(db, opaque_ty.substitution); Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) } - chalk_ir::TyData::Function(chalk_ir::Fn { num_binders, substitution }) => { + chalk_ir::TyData::Function(chalk_ir::FnPointer { + num_binders, + variadic, + substitution, + .. + }) => { assert_eq!(num_binders, 0); let parameters: Substs = from_chalk( db, @@ -127,7 +137,7 @@ impl ToChalk for Ty { Ty::Apply(ApplicationTy { ctor: TypeCtor::FnPtr { num_args: (parameters.len() - 1) as u16, - is_varargs: false, + is_varargs: variadic, }, parameters, }) -- cgit v1.2.3