Link-time error when referencing symbols through generic types in naked_asm!
block
#140373
Labels
A-monomorphization
Area: Monomorphization
A-naked
Area: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzS
C-bug
Category: This is a bug.
When trying to reference a method on a generic type parameter from within a
naked_asm!
block,rust-lld
reports a link-time error indicating that a symbol could not be resolved. This used to work on a Rust nightly from 2024-11-16, but no longer does on a recent nightly (2025-04-26), wherenaked_functions
has been stabilized (#134213).Here's a link to a Rust playground that results in the link-time error:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=9de6dd640b6e55f857e8d65bafb82ab1
A minimal example to trigger this bug:
I expected to see this happen: correctly reference the proper, monomorphized function symbol
<E<42> as T>::t
.Instead, this happened:
What's weird is that the symbol being referenced is not related to the actual type instantiation
playground::E::<42>
, but only the trait-methodplayground::T::t
. Instead, onnightly-2024-11-16
, the generated assembly references the concrete type, as one would expect:Hopefully the above should be sufficient information to reproduce this bug.
In the meantime, I can try to bisect which nightly channel update (and perhaps whichEDIT: this error first started showing up onrustc
change) broke this.rustc 1.85.0-nightly (d4025ee45 2024-12-12)
,rustc 1.85.0-nightly (21fe748be 2024-12-11)
works correctly.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: