aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/item_tree/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-14 20:29:28 +0100
committerGitHub <[email protected]>2020-07-14 20:29:28 +0100
commitfc2f761d654aa17f4af7d3c40cb9b31ea7d91ad0 (patch)
tree7418a329ccaa953b5b4c9d3718232c195e2abb46 /crates/ra_hir_def/src/item_tree/lower.rs
parent3f2ab436f45a4fae32514756736055819ead2baa (diff)
parentfdce4d9f5140085c6c362ecbcf837f1b6a7d50ca (diff)
Merge #5378
5378: Thread varargs through rust-analyzer r=flodiebold a=jonas-schievink This adds a varargs flag to various data structures and fills it from the AST. Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5374 cc @flodiebold for the typesystem/chalk changes Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/item_tree/lower.rs')
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index 4182a9e3b..f79b8fca3 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -313,6 +313,14 @@ impl Ctx {
313 params.push(type_ref); 313 params.push(type_ref);
314 } 314 }
315 } 315 }
316
317 let mut is_varargs = false;
318 if let Some(params) = func.param_list() {
319 if let Some(last) = params.params().last() {
320 is_varargs = last.dotdotdot_token().is_some();
321 }
322 }
323
316 let ret_type = match func.ret_type().and_then(|rt| rt.type_ref()) { 324 let ret_type = match func.ret_type().and_then(|rt| rt.type_ref()) {
317 Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), 325 Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref),
318 _ => TypeRef::unit(), 326 _ => TypeRef::unit(),
@@ -334,6 +342,7 @@ impl Ctx {
334 has_self_param, 342 has_self_param,
335 is_unsafe: func.unsafe_token().is_some(), 343 is_unsafe: func.unsafe_token().is_some(),
336 params: params.into_boxed_slice(), 344 params: params.into_boxed_slice(),
345 is_varargs,
337 ret_type, 346 ret_type,
338 ast_id, 347 ast_id,
339 }; 348 };