Skip to content

Arg splat experiment - syntax impl#157605

Open
teor2345 wants to merge 2 commits into
rust-lang:mainfrom
teor2345:fn-arg-splat-exp-syntax
Open

Arg splat experiment - syntax impl#157605
teor2345 wants to merge 2 commits into
rust-lang:mainfrom
teor2345:fn-arg-splat-exp-syntax

Conversation

@teor2345
Copy link
Copy Markdown
Contributor

@teor2345 teor2345 commented Jun 8, 2026

View all comments

This PR is part of the argument splatting lang experiment, and FFI overloading / C++ interop project goals:

I've split it from #153697 to make reviewing easier, see that PR for more details.

The PR is the initial implementation of the feature:

  • splat incomplete feature gate
  • #[splat] attribute on function arguments
  • feature gate and UI tests for item type filtering, non-splattable arguments

Once this PR merges, I'll rebase #153697.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 8, 2026

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 8, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 8, 2026

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates


impl NoArgsAttributeParser for SplatParser {
const PATH: &[Symbol] = &[sym::splat];
const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer Jun 8, 2026

Choose a reason for hiding this comment

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

Please use (the default value) of Error unless you have a good reason not to

View changes since the review

const PATH: &[Symbol] = &[sym::splat];
const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
// FIXME(splat): do we want to allow MacroCall if the macro creates an argument
Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer Jun 8, 2026

Choose a reason for hiding this comment

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

Attributes on macro calls are currently lost and not placed on the generated item, so this is impossible unless you change that

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have no reason to change it, so I'll just remove the comment

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 8, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 8, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Comment on lines +390 to +391
if let Some(Param { ty, span, .. }) = &fn_decl.inputs.last() {
if let TyKind::CVarArgs = ty.kind {
Copy link
Copy Markdown
Member

@Kivooeo Kivooeo Jun 8, 2026

Choose a reason for hiding this comment

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

nitpick, but... let chains time!

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants