diff options
-rw-r--r-- | Cargo.lock | 16 | ||||
-rw-r--r-- | crates/ra_hir_ty/Cargo.toml | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 19 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/mapping.rs | 22 |
4 files changed, 35 insertions, 28 deletions
diff --git a/Cargo.lock b/Cargo.lock index e8db88f09..234c31406 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -125,9 +125,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | |||
125 | 125 | ||
126 | [[package]] | 126 | [[package]] |
127 | name = "chalk-derive" | 127 | name = "chalk-derive" |
128 | version = "0.18.0" | 128 | version = "0.19.0" |
129 | source = "registry+https://github.com/rust-lang/crates.io-index" | 129 | source = "registry+https://github.com/rust-lang/crates.io-index" |
130 | checksum = "eea3a22f0c30b2504ac4ab58934dac0d00b92a4d7788df32795cabca24c3f929" | 130 | checksum = "654c611946ba2629c5028cb7708687af975faf2c29d731824cb294c873df4697" |
131 | dependencies = [ | 131 | dependencies = [ |
132 | "proc-macro2", | 132 | "proc-macro2", |
133 | "quote", | 133 | "quote", |
@@ -137,9 +137,9 @@ dependencies = [ | |||
137 | 137 | ||
138 | [[package]] | 138 | [[package]] |
139 | name = "chalk-ir" | 139 | name = "chalk-ir" |
140 | version = "0.18.0" | 140 | version = "0.19.0" |
141 | source = "registry+https://github.com/rust-lang/crates.io-index" | 141 | source = "registry+https://github.com/rust-lang/crates.io-index" |
142 | checksum = "fb617b643e145e3b151502799e91a9625dd5daf1cf05dc2cb821bc75ae0c9cbd" | 142 | checksum = "0a5341fbc654ca886b73b804a36aebf0e621057ccc1a68e9815b5b39b3ac9ae8" |
143 | dependencies = [ | 143 | dependencies = [ |
144 | "chalk-derive", | 144 | "chalk-derive", |
145 | "lazy_static", | 145 | "lazy_static", |
@@ -147,9 +147,9 @@ dependencies = [ | |||
147 | 147 | ||
148 | [[package]] | 148 | [[package]] |
149 | name = "chalk-recursive" | 149 | name = "chalk-recursive" |
150 | version = "0.18.0" | 150 | version = "0.19.0" |
151 | source = "registry+https://github.com/rust-lang/crates.io-index" | 151 | source = "registry+https://github.com/rust-lang/crates.io-index" |
152 | checksum = "d280565c8eefbf9b2bc615df49c7dfd971faad37774bf65734e626fd23864bd6" | 152 | checksum = "4484807b155b5a411e6135d330295f9ba5042e2920b8712c6574ca6ea91e9ee5" |
153 | dependencies = [ | 153 | dependencies = [ |
154 | "chalk-derive", | 154 | "chalk-derive", |
155 | "chalk-ir", | 155 | "chalk-ir", |
@@ -160,9 +160,9 @@ dependencies = [ | |||
160 | 160 | ||
161 | [[package]] | 161 | [[package]] |
162 | name = "chalk-solve" | 162 | name = "chalk-solve" |
163 | version = "0.18.0" | 163 | version = "0.19.0" |
164 | source = "registry+https://github.com/rust-lang/crates.io-index" | 164 | source = "registry+https://github.com/rust-lang/crates.io-index" |
165 | checksum = "be906fbca3f3077dce0e76d9864771d0f450c946af0d86b569fb9504148a065a" | 165 | checksum = "281f82facd2538997fbe52132b1941ed213d266748215c31d15f62a8664429ad" |
166 | dependencies = [ | 166 | dependencies = [ |
167 | "chalk-derive", | 167 | "chalk-derive", |
168 | "chalk-ir", | 168 | "chalk-ir", |
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" } | |||
28 | 28 | ||
29 | scoped-tls = "1" | 29 | scoped-tls = "1" |
30 | 30 | ||
31 | chalk-solve = { version = "0.18.0" } | 31 | chalk-solve = { version = "0.19.0" } |
32 | chalk-ir = { version = "0.18.0" } | 32 | chalk-ir = { version = "0.19.0" } |
33 | chalk-recursive = { version = "0.18.0" } | 33 | chalk-recursive = { version = "0.19.0" } |
34 | 34 | ||
35 | [dev-dependencies] | 35 | [dev-dependencies] |
36 | expect = { path = "../expect" } | 36 | 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<Interner> for ChalkContext<'a> { | |||
183 | .collect(), | 183 | .collect(), |
184 | 1, | 184 | 1, |
185 | ), | 185 | ), |
186 | where_clauses: make_binders(vec![], 0), | ||
186 | }; | 187 | }; |
187 | let num_vars = datas.num_binders; | 188 | let num_vars = datas.num_binders; |
188 | Arc::new(OpaqueTyDatum { opaque_ty_id: id, bound: make_binders(bound, num_vars) }) | 189 | Arc::new(OpaqueTyDatum { opaque_ty_id: id, bound: make_binders(bound, num_vars) }) |
@@ -193,15 +194,6 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
193 | Ty::Unknown.to_chalk(self.db) | 194 | Ty::Unknown.to_chalk(self.db) |
194 | } | 195 | } |
195 | 196 | ||
196 | fn force_impl_for( | ||
197 | &self, | ||
198 | _well_known: rust_ir::WellKnownTrait, | ||
199 | _ty: &chalk_ir::TyData<Interner>, | ||
200 | ) -> Option<bool> { | ||
201 | // this method is mostly for rustc | ||
202 | None | ||
203 | } | ||
204 | |||
205 | fn is_object_safe(&self, _trait_id: chalk_ir::TraitId<Interner>) -> bool { | 197 | fn is_object_safe(&self, _trait_id: chalk_ir::TraitId<Interner>) -> bool { |
206 | // FIXME: implement actual object safety | 198 | // FIXME: implement actual object safety |
207 | true | 199 | true |
@@ -547,8 +539,13 @@ pub(crate) fn fn_def_datum_query( | |||
547 | ), | 539 | ), |
548 | where_clauses, | 540 | where_clauses, |
549 | }; | 541 | }; |
550 | let datum = | 542 | let datum = FnDefDatum { |
551 | FnDefDatum { id: fn_def_id, binders: make_binders(bound, sig.num_binders), abi: () }; | 543 | id: fn_def_id, |
544 | abi: (), | ||
545 | safety: chalk_ir::Safety::Safe, | ||
546 | variadic: sig.value.is_varargs, | ||
547 | binders: make_binders(bound, sig.num_binders), | ||
548 | }; | ||
552 | Arc::new(datum) | 549 | Arc::new(datum) |
553 | } | 550 | } |
554 | 551 | ||
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 { | |||
30 | Ty::Apply(apply_ty) => match apply_ty.ctor { | 30 | Ty::Apply(apply_ty) => match apply_ty.ctor { |
31 | TypeCtor::Ref(m) => ref_to_chalk(db, m, apply_ty.parameters), | 31 | TypeCtor::Ref(m) => ref_to_chalk(db, m, apply_ty.parameters), |
32 | TypeCtor::Array => array_to_chalk(db, apply_ty.parameters), | 32 | TypeCtor::Array => array_to_chalk(db, apply_ty.parameters), |
33 | TypeCtor::FnPtr { num_args: _, is_varargs: _ } => { | 33 | TypeCtor::FnPtr { num_args: _, is_varargs } => { |
34 | // FIXME: handle is_varargs | ||
35 | let substitution = apply_ty.parameters.to_chalk(db).shifted_in(&Interner); | 34 | let substitution = apply_ty.parameters.to_chalk(db).shifted_in(&Interner); |
36 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders: 0, substitution }) | 35 | chalk_ir::TyData::Function(chalk_ir::FnPointer { |
37 | .intern(&Interner) | 36 | num_binders: 0, |
37 | abi: (), | ||
38 | safety: chalk_ir::Safety::Safe, | ||
39 | variadic: is_varargs, | ||
40 | substitution, | ||
41 | }) | ||
42 | .intern(&Interner) | ||
38 | } | 43 | } |
39 | _ => { | 44 | _ => { |
40 | let name = apply_ty.ctor.to_chalk(db); | 45 | let name = apply_ty.ctor.to_chalk(db); |
@@ -118,7 +123,12 @@ impl ToChalk for Ty { | |||
118 | let parameters = from_chalk(db, opaque_ty.substitution); | 123 | let parameters = from_chalk(db, opaque_ty.substitution); |
119 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) | 124 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) |
120 | } | 125 | } |
121 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders, substitution }) => { | 126 | chalk_ir::TyData::Function(chalk_ir::FnPointer { |
127 | num_binders, | ||
128 | variadic, | ||
129 | substitution, | ||
130 | .. | ||
131 | }) => { | ||
122 | assert_eq!(num_binders, 0); | 132 | assert_eq!(num_binders, 0); |
123 | let parameters: Substs = from_chalk( | 133 | let parameters: Substs = from_chalk( |
124 | db, | 134 | db, |
@@ -127,7 +137,7 @@ impl ToChalk for Ty { | |||
127 | Ty::Apply(ApplicationTy { | 137 | Ty::Apply(ApplicationTy { |
128 | ctor: TypeCtor::FnPtr { | 138 | ctor: TypeCtor::FnPtr { |
129 | num_args: (parameters.len() - 1) as u16, | 139 | num_args: (parameters.len() - 1) as u16, |
130 | is_varargs: false, | 140 | is_varargs: variadic, |
131 | }, | 141 | }, |
132 | parameters, | 142 | parameters, |
133 | }) | 143 | }) |