From a4eb1a546c7623f65823c5e249cd3c6d8c90fd8c Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 4 May 2019 19:07:25 +0200 Subject: Differentiate Tuple / FnPtr type constructors by cardinality This is necessary because Chalk (reasonably) expects each 'struct' to know how many type parameters it takes. --- crates/ra_hir/src/ty/traits/chalk.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/ty/traits') 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 debug!("struct_datum {:?}", struct_id); let type_ctor = from_chalk(self.db, struct_id); // FIXME might be nicer if we can create a fake GenericParams for the TypeCtor + // FIXME extract this to a method on Ty let (num_params, upstream) = match type_ctor { TypeCtor::Bool | TypeCtor::Char @@ -192,7 +193,8 @@ where | TypeCtor::Never | TypeCtor::Str => (0, true), TypeCtor::Slice | TypeCtor::Array | TypeCtor::RawPtr(_) | TypeCtor::Ref(_) => (1, true), - TypeCtor::FnPtr | TypeCtor::Tuple => unimplemented!(), // FIXME tuples and FnPtr are currently variadic... we need to make the parameter number explicit + TypeCtor::FnPtr { num_args } => (num_args as usize + 1, true), + TypeCtor::Tuple { cardinality } => (cardinality as usize, true), TypeCtor::FnDef(_) => unimplemented!(), TypeCtor::Adt(adt) => { let generic_params = adt.generic_params(self.db); -- cgit v1.2.3