Skip to content

Commit 2ce89ee

Browse files
committed
Add a test for mangling of named constants in const generics and array length
1 parent ff7906b commit 2ce89ee

File tree

4 files changed

+68
-3
lines changed

4 files changed

+68
-3
lines changed

tests/ui/symbol-names/types.legacy.stderr

+19-1
Original file line numberDiff line numberDiff line change
@@ -502,5 +502,23 @@ error: demangling-alt(a::b::Type<[T; N]>)
502502
LL | #[rustc_symbol_name]
503503
| ^^^^^^^^^^^^^^^^^^^^
504504

505-
error: aborting due to 84 previous errors
505+
error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$_$u5d$$GT$17h[HASH]E)
506+
--> $DIR/types.rs:272:5
507+
|
508+
LL | #[rustc_symbol_name]
509+
| ^^^^^^^^^^^^^^^^^^^^
510+
511+
error: demangling(a::b::Type<[u8; _]>::h[HASH])
512+
--> $DIR/types.rs:272:5
513+
|
514+
LL | #[rustc_symbol_name]
515+
| ^^^^^^^^^^^^^^^^^^^^
516+
517+
error: demangling-alt(a::b::Type<[u8; _]>)
518+
--> $DIR/types.rs:272:5
519+
|
520+
LL | #[rustc_symbol_name]
521+
| ^^^^^^^^^^^^^^^^^^^^
522+
523+
error: aborting due to 87 previous errors
506524

tests/ui/symbol-names/types.rs

+11
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ pub fn b() {
266266
//[v0]~| ERROR ::b::Type<[_; _]>>)
267267
//[v0]~| ERROR demangling-alt(<a::b::Type<[_; _]>>)
268268
impl<const N: usize, T> Type<[T; N]> {}
269+
270+
const ZERO: usize = 0;
271+
272+
#[rustc_symbol_name]
273+
//[legacy,verbose-legacy]~^ ERROR symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$_$u5d$$GT$
274+
//[legacy,verbose-legacy]~| ERROR demangling(a::b::Type<[u8; _]>::
275+
//[legacy,verbose-legacy]~| ERROR demangling-alt(a::b::Type<[u8; _]>)
276+
//[v0]~^^^^ ERROR symbol-name(_RMsq_NvCsCRATE_HASH_1a1bINtB<REF>_4TypeAhj0_E)
277+
//[v0]~| ERROR ::b::Type<[u8; 0usize]>>)
278+
//[v0]~| ERROR demangling-alt(<a::b::Type<[u8; 0]>>)
279+
impl Type<[u8; ZERO]> {}
269280
}
270281

271282
fn main() {}

tests/ui/symbol-names/types.v0.stderr

+19-1
Original file line numberDiff line numberDiff line change
@@ -502,5 +502,23 @@ error: demangling-alt(<a::b::Type<[_; _]>>)
502502
LL | #[rustc_symbol_name]
503503
| ^^^^^^^^^^^^^^^^^^^^
504504

505-
error: aborting due to 84 previous errors
505+
error: symbol-name(_RMsq_NvCsCRATE_HASH_1a1bINtB<REF>_4TypeAhj0_E)
506+
--> $DIR/types.rs:272:5
507+
|
508+
LL | #[rustc_symbol_name]
509+
| ^^^^^^^^^^^^^^^^^^^^
510+
511+
error: demangling(<a[HASH]::b::Type<[u8; 0usize]>>)
512+
--> $DIR/types.rs:272:5
513+
|
514+
LL | #[rustc_symbol_name]
515+
| ^^^^^^^^^^^^^^^^^^^^
516+
517+
error: demangling-alt(<a::b::Type<[u8; 0]>>)
518+
--> $DIR/types.rs:272:5
519+
|
520+
LL | #[rustc_symbol_name]
521+
| ^^^^^^^^^^^^^^^^^^^^
522+
523+
error: aborting due to 87 previous errors
506524

tests/ui/symbol-names/types.verbose-legacy.stderr

+19-1
Original file line numberDiff line numberDiff line change
@@ -502,5 +502,23 @@ error: demangling-alt(a::b::Type<[T; N]>)
502502
LL | #[rustc_symbol_name]
503503
| ^^^^^^^^^^^^^^^^^^^^
504504

505-
error: aborting due to 84 previous errors
505+
error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$_$u5d$$GT$17h[HASH]E)
506+
--> $DIR/types.rs:272:5
507+
|
508+
LL | #[rustc_symbol_name]
509+
| ^^^^^^^^^^^^^^^^^^^^
510+
511+
error: demangling(a::b::Type<[u8; _]>::h[HASH])
512+
--> $DIR/types.rs:272:5
513+
|
514+
LL | #[rustc_symbol_name]
515+
| ^^^^^^^^^^^^^^^^^^^^
516+
517+
error: demangling-alt(a::b::Type<[u8; _]>)
518+
--> $DIR/types.rs:272:5
519+
|
520+
LL | #[rustc_symbol_name]
521+
| ^^^^^^^^^^^^^^^^^^^^
522+
523+
error: aborting due to 87 previous errors
506524

0 commit comments

Comments
 (0)