Skip to content

Commit 38927ef

Browse files
committed
add implementation-internal namespace for globalasm
1 parent d3e1ccd commit 38927ef

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

compiler/rustc_symbol_mangling/src/v0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,11 +882,11 @@ impl<'tcx> Printer<'tcx> for V0SymbolMangler<'tcx> {
882882
DefPathData::OpaqueTy => 'i',
883883
DefPathData::SyntheticCoroutineBody => 's',
884884
DefPathData::NestedStatic => 'n',
885+
DefPathData::GlobalAsm => 'a',
885886

886887
// These should never show up as `print_path_with_simple` arguments.
887888
DefPathData::CrateRoot
888889
| DefPathData::Use
889-
| DefPathData::GlobalAsm
890890
| DefPathData::Impl
891891
| DefPathData::MacroNs(_)
892892
| DefPathData::LifetimeNs(_)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ compile-flags: -Clink-dead-code
2+
//@ build-pass
3+
4+
#![allow(unused)]
5+
6+
// Test that a symbol in a `global_asm` namespace doesn't cause an ICE during v0 symbol mangling
7+
// due to a lack of missing namespace character for `global_asm`.
8+
//
9+
// FIXME: Can't use `#[rustc_symbol_name]` on the `foo` call to check its symbol, so just checking
10+
// the test compiles.
11+
12+
fn foo<const N: usize>() {}
13+
14+
core::arch::global_asm!("/* {} */", sym foo::<{
15+
|| {};
16+
0
17+
}>);
18+
19+
fn main() {}

0 commit comments

Comments
 (0)