diff options
author | Florian Diebold <[email protected]> | 2019-05-04 18:07:25 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-05-04 18:11:21 +0100 |
commit | a4eb1a546c7623f65823c5e249cd3c6d8c90fd8c (patch) | |
tree | 0942d7a4976bb444031d044beb1ea786adabcaeb /crates/ra_hir/src/ty/traits | |
parent | 19fbd919986e99287168f40aa11003a11aa43d3a (diff) |
Differentiate Tuple / FnPtr type constructors by cardinality
This is necessary because Chalk (reasonably) expects each 'struct' to know how
many type parameters it takes.
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 74370bae9..8b77d21b4 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -184,6 +184,7 @@ where | |||
184 | debug!("struct_datum {:?}", struct_id); | 184 | debug!("struct_datum {:?}", struct_id); |
185 | let type_ctor = from_chalk(self.db, struct_id); | 185 | let type_ctor = from_chalk(self.db, struct_id); |
186 | // FIXME might be nicer if we can create a fake GenericParams for the TypeCtor | 186 | // FIXME might be nicer if we can create a fake GenericParams for the TypeCtor |
187 | // FIXME extract this to a method on Ty | ||
187 | let (num_params, upstream) = match type_ctor { | 188 | let (num_params, upstream) = match type_ctor { |
188 | TypeCtor::Bool | 189 | TypeCtor::Bool |
189 | | TypeCtor::Char | 190 | | TypeCtor::Char |
@@ -192,7 +193,8 @@ where | |||
192 | | TypeCtor::Never | 193 | | TypeCtor::Never |
193 | | TypeCtor::Str => (0, true), | 194 | | TypeCtor::Str => (0, true), |
194 | TypeCtor::Slice | TypeCtor::Array | TypeCtor::RawPtr(_) | TypeCtor::Ref(_) => (1, true), | 195 | TypeCtor::Slice | TypeCtor::Array | TypeCtor::RawPtr(_) | TypeCtor::Ref(_) => (1, true), |
195 | TypeCtor::FnPtr | TypeCtor::Tuple => unimplemented!(), // FIXME tuples and FnPtr are currently variadic... we need to make the parameter number explicit | 196 | TypeCtor::FnPtr { num_args } => (num_args as usize + 1, true), |
197 | TypeCtor::Tuple { cardinality } => (cardinality as usize, true), | ||
196 | TypeCtor::FnDef(_) => unimplemented!(), | 198 | TypeCtor::FnDef(_) => unimplemented!(), |
197 | TypeCtor::Adt(adt) => { | 199 | TypeCtor::Adt(adt) => { |
198 | let generic_params = adt.generic_params(self.db); | 200 | let generic_params = adt.generic_params(self.db); |