Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,11 @@ impl<'tcx> Printer<'tcx> for V0SymbolMangler<'tcx> {
DefPathData::OpaqueTy => 'i',
DefPathData::SyntheticCoroutineBody => 's',
DefPathData::NestedStatic => 'n',
DefPathData::GlobalAsm => 'a',

// These should never show up as `print_path_with_simple` arguments.
DefPathData::CrateRoot
| DefPathData::Use
| DefPathData::GlobalAsm
| DefPathData::Impl
| DefPathData::MacroNs(_)
| DefPathData::LifetimeNs(_)
Expand Down
19 changes: 19 additions & 0 deletions tests/ui/symbol-names/const-in-global-asm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ compile-flags: -Clink-dead-code
//@ build-pass

#![allow(unused)]

// Test that a symbol in a `global_asm` namespace doesn't cause an ICE during v0 symbol mangling
// due to a lack of missing namespace character for `global_asm`.
//
// FIXME: Can't use `#[rustc_symbol_name]` on the `foo` call to check its symbol, so just checking
// the test compiles.

fn foo<const N: usize>() {}

core::arch::global_asm!("/* {} */", sym foo::<{
|| {};
0
}>);

fn main() {}
Loading