Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread varargs through rust-analyzer #5378

Merged
merged 3 commits into from
Jul 14, 2020
Merged

Thread varargs through rust-analyzer #5378

merged 3 commits into from
Jul 14, 2020

Conversation

jonas-schievink
Copy link
Contributor

This adds a varargs flag to various data structures and fills it from the AST.

Fixes #5374

cc @flodiebold for the typesystem/chalk changes

Copy link
Member

@flodiebold flodiebold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -30,7 +30,7 @@ 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: _ } => {
TypeCtor::FnPtr { num_args: _, is_varargs: _ } => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be a problem since function pointers will lose their varargness if they go through Chalk. should probably be fine for now though, but at least a FIXME would be good. Alternatively, you could do is_varargs: false here, then the varargs case would be handled by interning the type constructor (basically treating the type like a struct), which would mean that varargness would be preserved, but vararg function pointers wouldn't be treated as function pointers by Chalk.

Chalk issue tracking this: rust-lang/chalk#507

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, FIXME added

@jonas-schievink
Copy link
Contributor Author

bors r=flodiebold

@bors
Copy link
Contributor

bors bot commented Jul 14, 2020

@bors bors bot merged commit fc2f761 into rust-lang:master Jul 14, 2020
@jonas-schievink jonas-schievink deleted the varararargs branch July 20, 2020 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing to handle varargs in C functions (regression)
2 participants