Skip to content

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

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

Metadata

Metadata

Assignees

Labels

A-name-manglingArea: Name mangling / decoration aka symbol manglingC-bugCategory: This is a bug.F-splat`#![feature(splat)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions