diff options
Diffstat (limited to 'tests/ui/symbol-names')
33 files changed, 2543 insertions, 0 deletions
diff --git a/tests/ui/symbol-names/basic.legacy.stderr b/tests/ui/symbol-names/basic.legacy.stderr new file mode 100644 index 000000000..3ad4ed24c --- /dev/null +++ b/tests/ui/symbol-names/basic.legacy.stderr @@ -0,0 +1,26 @@ +error: symbol-name(_ZN5basic4main17hcbad207c0eeb0b3bE) + --> $DIR/basic.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(basic::main::hcbad207c0eeb0b3b) + --> $DIR/basic.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(basic::main) + --> $DIR/basic.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(main) + --> $DIR/basic.rs:15:1 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/symbol-names/basic.rs b/tests/ui/symbol-names/basic.rs new file mode 100644 index 000000000..65a632628 --- /dev/null +++ b/tests/ui/symbol-names/basic.rs @@ -0,0 +1,19 @@ +// build-fail +// revisions: legacy v0 +//[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy + //[v0]compile-flags: -C symbol-mangling-version=v0 + +#![feature(rustc_attrs)] + +#[rustc_symbol_name] +//[legacy]~^ ERROR symbol-name(_ZN5basic4main +//[legacy]~| ERROR demangling(basic::main +//[legacy]~| ERROR demangling-alt(basic::main) + //[v0]~^^^^ ERROR symbol-name(_RNv + //[v0]~| ERROR demangling(basic[ + //[v0]~| ERROR demangling-alt(basic::main) +#[rustc_def_path] +//[legacy]~^ ERROR def-path(main) + //[v0]~^^ ERROR def-path(main) +fn main() { +} diff --git a/tests/ui/symbol-names/basic.v0.stderr b/tests/ui/symbol-names/basic.v0.stderr new file mode 100644 index 000000000..1f0278136 --- /dev/null +++ b/tests/ui/symbol-names/basic.v0.stderr @@ -0,0 +1,26 @@ +error: symbol-name(_RNvCsCRATE_HASH_5basic4main) + --> $DIR/basic.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(basic[b751b4a00e2291d9]::main) + --> $DIR/basic.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(basic::main) + --> $DIR/basic.rs:8:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(main) + --> $DIR/basic.rs:15:1 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/symbol-names/const-generics-demangling.legacy.stderr b/tests/ui/symbol-names/const-generics-demangling.legacy.stderr new file mode 100644 index 000000000..bebbb7aac --- /dev/null +++ b/tests/ui/symbol-names/const-generics-demangling.legacy.stderr @@ -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 + diff --git a/tests/ui/symbol-names/const-generics-demangling.rs b/tests/ui/symbol-names/const-generics-demangling.rs new file mode 100644 index 000000000..4a04eca67 --- /dev/null +++ b/tests/ui/symbol-names/const-generics-demangling.rs @@ -0,0 +1,62 @@ +// build-fail +// 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>; + +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>; + +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>; + +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>; + +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() {} diff --git a/tests/ui/symbol-names/const-generics-demangling.v0.stderr b/tests/ui/symbol-names/const-generics-demangling.v0.stderr new file mode 100644 index 000000000..7238a8493 --- /dev/null +++ b/tests/ui/symbol-names/const-generics-demangling.v0.stderr @@ -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 + diff --git a/tests/ui/symbol-names/const-generics-str-demangling.rs b/tests/ui/symbol-names/const-generics-str-demangling.rs new file mode 100644 index 000000000..619b34f25 --- /dev/null +++ b/tests/ui/symbol-names/const-generics-str-demangling.rs @@ -0,0 +1,45 @@ +// build-fail +// compile-flags: -C symbol-mangling-version=v0 --crate-name=c +// normalize-stderr-test: "c\[.*?\]" -> "c[HASH]" +#![feature(adt_const_params, rustc_attrs)] +#![allow(incomplete_features)] + +pub struct Str<const S: &'static str>; + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Str<"abc">>) +impl Str<"abc"> {} + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Str<"'">>) +impl Str<"'"> {} + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Str<"\t\n">>) +impl Str<"\t\n"> {} + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Str<"∂ü">>) +impl Str<"∂ü"> {} + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Str<"საჭმელად_გემრიელი_სადილი">>) +impl Str<"საჭმელად_გემრიელი_სადილი"> {} + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜">>) +impl Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜"> {} + +fn main() {} diff --git a/tests/ui/symbol-names/const-generics-str-demangling.stderr b/tests/ui/symbol-names/const-generics-str-demangling.stderr new file mode 100644 index 000000000..06d3cdda2 --- /dev/null +++ b/tests/ui/symbol-names/const-generics-str-demangling.stderr @@ -0,0 +1,110 @@ +error: symbol-name(_RMCsCRATE_HASH_1cINtB<REF>_3StrKRe616263_E) + --> $DIR/const-generics-str-demangling.rs:9:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Str<"abc">>) + --> $DIR/const-generics-str-demangling.rs:9:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Str<"abc">>) + --> $DIR/const-generics-str-demangling.rs:9:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs_CsCRATE_HASH_1cINtB<REF>_3StrKRe27_E) + --> $DIR/const-generics-str-demangling.rs:15:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Str<"'">>) + --> $DIR/const-generics-str-demangling.rs:15:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Str<"'">>) + --> $DIR/const-generics-str-demangling.rs:15:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB<REF>_3StrKRe090a_E) + --> $DIR/const-generics-str-demangling.rs:21:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Str<"\t\n">>) + --> $DIR/const-generics-str-demangling.rs:21:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Str<"\t\n">>) + --> $DIR/const-generics-str-demangling.rs:21:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB<REF>_3StrKRee28882c3bc_E) + --> $DIR/const-generics-str-demangling.rs:27:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Str<"∂ü">>) + --> $DIR/const-generics-str-demangling.rs:27:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Str<"∂ü">>) + --> $DIR/const-generics-str-demangling.rs:27:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs2_CsCRATE_HASH_1cINtB<REF>_3StrKRee183a1e18390e183ade1839be18394e1839ae18390e183935fe18392e18394e1839be183a0e18398e18394e1839ae183985fe183a1e18390e18393e18398e1839ae18398_E) + --> $DIR/const-generics-str-demangling.rs:33:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Str<"საჭმელად_გემრიელი_სადილი">>) + --> $DIR/const-generics-str-demangling.rs:33:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Str<"საჭმელად_გემრიელი_სადილი">>) + --> $DIR/const-generics-str-demangling.rs:33:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs3_CsCRATE_HASH_1cINtB<REF>_3StrKRef09f908af09fa688f09fa686f09f90ae20c2a720f09f90b6f09f9192e29895f09f94a520c2a720f09fa7a1f09f929bf09f929af09f9299f09f929c_E) + --> $DIR/const-generics-str-demangling.rs:39:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜">>) + --> $DIR/const-generics-str-demangling.rs:39:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Str<"🐊🦈🦆🐮 § 🐶👒☕🔥 § 🧡💛💚💙💜">>) + --> $DIR/const-generics-str-demangling.rs:39:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 18 previous errors + diff --git a/tests/ui/symbol-names/const-generics-structural-demangling.rs b/tests/ui/symbol-names/const-generics-structural-demangling.rs new file mode 100644 index 000000000..df09ba494 --- /dev/null +++ b/tests/ui/symbol-names/const-generics-structural-demangling.rs @@ -0,0 +1,96 @@ +// build-fail +// compile-flags: -C symbol-mangling-version=v0 --crate-name=c + +// NOTE(eddyb) we need `core` for `core::option::Option`, normalize away its +// disambiguator hash, which can/should change (including between stage{1,2}). +// normalize-stderr-test: "core\[[0-9a-f]+\]" -> "core[HASH]" +// normalize-stderr-test: "c\[[0-9a-f]+\]" -> "c[HASH]" + +#![feature(adt_const_params, decl_macro, rustc_attrs)] +#![allow(incomplete_features)] + +pub struct RefByte<const RB: &'static u8>; + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::RefByte<{&123}>>) +impl RefByte<{&123}> {} + +// FIXME(eddyb) this was supposed to be `RefMutZst` with `&mut []`, +// but that is currently not allowed in const generics. +pub struct RefZst<const RMZ: &'static [u8; 0]>; + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::RefZst<{&[]}>>) +impl RefZst<{&[]}> {} + +pub struct Array3Bytes<const A3B: [u8; 3]>; + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Array3Bytes<{[1, 2, 3]}>>) +impl Array3Bytes<{[1, 2, 3]}> {} + +pub struct TupleByteBool<const TBB: (u8, bool)>; + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::TupleByteBool<{(1, false)}>>) +impl TupleByteBool<{(1, false)}> {} + +pub struct OptionUsize<const OU: Option<usize>>; + +// HACK(eddyb) the full mangling is only in `.stderr` because we can normalize +// the `core` disambiguator hash away there, but not here. +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::None}>>) +impl OptionUsize<{None}> {} + +// HACK(eddyb) the full mangling is only in `.stderr` because we can normalize +// the `core` disambiguator hash away there, but not here. +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::Some(0)}>>) +impl OptionUsize<{Some(0)}> {} + +#[derive(PartialEq, Eq)] +pub struct Foo { + s: &'static str, + ch: char, + slice: &'static [u8], +} +pub struct Foo_<const F: Foo>; + +#[rustc_symbol_name] +//~^ ERROR symbol-name +//~| ERROR demangling +//~| ERROR demangling-alt(<c::Foo_<{c::Foo { s: "abc", ch: 'x', slice: &[1, 2, 3] }}>>) +impl Foo_<{Foo { s: "abc", ch: 'x', slice: &[1, 2, 3] }}> {} + +// NOTE(eddyb) this tests specifically the use of disambiguators in field names, +// using macros 2.0 hygiene to create a `struct` with conflicting field names. +macro duplicate_field_name_test($x:ident) { + #[derive(PartialEq, Eq)] + pub struct Bar { + $x: u8, + x: u16, + } + pub struct Bar_<const B: Bar>; + + #[rustc_symbol_name] + //~^ ERROR symbol-name + //~| ERROR demangling + //~| ERROR demangling-alt(<c::Bar_<{c::Bar { x: 123, x: 4096 }}>>) + impl Bar_<{Bar { $x: 123, x: 4096 }}> {} +} +duplicate_field_name_test!(x); + +fn main() {} diff --git a/tests/ui/symbol-names/const-generics-structural-demangling.stderr b/tests/ui/symbol-names/const-generics-structural-demangling.stderr new file mode 100644 index 000000000..a4c997477 --- /dev/null +++ b/tests/ui/symbol-names/const-generics-structural-demangling.stderr @@ -0,0 +1,161 @@ +error: symbol-name(_RMCsCRATE_HASH_1cINtB<REF>_7RefByteKRh7b_E) + --> $DIR/const-generics-structural-demangling.rs:14:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::RefByte<{&123u8}>>) + --> $DIR/const-generics-structural-demangling.rs:14:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::RefByte<{&123}>>) + --> $DIR/const-generics-structural-demangling.rs:14:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs_CsCRATE_HASH_1cINtB<REF>_6RefZstKRAEE) + --> $DIR/const-generics-structural-demangling.rs:24:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::RefZst<{&[]}>>) + --> $DIR/const-generics-structural-demangling.rs:24:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::RefZst<{&[]}>>) + --> $DIR/const-generics-structural-demangling.rs:24:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs0_CsCRATE_HASH_1cINtB<REF>_11Array3BytesKAh1_h2_h3_EE) + --> $DIR/const-generics-structural-demangling.rs:32:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Array3Bytes<{[1u8, 2u8, 3u8]}>>) + --> $DIR/const-generics-structural-demangling.rs:32:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Array3Bytes<{[1, 2, 3]}>>) + --> $DIR/const-generics-structural-demangling.rs:32:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs1_CsCRATE_HASH_1cINtB<REF>_13TupleByteBoolKTh1_b0_EE) + --> $DIR/const-generics-structural-demangling.rs:40:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::TupleByteBool<{(1u8, false)}>>) + --> $DIR/const-generics-structural-demangling.rs:40:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::TupleByteBool<{(1, false)}>>) + --> $DIR/const-generics-structural-demangling.rs:40:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs2_CsCRATE_HASH_1cINtB<REF>_11OptionUsizeKVNtINtNtCsCRATE_HASH_4core6option6OptionjE4NoneUE) + --> $DIR/const-generics-structural-demangling.rs:50:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::OptionUsize<{core[HASH]::option::Option::<usize>::None}>>) + --> $DIR/const-generics-structural-demangling.rs:50:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::None}>>) + --> $DIR/const-generics-structural-demangling.rs:50:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs3_CsCRATE_HASH_1cINtB<REF>_11OptionUsizeKVNtINtNtCsCRATE_HASH_4core6option6OptionjE4SomeTj0_EE) + --> $DIR/const-generics-structural-demangling.rs:58:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::OptionUsize<{core[HASH]::option::Option::<usize>::Some(0usize)}>>) + --> $DIR/const-generics-structural-demangling.rs:58:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::OptionUsize<{core::option::Option::<usize>::Some(0)}>>) + --> $DIR/const-generics-structural-demangling.rs:58:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs4_CsCRATE_HASH_1cINtB<REF>_4Foo_KVNtB<REF>_3FooS1sRe616263_2chc78_5sliceRAh1_h2_h3_EEE) + --> $DIR/const-generics-structural-demangling.rs:72:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<c[HASH]::Foo_<{c[HASH]::Foo { s: "abc", ch: 'x', slice: &[1u8, 2u8, 3u8] }}>>) + --> $DIR/const-generics-structural-demangling.rs:72:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<c::Foo_<{c::Foo { s: "abc", ch: 'x', slice: &[1, 2, 3] }}>>) + --> $DIR/const-generics-structural-demangling.rs:72:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RMs9_CsCRATE_HASH_1cINtB<REF>_4Bar_KVNtB<REF>_3BarS1xh7b_s_1xt1000_EE) + --> $DIR/const-generics-structural-demangling.rs:88:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ +... +LL | duplicate_field_name_test!(x); + | ----------------------------- in this macro invocation + | + = note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: demangling(<c[HASH]::Bar_<{c[HASH]::Bar { x: 123u8, x: 4096u16 }}>>) + --> $DIR/const-generics-structural-demangling.rs:88:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ +... +LL | duplicate_field_name_test!(x); + | ----------------------------- in this macro invocation + | + = note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: demangling-alt(<c::Bar_<{c::Bar { x: 123, x: 4096 }}>>) + --> $DIR/const-generics-structural-demangling.rs:88:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ +... +LL | duplicate_field_name_test!(x); + | ----------------------------- in this macro invocation + | + = note: this error originates in the macro `duplicate_field_name_test` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 24 previous errors + diff --git a/tests/ui/symbol-names/const-generics.rs b/tests/ui/symbol-names/const-generics.rs new file mode 100644 index 000000000..1242126e0 --- /dev/null +++ b/tests/ui/symbol-names/const-generics.rs @@ -0,0 +1,85 @@ +// check-pass +// revisions: legacy v0 +//[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy --crate-type=lib +//[v0]compile-flags: -C symbol-mangling-version=v0 --crate-type=lib + +// `char` +pub struct Char<const F: char>; + +impl Char<'A'> { + pub fn foo() {} +} + +impl<const F: char> Char<F> { + pub fn bar() {} +} + +// `i8` +pub struct I8<const F: i8>; + +impl I8<{i8::MIN}> { + pub fn foo() {} +} + +impl I8<{i8::MAX}> { + pub fn foo() {} +} + +impl<const F: i8> I8<F> { + pub fn bar() {} +} + +// `i16` +pub struct I16<const F: i16>; + +impl I16<{i16::MIN}> { + pub fn foo() {} +} + +impl<const F: i16> I16<F> { + pub fn bar() {} +} + +// `i32` +pub struct I32<const F: i32>; + +impl I32<{i32::MIN}> { + pub fn foo() {} +} + +impl<const F: i32> I32<F> { + pub fn bar() {} +} + +// `i64` +pub struct I64<const F: i64>; + +impl I64<{i64::MIN}> { + pub fn foo() {} +} + +impl<const F: i64> I64<F> { + pub fn bar() {} +} + +// `i128` +pub struct I128<const F: i128>; + +impl I128<{i128::MIN}> { + pub fn foo() {} +} + +impl<const F: i128> I128<F> { + pub fn bar() {} +} + +// `isize` +pub struct ISize<const F: isize>; + +impl ISize<3> { + pub fn foo() {} +} + +impl<const F: isize> ISize<F> { + pub fn bar() {} +} diff --git a/tests/ui/symbol-names/foreign-types.rs b/tests/ui/symbol-names/foreign-types.rs new file mode 100644 index 000000000..8f5b07769 --- /dev/null +++ b/tests/ui/symbol-names/foreign-types.rs @@ -0,0 +1,19 @@ +// build-fail +// compile-flags: -C symbol-mangling-version=v0 + +#![feature(extern_types)] +#![feature(rustc_attrs)] + +extern "C" { + type ForeignType; +} + +struct Check<T: ?Sized>(T); + +#[rustc_symbol_name] +//~^ ERROR symbol-name(_RMCs +//~| ERROR demangling(<foreign_types[ +//~| ERROR demangling-alt(<foreign_types::Check<foreign_types::ForeignType>>) +impl Check<ForeignType> {} + +fn main() {} diff --git a/tests/ui/symbol-names/foreign-types.stderr b/tests/ui/symbol-names/foreign-types.stderr new file mode 100644 index 000000000..d6ee388dd --- /dev/null +++ b/tests/ui/symbol-names/foreign-types.stderr @@ -0,0 +1,20 @@ +error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNvB<REF>_11ForeignTypeE) + --> $DIR/foreign-types.rs:13:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<foreign_types[49eeeb51f120b431]::Check<foreign_types[49eeeb51f120b431]::ForeignType>>) + --> $DIR/foreign-types.rs:13:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<foreign_types::Check<foreign_types::ForeignType>>) + --> $DIR/foreign-types.rs:13:1 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/symbol-names/impl1.legacy.stderr b/tests/ui/symbol-names/impl1.legacy.stderr new file mode 100644 index 000000000..3d438df92 --- /dev/null +++ b/tests/ui/symbol-names/impl1.legacy.stderr @@ -0,0 +1,74 @@ +error: symbol-name(_ZN5impl13foo3Foo3bar17<SYMBOL_HASH>) + --> $DIR/impl1.rs:14:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(impl1::foo::Foo::bar::<SYMBOL_HASH>) + --> $DIR/impl1.rs:14:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(impl1::foo::Foo::bar) + --> $DIR/impl1.rs:14:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(foo::Foo::bar) + --> $DIR/impl1.rs:21:9 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17<SYMBOL_HASH>) + --> $DIR/impl1.rs:32:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(impl1::bar::<impl impl1::foo::Foo>::baz::<SYMBOL_HASH>) + --> $DIR/impl1.rs:32:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(impl1::bar::<impl impl1::foo::Foo>::baz) + --> $DIR/impl1.rs:32:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(bar::<impl foo::Foo>::baz) + --> $DIR/impl1.rs:39:9 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN209_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$C$$u20$...$RP$$u2b$impl1..AutoTrait$u3b$$u20$3$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method17<SYMBOL_HASH>) + --> $DIR/impl1.rs:62:13 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; 3] as impl1::main::{{closure}}::Bar>::method::<SYMBOL_HASH>) + --> $DIR/impl1.rs:62:13 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; 3] as impl1::main::{{closure}}::Bar>::method) + --> $DIR/impl1.rs:62:13 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(<[&dyn Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method) + --> $DIR/impl1.rs:69:13 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + diff --git a/tests/ui/symbol-names/impl1.rs b/tests/ui/symbol-names/impl1.rs new file mode 100644 index 000000000..629c2f33d --- /dev/null +++ b/tests/ui/symbol-names/impl1.rs @@ -0,0 +1,75 @@ +// build-fail +// revisions: legacy v0 +//[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy + //[v0]compile-flags: -C symbol-mangling-version=v0 +//[legacy]normalize-stderr-test: "h[\w]{16}E?\)" -> "<SYMBOL_HASH>)" + +#![feature(auto_traits, rustc_attrs)] +#![allow(dead_code)] + +mod foo { + pub struct Foo { x: u32 } + + impl Foo { + #[rustc_symbol_name] + //[legacy]~^ ERROR symbol-name(_ZN5impl13foo3Foo3bar + //[legacy]~| ERROR demangling(impl1::foo::Foo::bar + //[legacy]~| ERROR demangling-alt(impl1::foo::Foo::bar) + //[v0]~^^^^ ERROR symbol-name(_RNvMNtCs + //[v0]~| ERROR demangling(<impl1[ + //[v0]~| ERROR demangling-alt(<impl1::foo::Foo>::bar) + #[rustc_def_path] + //[legacy]~^ ERROR def-path(foo::Foo::bar) + //[v0]~^^ ERROR def-path(foo::Foo::bar) + fn bar() { } + } +} + +mod bar { + use foo::Foo; + + impl Foo { + #[rustc_symbol_name] + //[legacy]~^ ERROR symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz + //[legacy]~| ERROR demangling(impl1::bar::<impl impl1::foo::Foo>::baz + //[legacy]~| ERROR demangling-alt(impl1::bar::<impl impl1::foo::Foo>::baz) + //[v0]~^^^^ ERROR symbol-name(_RNvMNtCs + //[v0]~| ERROR demangling(<impl1[ + //[v0]~| ERROR demangling-alt(<impl1::foo::Foo>::baz) + #[rustc_def_path] + //[legacy]~^ ERROR def-path(bar::<impl foo::Foo>::baz) + //[v0]~^^ ERROR def-path(bar::<impl foo::Foo>::baz) + fn baz() { } + } +} + +trait Foo { + type Assoc; +} + +auto trait AutoTrait {} + +fn main() { + // Test closure mangling, and disambiguators. + || {}; + || { + trait Bar { + fn method(&self) {} + } + + // Test type mangling, by putting them in an `impl` header. + impl Bar for [&'_ (dyn Foo<Assoc = extern "C" fn(&u8, ...)> + AutoTrait); 3] { + #[rustc_symbol_name] + //[legacy]~^ ERROR symbol-name(_ZN209_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$C$$u20$...$RP$$u2b$impl1..AutoTrait$u3b$$u20$3$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method + //[legacy]~| ERROR demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; 3] as impl1::main::{{closure}}::Bar>::method + //[legacy]~| ERROR demangling-alt(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8, ::.)+impl1::AutoTrait; 3] as impl1::main::{{closure}}::Bar>::method) + //[v0]~^^^^ ERROR symbol-name(_RNvXNCNvCs + //[v0]~| ERROR demangling(<[&dyn + //[v0]~| ERROR demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method) + #[rustc_def_path] + //[legacy]~^ ERROR def-path(<[&dyn Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method) + //[v0]~^^ ERROR def-path(<[&dyn Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method) + fn method(&self) {} + } + }; +} diff --git a/tests/ui/symbol-names/impl1.v0.stderr b/tests/ui/symbol-names/impl1.v0.stderr new file mode 100644 index 000000000..33caad71f --- /dev/null +++ b/tests/ui/symbol-names/impl1.v0.stderr @@ -0,0 +1,74 @@ +error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13fooNtB<REF>_3Foo3bar) + --> $DIR/impl1.rs:14:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<impl1[2c09c4f1c7c8e90c]::foo::Foo>::bar) + --> $DIR/impl1.rs:14:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<impl1::foo::Foo>::bar) + --> $DIR/impl1.rs:14:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(foo::Foo::bar) + --> $DIR/impl1.rs:21:9 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RNvMNtCsCRATE_HASH_5impl13barNtNtB<REF>_3foo3Foo3baz) + --> $DIR/impl1.rs:32:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<impl1[2c09c4f1c7c8e90c]::foo::Foo>::baz) + --> $DIR/impl1.rs:32:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<impl1::foo::Foo>::baz) + --> $DIR/impl1.rs:32:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(bar::<impl foo::Foo>::baz) + --> $DIR/impl1.rs:39:9 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RNvXNCNvCsCRATE_HASH_5impl14mains_0ARDNtB<REF>_3Foop5AssocFG_KCRL0_hvEuNtB<REF>_9AutoTraitEL_j3_NtB<REF>_3Bar6method) + --> $DIR/impl1.rs:62:13 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<[&dyn impl1[2c09c4f1c7c8e90c]::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + impl1[2c09c4f1c7c8e90c]::AutoTrait; 3usize] as impl1[2c09c4f1c7c8e90c]::main::{closure#1}::Bar>::method) + --> $DIR/impl1.rs:62:13 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method) + --> $DIR/impl1.rs:62:13 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: def-path(<[&dyn Foo<Assoc = for<'a> extern "C" fn(&'a u8, ...)> + AutoTrait; 3] as main::{closure#1}::Bar>::method) + --> $DIR/impl1.rs:69:13 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + diff --git a/tests/ui/symbol-names/impl2.rs b/tests/ui/symbol-names/impl2.rs new file mode 100644 index 000000000..81aba403d --- /dev/null +++ b/tests/ui/symbol-names/impl2.rs @@ -0,0 +1,15 @@ +// build-fail + +#![feature(rustc_attrs)] +#![allow(dead_code)] + +trait Foo { + fn baz(); +} + +impl Foo for [u8; 1 + 2] { + #[rustc_def_path] //~ ERROR def-path(<[u8; 1 + 2] as Foo>::baz) + fn baz() {} +} + +fn main() {} diff --git a/tests/ui/symbol-names/impl2.stderr b/tests/ui/symbol-names/impl2.stderr new file mode 100644 index 000000000..0c3205e01 --- /dev/null +++ b/tests/ui/symbol-names/impl2.stderr @@ -0,0 +1,8 @@ +error: def-path(<[u8; 1 + 2] as Foo>::baz) + --> $DIR/impl2.rs:11:5 + | +LL | #[rustc_def_path] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/symbol-names/issue-53912.rs b/tests/ui/symbol-names/issue-53912.rs new file mode 100644 index 000000000..65b6825a8 --- /dev/null +++ b/tests/ui/symbol-names/issue-53912.rs @@ -0,0 +1,37 @@ +// build-pass + +// This test is the same code as in ui/symbol-names/issue-60925.rs but this checks that the +// reproduction compiles successfully and doesn't segfault, whereas that test just checks that the +// symbol mangling fix produces the correct result. + +fn dummy() {} + +mod llvm { + pub(crate) struct Foo; +} +mod foo { + pub(crate) struct Foo<T>(T); + + impl Foo<::llvm::Foo> { + pub(crate) fn foo() { + for _ in 0..0 { + for _ in &[::dummy()] { + ::dummy(); + ::dummy(); + ::dummy(); + } + } + } + } + + pub(crate) fn foo() { + Foo::foo(); + Foo::foo(); + } +} + +pub fn foo() { + foo::foo(); +} + +fn main() {} diff --git a/tests/ui/symbol-names/issue-60925.legacy.stderr b/tests/ui/symbol-names/issue-60925.legacy.stderr new file mode 100644 index 000000000..21bf21ee7 --- /dev/null +++ b/tests/ui/symbol-names/issue-60925.legacy.stderr @@ -0,0 +1,20 @@ +error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h2f2efcf580c9b1eeE) + --> $DIR/issue-60925.rs:21:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h2f2efcf580c9b1ee) + --> $DIR/issue-60925.rs:21:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo) + --> $DIR/issue-60925.rs:21:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/symbol-names/issue-60925.rs b/tests/ui/symbol-names/issue-60925.rs new file mode 100644 index 000000000..ab0a3a7df --- /dev/null +++ b/tests/ui/symbol-names/issue-60925.rs @@ -0,0 +1,49 @@ +// build-fail +// revisions: legacy v0 +//[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy + //[v0]compile-flags: -C symbol-mangling-version=v0 + +#![feature(rustc_attrs)] + +// This test is the same code as in ui/issue-53912.rs but this test checks that the symbol mangling +// fix produces the correct result, whereas that test just checks that the reproduction compiles +// successfully and doesn't crash LLVM + +fn dummy() {} + +mod llvm { + pub(crate) struct Foo; +} +mod foo { + pub(crate) struct Foo<T>(T); + + impl Foo<::llvm::Foo> { + #[rustc_symbol_name] + //[legacy]~^ ERROR symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo + //[legacy]~| ERROR demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo + //[legacy]~| ERROR demangling-alt(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo) + //[v0]~^^^^ ERROR symbol-name + //[v0]~| ERROR demangling + //[v0]~| ERROR demangling-alt(<issue_60925::foo::Foo<issue_60925::llvm::Foo>>::foo) + pub(crate) fn foo() { + for _ in 0..0 { + for _ in &[::dummy()] { + ::dummy(); + ::dummy(); + ::dummy(); + } + } + } + } + + pub(crate) fn foo() { + Foo::foo(); + Foo::foo(); + } +} + +pub fn foo() { + foo::foo(); +} + +fn main() {} diff --git a/tests/ui/symbol-names/issue-60925.v0.stderr b/tests/ui/symbol-names/issue-60925.v0.stderr new file mode 100644 index 000000000..408c957c6 --- /dev/null +++ b/tests/ui/symbol-names/issue-60925.v0.stderr @@ -0,0 +1,20 @@ +error: symbol-name(_RNvMNtCsCRATE_HASH_11issue_609253fooINtB<REF>_3FooNtNtB<REF>_4llvm3FooE3foo) + --> $DIR/issue-60925.rs:21:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<issue_60925[775bc577f14ef671]::foo::Foo<issue_60925[775bc577f14ef671]::llvm::Foo>>::foo) + --> $DIR/issue-60925.rs:21:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<issue_60925::foo::Foo<issue_60925::llvm::Foo>>::foo) + --> $DIR/issue-60925.rs:21:9 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/symbol-names/issue-75326.legacy.stderr b/tests/ui/symbol-names/issue-75326.legacy.stderr new file mode 100644 index 000000000..aadc0cf43 --- /dev/null +++ b/tests/ui/symbol-names/issue-75326.legacy.stderr @@ -0,0 +1,20 @@ +error: symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next17SYMBOL_HASH) + --> $DIR/issue-75326.rs:41:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next::SYMBOL_HASH) + --> $DIR/issue-75326.rs:41:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next) + --> $DIR/issue-75326.rs:41:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/symbol-names/issue-75326.rs b/tests/ui/symbol-names/issue-75326.rs new file mode 100644 index 000000000..4a1f5a212 --- /dev/null +++ b/tests/ui/symbol-names/issue-75326.rs @@ -0,0 +1,56 @@ +// build-fail +// revisions: legacy v0 +//[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy +//[v0]compile-flags: -C symbol-mangling-version=v0 +//[legacy]normalize-stderr-test: "h[\w{16}]+" -> "SYMBOL_HASH" + +#![feature(rustc_attrs)] + +pub(crate) struct Foo<I, E>(I, E); + +pub trait Iterator2 { + type Item; + + fn next(&mut self) -> Option<Self::Item>; + + fn find<P>(&mut self, predicate: P) -> Option<Self::Item> + where + Self: Sized, + P: FnMut(&Self::Item) -> bool, + { + unimplemented!() + } +} + +struct Bar; + +impl Iterator2 for Bar { + type Item = (u32, u16); + + fn next(&mut self) -> Option<Self::Item> { + unimplemented!() + } +} + +impl<I, T, E> Iterator2 for Foo<I, E> +where + I: Iterator2<Item = (T, E)>, +{ + type Item = T; + + #[rustc_symbol_name] + //[legacy]~^ ERROR symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next + //[legacy]~| ERROR demangling(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next + //[legacy]~| ERROR demangling-alt(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next) + //[v0]~^^^^ ERROR symbol-name + //[v0]~| ERROR demangling + //[v0]~| ERROR demangling-alt(<issue_75326::Foo<_, _> as issue_75326::Iterator2>::next) + fn next(&mut self) -> Option<Self::Item> { + self.find(|_| true) + } +} + +fn main() { + let mut a = Foo(Bar, 1u16); + let _ = a.next(); +} diff --git a/tests/ui/symbol-names/issue-75326.v0.stderr b/tests/ui/symbol-names/issue-75326.v0.stderr new file mode 100644 index 000000000..3d7803a0c --- /dev/null +++ b/tests/ui/symbol-names/issue-75326.v0.stderr @@ -0,0 +1,20 @@ +error: symbol-name(_RNvXINICsCRATE_HASH_11issue_75326s_0pppEINtB<REF>_3FooppENtB<REF>_9Iterator24nextB<REF>_) + --> $DIR/issue-75326.rs:41:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<issue_75326[e8e253d78520f2a2]::Foo<_, _> as issue_75326[e8e253d78520f2a2]::Iterator2>::next) + --> $DIR/issue-75326.rs:41:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<issue_75326::Foo<_, _> as issue_75326::Iterator2>::next) + --> $DIR/issue-75326.rs:41:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/symbol-names/issue-76365.rs b/tests/ui/symbol-names/issue-76365.rs new file mode 100644 index 000000000..932057b65 --- /dev/null +++ b/tests/ui/symbol-names/issue-76365.rs @@ -0,0 +1,17 @@ +// check-pass +// revisions: legacy v0 +//[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy --crate-type=lib +//[v0]compile-flags: -C symbol-mangling-version=v0 --crate-type=lib + + +pub struct Bar<const F: bool>; + +impl Bar<true> { + pub fn foo() {} +} + +impl<const F: bool> Bar<F> { + pub fn bar() {} +} + +fn main() {} diff --git a/tests/ui/symbol-names/trait-objects.rs b/tests/ui/symbol-names/trait-objects.rs new file mode 100644 index 000000000..5bcbc0841 --- /dev/null +++ b/tests/ui/symbol-names/trait-objects.rs @@ -0,0 +1,47 @@ +// Ensure that trait objects don't include more than one binder. See #83611 + +// build-fail +// revisions: v0 +//[v0]compile-flags: -C symbol-mangling-version=v0 +//[v0]normalize-stderr-test: "core\[.*?\]" -> "core[HASH]" + +#![feature(rustc_attrs)] + +trait Bar { + fn method(&self) {} +} + +impl Bar for &dyn FnMut(&u8) { + #[rustc_symbol_name] + //[v0]~^ ERROR symbol-name + //[v0]~| ERROR demangling + //[v0]~| ERROR demangling-alt + fn method(&self) {} +} + +trait Foo { + fn method(&self) {} +} + +impl Foo for &(dyn FnMut(&u8) + for<'b> Send) { + #[rustc_symbol_name] + //[v0]~^ ERROR symbol-name + //[v0]~| ERROR demangling + //[v0]~| ERROR demangling-alt + fn method(&self) {} +} + +trait Baz { + fn method(&self) {} +} + +impl Baz for &(dyn for<'b> Send + FnMut(&u8)) { + #[rustc_symbol_name] + //[v0]~^ ERROR symbol-name + //[v0]~| ERROR demangling + //[v0]~| ERROR demangling-alt + fn method(&self) {} +} + +fn main() { +} diff --git a/tests/ui/symbol-names/trait-objects.v0.stderr b/tests/ui/symbol-names/trait-objects.v0.stderr new file mode 100644 index 000000000..47192ce5b --- /dev/null +++ b/tests/ui/symbol-names/trait-objects.v0.stderr @@ -0,0 +1,56 @@ +error: symbol-name(_RNvXCsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuEL_NtB<REF>_3Bar6method) + --> $DIR/trait-objects.rs:15:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects[7260a56bea9f357b]::Bar>::method) + --> $DIR/trait-objects.rs:15:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects::Bar>::method) + --> $DIR/trait-objects.rs:15:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RNvXs_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtB<REF>_6marker4SendEL_NtB<REF>_3Foo6method) + --> $DIR/trait-objects.rs:27:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[7260a56bea9f357b]::Foo>::method) + --> $DIR/trait-objects.rs:27:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> + core::marker::Send as trait_objects::Foo>::method) + --> $DIR/trait-objects.rs:27:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_RNvXs0_CsCRATE_HASH_13trait_objectsRDG_INtNtNtCsCRATE_HASH_4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtB<REF>_6marker4SendEL_NtB<REF>_3Baz6method) + --> $DIR/trait-objects.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[7260a56bea9f357b]::Baz>::method) + --> $DIR/trait-objects.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> + core::marker::Send as trait_objects::Baz>::method) + --> $DIR/trait-objects.rs:39:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors + diff --git a/tests/ui/symbol-names/types.legacy.stderr b/tests/ui/symbol-names/types.legacy.stderr new file mode 100644 index 000000000..a4984d562 --- /dev/null +++ b/tests/ui/symbol-names/types.legacy.stderr @@ -0,0 +1,470 @@ +error: symbol-name(_ZN1a1b16Type$LT$bool$GT$17h[HASH]E) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<bool>::h[HASH]) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<bool>) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<char>::h[HASH]) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<char>) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i8>::h[HASH]) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i8>) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i16>::h[HASH]) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i16>) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i32>::h[HASH]) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i32>) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i64>::h[HASH]) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i64>) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u8>::h[HASH]) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u8>) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u16>::h[HASH]) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u16>) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u32>::h[HASH]) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u32>) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u64>::h[HASH]) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u64>) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<f32>::h[HASH]) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<f32>) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<f64>::h[HASH]) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<f64>) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<str>::h[HASH]) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<str>) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<!>::h[HASH]) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<!>) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<()>::h[HASH]) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<()>) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,)>::h[HASH]) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,)>) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16)>::h[HASH]) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16)>) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16,u32)>) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*const u8>::h[HASH]) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*const u8>) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*mut u8>::h[HASH]) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*mut u8>) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$17h[HASH]E) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&str>::h[HASH]) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&str>) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$17h[HASH]E) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&mut str>::h[HASH]) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&mut str>) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[u8; 0]>::h[HASH]) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[u8; 0]>) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<fn()>::h[HASH]) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<fn()>) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<unsafe extern "C" fn()>::h[HASH]) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<unsafe extern "C" fn()>) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[T; N]>::h[HASH]) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[T; N]>) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 78 previous errors + diff --git a/tests/ui/symbol-names/types.rs b/tests/ui/symbol-names/types.rs new file mode 100644 index 000000000..0ae699c93 --- /dev/null +++ b/tests/ui/symbol-names/types.rs @@ -0,0 +1,170 @@ +// build-fail +// revisions: legacy verbose-legacy +// compile-flags: --crate-name=a -C symbol-mangling-version=legacy -Z unstable-options +//[verbose-legacy]compile-flags: -Zverbose +// normalize-stderr-test: "h[[:xdigit:]]{16}" -> "h[HASH]" + +#![feature(never_type)] +#![feature(rustc_attrs)] + +pub fn b() { + struct Type<T: ?Sized>(T); + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b16Type$LT$bool$GT$ + //~| ERROR demangling(a::b::Type<bool>:: + //~| ERROR demangling-alt(a::b::Type<bool>) + impl Type<bool> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b16Type$LT$char$GT$ + //~| ERROR demangling(a::b::Type<char>:: + //~| ERROR demangling-alt(a::b::Type<char>) + impl Type<char> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b14Type$LT$i8$GT$ + //~| ERROR demangling(a::b::Type<i8>:: + //~| ERROR demangling-alt(a::b::Type<i8>) + impl Type<i8> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$i16$GT$ + //~| ERROR demangling(a::b::Type<i16>:: + //~| ERROR demangling-alt(a::b::Type<i16>) + impl Type<i16> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$i32$GT$ + //~| ERROR demangling(a::b::Type<i32>:: + //~| ERROR demangling-alt(a::b::Type<i32>) + impl Type<i32> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$i64$GT$ + //~| ERROR demangling(a::b::Type<i64>:: + //~| ERROR demangling-alt(a::b::Type<i64>) + impl Type<i64> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b14Type$LT$u8$GT$ + //~| ERROR demangling(a::b::Type<u8>:: + //~| ERROR demangling-alt(a::b::Type<u8>) + impl Type<u8> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$u16$GT$ + //~| ERROR demangling(a::b::Type<u16>:: + //~| ERROR demangling-alt(a::b::Type<u16>) + impl Type<u16> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$u32$GT$ + //~| ERROR demangling(a::b::Type<u32>:: + //~| ERROR demangling-alt(a::b::Type<u32>) + impl Type<u32> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$u64$GT$ + //~| ERROR demangling(a::b::Type<u64>:: + //~| ERROR demangling-alt(a::b::Type<u64>) + impl Type<u64> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$f32$GT$ + //~| ERROR demangling(a::b::Type<f32>:: + //~| ERROR demangling-alt(a::b::Type<f32>) + impl Type<f32> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$f64$GT$ + //~| ERROR demangling(a::b::Type<f64>:: + //~| ERROR demangling-alt(a::b::Type<f64>) + impl Type<f64> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b15Type$LT$str$GT$ + //~| ERROR demangling(a::b::Type<str>:: + //~| ERROR demangling-alt(a::b::Type<str>) + impl Type<str> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b17Type$LT$$u21$$GT$ + //~| ERROR demangling(a::b::Type<!>:: + //~| ERROR demangling-alt(a::b::Type<!>) + impl Type<!> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT + //~| ERROR demangling(a::b::Type<()>:: + //~| ERROR demangling-alt(a::b::Type<()>) + impl Type<()> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$ + //~| ERROR demangling(a::b::Type<(u8,)>:: + //~| ERROR demangling-alt(a::b::Type<(u8,)>) + impl Type<(u8,)> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$ + //~| ERROR demangling(a::b::Type<(u8,u16)>:: + //~| ERROR demangling-alt(a::b::Type<(u8,u16)>) + impl Type<(u8,u16)> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$ + //~| ERROR demangling(a::b::Type<(u8,u16,u32)>:: + //~| ERROR demangling-alt(a::b::Type<(u8,u16,u32)>) + impl Type<(u8,u16,u32)> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$ + //~| ERROR demangling(a::b::Type<*const u8>:: + //~| ERROR demangling-alt(a::b::Type<*const u8>) + impl Type<*const u8> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$ + //~| ERROR demangling(a::b::Type<*mut u8>:: + //~| ERROR demangling-alt(a::b::Type<*mut u8>) + impl Type<*mut u8> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$ + //~| ERROR demangling(a::b::Type<&str>:: + //~| ERROR demangling-alt(a::b::Type<&str>) + impl Type<&str> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$ + //~| ERROR demangling(a::b::Type<&mut str>:: + //~| ERROR demangling-alt(a::b::Type<&mut str>) + impl Type<&mut str> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$ + //~| ERROR demangling(a::b::Type<[u8; 0]>:: + //~| ERROR demangling-alt(a::b::Type<[u8; 0]>) + impl Type<[u8; 0]> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$ + //~| ERROR demangling(a::b::Type<fn()>:: + //~| ERROR demangling-alt(a::b::Type<fn()>) + impl Type<fn()> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$ + //~| ERROR demangling(a::b::Type<unsafe extern "C" fn()>:: + //~| ERROR demangling-alt(a::b::Type<unsafe extern "C" fn()>) + impl Type<unsafe extern "C" fn()> {} + + #[rustc_symbol_name] + //~^ ERROR symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$ + //~| ERROR demangling(a::b::Type<[T; N]>:: + //~| ERROR demangling-alt(a::b::Type<[T; N]>) + impl<const N: usize, T> Type<[T; N]> {} +} + +fn main() {} diff --git a/tests/ui/symbol-names/types.verbose-legacy.stderr b/tests/ui/symbol-names/types.verbose-legacy.stderr new file mode 100644 index 000000000..a4984d562 --- /dev/null +++ b/tests/ui/symbol-names/types.verbose-legacy.stderr @@ -0,0 +1,470 @@ +error: symbol-name(_ZN1a1b16Type$LT$bool$GT$17h[HASH]E) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<bool>::h[HASH]) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<bool>) + --> $DIR/types.rs:13:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b16Type$LT$char$GT$17h[HASH]E) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<char>::h[HASH]) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<char>) + --> $DIR/types.rs:19:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$i8$GT$17h[HASH]E) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i8>::h[HASH]) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i8>) + --> $DIR/types.rs:25:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i16$GT$17h[HASH]E) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i16>::h[HASH]) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i16>) + --> $DIR/types.rs:31:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i32$GT$17h[HASH]E) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i32>::h[HASH]) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i32>) + --> $DIR/types.rs:37:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$i64$GT$17h[HASH]E) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<i64>::h[HASH]) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<i64>) + --> $DIR/types.rs:43:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b14Type$LT$u8$GT$17h[HASH]E) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u8>::h[HASH]) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u8>) + --> $DIR/types.rs:49:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u16$GT$17h[HASH]E) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u16>::h[HASH]) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u16>) + --> $DIR/types.rs:55:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u32$GT$17h[HASH]E) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u32>::h[HASH]) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u32>) + --> $DIR/types.rs:61:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$u64$GT$17h[HASH]E) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<u64>::h[HASH]) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<u64>) + --> $DIR/types.rs:67:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f32$GT$17h[HASH]E) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<f32>::h[HASH]) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<f32>) + --> $DIR/types.rs:73:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$f64$GT$17h[HASH]E) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<f64>::h[HASH]) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<f64>) + --> $DIR/types.rs:79:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b15Type$LT$str$GT$17h[HASH]E) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<str>::h[HASH]) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<str>) + --> $DIR/types.rs:85:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b17Type$LT$$u21$$GT$17h[HASH]E) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<!>::h[HASH]) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<!>) + --> $DIR/types.rs:91:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b20Type$LT$$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<()>::h[HASH]) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<()>) + --> $DIR/types.rs:97:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b25Type$LT$$LP$u8$C$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,)>::h[HASH]) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,)>) + --> $DIR/types.rs:103:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$LP$u8$C$u16$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16)>::h[HASH]) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16)>) + --> $DIR/types.rs:109:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$LP$u8$C$u16$C$u32$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<(u8,u16,u32)>::h[HASH]) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<(u8,u16,u32)>) + --> $DIR/types.rs:115:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b28Type$LT$$BP$const$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*const u8>::h[HASH]) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*const u8>) + --> $DIR/types.rs:121:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b26Type$LT$$BP$mut$u20$u8$GT$17h[HASH]E) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<*mut u8>::h[HASH]) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<*mut u8>) + --> $DIR/types.rs:127:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b19Type$LT$$RF$str$GT$17h[HASH]E) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&str>::h[HASH]) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&str>) + --> $DIR/types.rs:133:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b27Type$LT$$RF$mut$u20$str$GT$17h[HASH]E) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<&mut str>::h[HASH]) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<&mut str>) + --> $DIR/types.rs:139:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b35Type$LT$$u5b$u8$u3b$$u20$0$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[u8; 0]>::h[HASH]) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[u8; 0]>) + --> $DIR/types.rs:145:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b22Type$LT$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<fn()>::h[HASH]) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<fn()>) + --> $DIR/types.rs:151:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b60Type$LT$unsafe$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RP$$GT$17h[HASH]E) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<unsafe extern "C" fn()>::h[HASH]) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<unsafe extern "C" fn()>) + --> $DIR/types.rs:157:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: symbol-name(_ZN1a1b34Type$LT$$u5b$T$u3b$$u20$N$u5d$$GT$17h[HASH]E) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling(a::b::Type<[T; N]>::h[HASH]) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: demangling-alt(a::b::Type<[T; N]>) + --> $DIR/types.rs:163:5 + | +LL | #[rustc_symbol_name] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 78 previous errors + diff --git a/tests/ui/symbol-names/verbose.rs b/tests/ui/symbol-names/verbose.rs new file mode 100644 index 000000000..e00c592b6 --- /dev/null +++ b/tests/ui/symbol-names/verbose.rs @@ -0,0 +1,15 @@ +// Regression test for issue #57596, where -Zverbose flag unintentionally +// affected produced symbols making it impossible to link between crates +// with a different value of the flag (for symbols involving generic +// arguments equal to defaults of their respective parameters). +// +// build-pass +// compile-flags: -Zverbose + +pub fn error(msg: String) -> Box<dyn std::error::Error> { + msg.into() +} + +fn main() { + error(String::new()); +} diff --git a/tests/ui/symbol-names/x86-stdcall.rs b/tests/ui/symbol-names/x86-stdcall.rs new file mode 100644 index 000000000..9948488c0 --- /dev/null +++ b/tests/ui/symbol-names/x86-stdcall.rs @@ -0,0 +1,13 @@ +// build-pass +// only-x86-windows +#![crate_type = "cdylib"] +#![feature(abi_vectorcall)] + +#[no_mangle] +extern "stdcall" fn foo(_: bool) {} + +#[no_mangle] +extern "fastcall" fn bar(_: u8) {} + +#[no_mangle] +extern "vectorcall" fn baz(_: u16) {} |