Test legacy mangling of bool, char and integer constants

The existing v0 tests have been slightly adjusted for compatibility with
legacy mangler, which requires an item to have an ancestor in a value
namespace or a type namespace to produce a symbol for it. In v0 mangling
this results in an extra `Nv` component.
This commit is contained in:
Tomasz Miąsko 2022-02-25 00:00:00 +00:00
parent 9f8f0a6e94
commit 5ca93742fe
4 changed files with 194 additions and 96 deletions

View File

@ -0,0 +1,74 @@
error: symbol-name(_ZN1c21Unsigned$LT$11_u8$GT$1f17h[HASH]E)
--> $DIR/const-generics-demangling.rs:13:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(c::Unsigned<11_u8>::f::h[HASH])
--> $DIR/const-generics-demangling.rs:13:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(c::Unsigned<11_u8>::f)
--> $DIR/const-generics-demangling.rs:13:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_ZN1c22Signed$LT$.152_i16$GT$1f17h[HASH]E)
--> $DIR/const-generics-demangling.rs:26:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(c::Signed<.152_i16>::f::h[HASH])
--> $DIR/const-generics-demangling.rs:26:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(c::Signed<.152_i16>::f)
--> $DIR/const-generics-demangling.rs:26:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_ZN1c13Bool$LT$_$GT$1f17h[HASH]E)
--> $DIR/const-generics-demangling.rs:39:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(c::Bool<_>::f::h[HASH])
--> $DIR/const-generics-demangling.rs:39:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(c::Bool<_>::f)
--> $DIR/const-generics-demangling.rs:39:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_ZN1c13Char$LT$_$GT$1f17h[HASH]E)
--> $DIR/const-generics-demangling.rs:52:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(c::Char<_>::f::h[HASH])
--> $DIR/const-generics-demangling.rs:52:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(c::Char<_>::f)
--> $DIR/const-generics-demangling.rs:52:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors

View File

@ -1,38 +1,62 @@
// build-fail
// compile-flags: -C symbol-mangling-version=v0 --crate-name=c
// normalize-stderr-test: "c\[.*?\]" -> "c[HASH]"
// revisions: legacy v0
// compile-flags: --crate-name=c
//[legacy]compile-flags: -C symbol-mangling-version=legacy -Z unstable-options
// [v0]compile-flags: -C symbol-mangling-version=v0
//[legacy]normalize-stderr-test: "h[[:xdigit:]]{16}" -> "h[HASH]"
// [v0]normalize-stderr-test: "c\[.*?\]" -> "c[HASH]"
#![feature(rustc_attrs)]
pub struct Unsigned<const F: u8>;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMCs
//~| ERROR demangling(<c[
//~| ERROR demangling-alt(<c::Unsigned<11>>)
impl Unsigned<11> {}
impl Unsigned<11> {
#[rustc_symbol_name]
//[v0]~^ ERROR symbol-name(_RNvMCs
//[v0]~| ERROR demangling(<c[
//[v0]~| ERROR demangling-alt(<c::Unsigned<11>>::f)
//[legacy]~^^^^ ERROR symbol-name(_ZN1c21Unsigned$LT$11_u8$GT$
//[legacy]~| ERROR demangling(c::Unsigned<11_u8>::f::
//[legacy]~| ERROR demangling-alt(c::Unsigned<11_u8>::f)
fn f() {}
}
pub struct Signed<const F: i16>;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs_Cs
//~| ERROR demangling(<c[
//~| ERROR demangling-alt(<c::Signed<-152>>)
impl Signed<-152> {}
impl Signed<-152> {
#[rustc_symbol_name]
//[v0]~^ ERROR symbol-name(_RNvMs_Cs
//[v0]~| ERROR demangling(<c[
//[v0]~| ERROR demangling-alt(<c::Signed<-152>>::f)
//[legacy]~^^^^ ERROR symbol-name(_ZN1c22Signed$LT$.152_i16$GT$
//[legacy]~| ERROR demangling(c::Signed<.152_i16>::f::
//[legacy]~| ERROR demangling-alt(c::Signed<.152_i16>::f)
fn f() {}
}
pub struct Bool<const F: bool>;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs0_Cs
//~| ERROR demangling(<c[
//~| ERROR demangling-alt(<c::Bool<true>>)
impl Bool<true> {}
impl Bool<true> {
#[rustc_symbol_name]
//[v0]~^ ERROR symbol-name(_RNvMs0_Cs
//[v0]~| ERROR demangling(<c[
//[v0]~| ERROR demangling-alt(<c::Bool<true>>::f)
//[legacy]~^^^^ ERROR symbol-name(_ZN1c13Bool$LT$_$GT$
//[legacy]~| ERROR demangling(c::Bool<_>::f::
//[legacy]~| ERROR demangling-alt(c::Bool<_>::f)
fn f() {}
}
pub struct Char<const F: char>;
#[rustc_symbol_name]
//~^ ERROR symbol-name(_RMs1_Cs
//~| ERROR demangling(<c[
//~| ERROR demangling-alt(<c::Char<'∂'>>)
impl Char<'∂'> {}
impl Char<'∂'> {
#[rustc_symbol_name]
//[v0]~^ ERROR symbol-name(_RNvMs1_Cs
//[v0]~| ERROR demangling(<c[
//[v0]~| ERROR demangling-alt(<c::Char<'∂'>>::f)
//[legacy]~^^^^ ERROR symbol-name(_ZN1c13Char$LT$_$GT$
//[legacy]~| ERROR demangling(c::Char<_>::f::
//[legacy]~| ERROR demangling-alt(c::Char<_>::f)
fn f() {}
}
fn main() {}

View File

@ -1,74 +0,0 @@
error: symbol-name(_RMCsCRATE_HASH_1cINtB<REF>_8UnsignedKhb_E)
--> $DIR/const-generics-demangling.rs:8:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Unsigned<11u8>>)
--> $DIR/const-generics-demangling.rs:8:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Unsigned<11>>)
--> $DIR/const-generics-demangling.rs:8:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs_CsCRATE_HASH_1cINtB<REF>_6SignedKsn98_E)
--> $DIR/const-generics-demangling.rs:16:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Signed<-152i16>>)
--> $DIR/const-generics-demangling.rs:16:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Signed<-152>>)
--> $DIR/const-generics-demangling.rs:16:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB<REF>_4BoolKb1_E)
--> $DIR/const-generics-demangling.rs:24:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Bool<true>>)
--> $DIR/const-generics-demangling.rs:24:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Bool<true>>)
--> $DIR/const-generics-demangling.rs:24:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB<REF>_4CharKc2202_E)
--> $DIR/const-generics-demangling.rs:32:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Char<'∂'>>)
--> $DIR/const-generics-demangling.rs:32:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Char<'∂'>>)
--> $DIR/const-generics-demangling.rs:32:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors

View File

@ -0,0 +1,74 @@
error: symbol-name(_RNvMCsCRATE_HASH_1cINtB<REF>_8UnsignedKhb_E1f)
--> $DIR/const-generics-demangling.rs:13:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Unsigned<11u8>>::f)
--> $DIR/const-generics-demangling.rs:13:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Unsigned<11>>::f)
--> $DIR/const-generics-demangling.rs:13:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RNvMs_CsCRATE_HASH_1cINtB<REF>_6SignedKsn98_E1f)
--> $DIR/const-generics-demangling.rs:26:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Signed<-152i16>>::f)
--> $DIR/const-generics-demangling.rs:26:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Signed<-152>>::f)
--> $DIR/const-generics-demangling.rs:26:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RNvMs0_CsCRATE_HASH_1cINtB<REF>_4BoolKb1_E1f)
--> $DIR/const-generics-demangling.rs:39:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Bool<true>>::f)
--> $DIR/const-generics-demangling.rs:39:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Bool<true>>::f)
--> $DIR/const-generics-demangling.rs:39:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: symbol-name(_RNvMs1_CsCRATE_HASH_1cINtB<REF>_4CharKc2202_E1f)
--> $DIR/const-generics-demangling.rs:52:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(<c[HASH]::Char<'∂'>>::f)
--> $DIR/const-generics-demangling.rs:52:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling-alt(<c::Char<'∂'>>::f)
--> $DIR/const-generics-demangling.rs:52:5
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors