Skip to content

Rename splat to avoid stable name collisions#159817

Draft
teor2345 wants to merge 3 commits into
rust-lang:mainfrom
teor2345:splat-rename-nightly
Draft

Rename splat to avoid stable name collisions#159817
teor2345 wants to merge 3 commits into
rust-lang:mainfrom
teor2345:splat-rename-nightly

Conversation

@teor2345

@teor2345 teor2345 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

TODO

  • rename the attribute to rustc_splat
    • add the rustc_internal (?) feature to the UI tests
  • keep using the splat symbol for the feature name

Tracking issue: #153629

This PR renames #[splat] to #[arg_splat], in a mostly automated way (using fastmod).

The rename commands I used were:

fastmod --fixed-strings '#[splat]' '#[arg_splat]'
fastmod --fixed-strings '#![feature(splat' '#![feature(arg_splat'
# All the remaining commands are no-ops on beta
fastmod --fixed-strings 'multiple `splat` attributes' 'multiple `arg_splat` attributes'
# Legacy symbol demangling
fastmod --fixed-strings '$splat$' '$arg_splat$'
# Revert some changes that aren't in rustc_demangle yet
fastmod --fixed-strings 'main::Type<fn(#[arg_splat]' 'main::Type<fn(#[splat]'
fastmod --fixed-strings 'main::Type<*const fn(#[arg_splat]' 'main::Type<*const fn(#[splat]'

Part of #159428

Backport Advice

Cherry-pick the first commit to the beta branch, then run the fastmod commands above.
I've tested this locally, and it works, see my splat-rename-beta branch.

Remaining Work

rustc_demangle needs an update to the attribute name, a release, and then a version bump in rust-lang/rust. I'll do that separately. It doesn't need to be backported, because the last version bump was after beta branched.

There's also some external code that needs updates, the full list is in the ticket: #159428 (comment)

Can someone with write access also update the description for the F-splat GitHub label 🙂

@rustbot label +beta-nominated +A-attributes +A-macros +A-resolve +C-bug +F-splat +P-high +T-compiler

teor2345 added 3 commits July 24, 2026 16:28
fastmod --fixed-strings '#[splat]' '#[arg_splat]'
fastmod --fixed-strings '#![feature(splat' '#![feature(arg_splat'
fastmod --fixed-strings 'multiple `splat` attributes' 'multiple `arg_splat` attributes'
fastmod --fixed-strings '$splat$' '$arg_splat$'
Revert some changes that aren't in rustc_demangle yet
fastmod --fixed-strings 'main::Type<fn(#[arg_splat]' 'main::Type<fn(#[splat]'
fastmod --fixed-strings 'main::Type<*const fn(#[arg_splat]' 'main::Type<*const fn(#[splat]'
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

The reflection data structures are tied exactly to the implementation
in the compiler. Make sure to also adjust rustc_const_eval/src/const_eval/type_info.rs

cc @oli-obk

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

rustfmt is developed in its own repository. If possible, consider making this change to rust-lang/rustfmt instead.

cc @rust-lang/rustfmt

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Jul 24, 2026
@rustbot rustbot added 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Jul 24, 2026
@rustbot

This comment was marked as outdated.

@rustbot

This comment was marked as outdated.

@teor2345

Copy link
Copy Markdown
Contributor Author

No P-high for me!

@rustbot label +beta-nominated +A-attributes +A-macros +A-resolve +C-bug +F-splat +T-compiler

@rustbot rustbot added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically beta-nominated Nominated for backporting to the compiler in the beta channel. C-bug Category: This is a bug. F-splat `#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629 labels Jul 24, 2026
@teor2345 teor2345 changed the title Splat rename nightly Rename splat to avoid stable name collisions Jul 24, 2026
@teor2345
teor2345 marked this pull request as draft July 24, 2026 07:13
@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 Jul 24, 2026
@jieyouxu

Copy link
Copy Markdown
Member

FWIW we only assign P-* for issues not PRs; I'm happy to review the rename.
r? me

@rustbot rustbot assigned jieyouxu and unassigned fee1-dead Jul 24, 2026
@apiraino

Copy link
Copy Markdown
Contributor

I will "de-nominate" from backport as now it's a bit too early. Feel free to nominate again when the PR is reviewed and approved :)

@rustbot label -beta-nominated

@rustbot rustbot removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 24, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

failures:

---- test::system_tests stdout ----
2026-07-24T07:59:22.994885Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.023898Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.066637Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.178743Z  WARN rustfmt_nightly::test: Default value false used explicitly for wrap_comments
2026-07-24T07:59:23.300221Z  WARN rustfmt_nightly::test: Default value [] used explicitly for skip_macro_invocations
2026-07-24T07:59:23.314555Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.412058Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.461992Z  WARN rustfmt_nightly::test: Default value true used explicitly for reorder_imports
2026-07-24T07:59:23.467056Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.488181Z  WARN rustfmt_nightly::test: Default value 100 used explicitly for max_width
2026-07-24T07:59:23.560018Z  WARN rustfmt_nightly::test: Default value true used explicitly for reorder_imports
2026-07-24T07:59:23.568307Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.679622Z  WARN rustfmt_nightly::test: Default value 100 used explicitly for max_width
Warning: the `fn_args_layout` option is deprecated. Use `fn_params_layout`. instead
2026-07-24T07:59:23.708299Z  WARN rustfmt_nightly::test: Default value 100 used explicitly for max_width
2026-07-24T07:59:23.715227Z  WARN rustfmt_nightly::test: Default value true used explicitly for reorder_modules
Warning: the `merge_imports` option is deprecated. Use `imports_granularity="Crate"` instead

thread '<unnamed>' (54641) panicked at src/tools/rustfmt/src/test/mod.rs:842:40:
called `Result::unwrap()` on an `Err` value: ModuleResolutionError(ModuleResolutionError { module: "ZYXW", kind: NotFound { file: "tests/source/reorder_modules/ZYXW.rs" } })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'test::system_tests' (54640) panicked at src/tools/rustfmt/src/test/mod.rs:82:10:
Failed to join a test thread: Any { .. }
---- test::system_tests stdout end ----
---- test::idempotence_tests stdout ----
2026-07-24T07:59:22.944331Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:22.978387Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.058591Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.198770Z  WARN rustfmt_nightly::test: Default value false used explicitly for wrap_comments
2026-07-24T07:59:23.354421Z  WARN rustfmt_nightly::test: Default value [] used explicitly for skip_macro_invocations
2026-07-24T07:59:23.366876Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.520452Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.547348Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.598288Z  WARN rustfmt_nightly::test: Default value true used explicitly for reorder_imports
2026-07-24T07:59:23.606702Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.613247Z  WARN rustfmt_nightly::test: Default value 0 used explicitly for struct_field_align_threshold
2026-07-24T07:59:23.617609Z  WARN rustfmt_nightly::test: Default value 100 used explicitly for max_width
2026-07-24T07:59:23.617615Z  WARN rustfmt_nightly::test: Default value 4 used explicitly for tab_spaces
2026-07-24T07:59:23.617620Z  WARN rustfmt_nightly::test: Default value SameLineWhere used explicitly for brace_style
2026-07-24T07:59:23.617624Z  WARN rustfmt_nightly::test: Default value true used explicitly for reorder_modules
2026-07-24T07:59:23.617629Z  WARN rustfmt_nightly::test: Default value false used explicitly for hard_tabs
2026-07-24T07:59:23.636048Z  WARN rustfmt_nightly::test: Default value false used explicitly for wrap_comments
2026-07-24T07:59:23.641961Z  WARN rustfmt_nightly::test: Default value 100 used explicitly for max_width
2026-07-24T07:59:23.744255Z  WARN rustfmt_nightly::test: Default value false used explicitly for wrap_comments
2026-07-24T07:59:23.752239Z  WARN rustfmt_nightly::test: Default value true used explicitly for reorder_imports
2026-07-24T07:59:23.758744Z  WARN rustfmt_nightly::test: Default value 2015 used explicitly for style_edition
2026-07-24T07:59:23.887035Z  WARN rustfmt_nightly::test: Default value 100 used explicitly for max_width
Warning: the `fn_args_layout` option is deprecated. Use `fn_params_layout`. instead
2026-07-24T07:59:23.912767Z  WARN rustfmt_nightly::test: Default value 100 used explicitly for max_width
2026-07-24T07:59:23.916047Z  WARN rustfmt_nightly::modules: Couldn't find file for mod foo;`
2026-07-24T07:59:23.919729Z  WARN rustfmt_nightly::test: Default value true used explicitly for reorder_modules
Warning: the `merge_imports` option is deprecated. Use `imports_granularity="Crate"` instead

thread '<unnamed>' (54612) panicked at src/tools/rustfmt/src/test/mod.rs:842:40:
called `Result::unwrap()` on an `Err` value: ModuleResolutionError(ModuleResolutionError { module: "ZYXW", kind: NotFound { file: "tests/target/reorder_modules/ZYXW.rs" } })

thread 'test::idempotence_tests' (54611) panicked at src/tools/rustfmt/src/test/mod.rs:82:10:
Failed to join a test thread: Any { .. }
---- test::idempotence_tests stdout end ----

@rust-bors

rust-bors Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #159814) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

@ytmimi ytmimi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please restore src/tools/rustfmt/tests/source/reorder_modules/ZYXW/mod.rs, src/tools/rustfmt/tests/source/reorder_modules/ZYXW/mod.rs, src/tools/rustfmt/tests/target/reorder_modules/ABCD/mod.rs, src/tools/rustfmt/tests/target/reorder_modules/ZYXW/mod.rs

Removing these files is causing rustfmt test failures:

  thread '<unnamed>' (54612) panicked at src/tools/rustfmt/src/test/mod.rs:842:40:
  called `Result::unwrap()` on an `Err` value: ModuleResolutionError(ModuleResolutionError { module: "ZYXW", kind: NotFound { file: "tests/target/reorder_modules/ZYXW.rs" }

View changes since this review

@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

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

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-bug Category: This is a bug. F-splat `#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants