Splat is ignored in symbol mangling, leading to symbol clashes #158644
Copy link
Copy link
Closed
Labels
A-name-manglingArea: Name mangling / decoration aka symbol manglingArea: Name mangling / decoration aka symbol manglingC-bugCategory: This is a bug.Category: This is a bug.F-splat`#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629`#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-name-manglingArea: Name mangling / decoration aka symbol manglingArea: Name mangling / decoration aka symbol manglingC-bugCategory: This is a bug.Category: This is a bug.F-splat`#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629`#![feature(splat)]` https://github.com/rust-lang/rust/issues/153629T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
teor2345 commentedon Jul 1, 2026
@rustbot claim
teor2345 commentedon Jul 4, 2026
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.)
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
8 remaining items
Rollup merge of rust-lang#159202 - teor2345:bump-rustc-demangle, r=Ma…
Rollup merge of rust-lang#159202 - teor2345:bump-rustc-demangle, r=Ma…
Unrolled build for #159202
Rollup merge of #159202 - teor2345:bump-rustc-demangle, r=Mark-Simula…
Rollup merge of rust-lang#158890 - teor2345:splat-mangling-clash, r=w…
Rollup merge of rust-lang#158890 - teor2345:splat-mangling-clash, r=w…
Rollup merge of rust-lang#158890 - teor2345:splat-mangling-clash, r=w…
Rollup merge of rust-lang#158890 - teor2345:splat-mangling-clash, r=w…
Rollup merge of rust-lang#158890 - teor2345:splat-mangling-clash, r=w…
Unrolled build for #158890
Rollup merge of #158890 - teor2345:splat-mangling-clash, r=wesleywiser
Rollup merge of rust-lang#159202 - teor2345:bump-rustc-demangle, r=Ma…
Rollup merge of #159202 - teor2345:bump-rustc-demangle, r=Mark-Simula…