Skip to content

Splat is ignored in symbol mangling, leading to symbol clashes #158644

Closed

Description

@teor2345

I tried this code:

#![allow(incomplete_features)]
#![feature(splat)]

fn main() {
    #[rustfmt::skip]
    let _x: fn(#[splat] (i32,)) = None.unwrap();

    let x: fn((i32,)) = None.unwrap();
    x((1,));
}

These directives seem to increase the chance of the error:

//@ incremental
//@ compile-flags: -C opt-level=0

I expected to see this happen:

No symbol clashes, either the symbol data is the same (and therefore merged), or it is different, and mangled differently.

Instead, this happened:

When I rebuild the file multiple times with small changes, I eventually get:

error: symbol `_RNvMNtCsCRATE_HASH_4core6optionINtB2_6OptionFTlEEuE6unwrapCsCRATE_HASH_14splat_mangling` is already defined

Meta

rustc version:

git main commit f46ec5218fe

In #153697, we decided not to include splat in symbol mangling. This is likely the cause of this error.

@rustbot label +C-bug +F-splat +T-compiler

cc @oli-obk

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    F-splat`#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jul 1, 2026
  2. teor2345 commented on Jul 1, 2026

    @teor2345
    MemberAuthor

    @rustbot claim

  3. added
    A-name-manglingArea: Name mangling / decoration aka symbol mangling
    on Jul 1, 2026
  4. teor2345 commented on Jul 4, 2026

    @teor2345
    MemberAuthor

    We'll also need a legacy symbol mangling variant for this test, which should pass without any fixes.
    (The legacy encoding uses the hash of the FnSig, which already includes the splatted index. The v0 encoding currently ignores splatting.)

    Destructuring the FnSig in the v0 mangling will make sure additional fields aren't missed in future. (Unless they're packed fields.)

  5. added a commit that references this issue on Jul 8, 2026
  6. added 3 commits that reference this issue on Jul 8, 2026
  7. added a commit that references this issue on Jul 8, 2026
  8. added 2 commits that reference this issue on Jul 9, 2026
  9. 8 remaining items

  10. added 2 commits that reference this issue on Jul 13, 2026
  11. added a commit that references this issue on Jul 13, 2026
  12. added a commit that references this issue on Jul 21, 2026
    b659bdb
  13. added 2 commits that reference this issue on Jul 21, 2026
    895abc3
    2c65c8b
  14. added 2 commits that reference this issue on Jul 22, 2026
    baf9267
    4609c87
  15. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 22, 2026
  16. added a commit that references this issue on Jul 22, 2026
    911fcda
  17. added a commit that references this issue on Jul 22, 2026
    a75cb96
  18. added a commit that references this issue on Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-name-manglingArea: Name mangling / decoration aka symbol manglingC-bugCategory: This is a bug.F-splat`#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions