//@ build-fail //@ compile-flags: -C symbol-mangling-version=v0 --crate-name=c //@ normalize-stderr-test: "c\[[0-9a-f]+\]" -> "c[HASH]" #![feature(adt_const_params, unsized_const_params, decl_macro, rustc_attrs)] #![allow(incomplete_features)] use std::marker::UnsizedConstParamTy; pub struct RefByte; #[rustc_symbol_name] //~^ ERROR symbol-name //~| ERROR demangling //~| ERROR demangling-alt(>) 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; #[rustc_symbol_name] //~^ ERROR symbol-name //~| ERROR demangling //~| ERROR demangling-alt(>) impl RefZst<{ &[] }> {} pub struct Array3Bytes; #[rustc_symbol_name] //~^ ERROR symbol-name //~| ERROR demangling //~| ERROR demangling-alt(>) impl Array3Bytes<{ [1, 2, 3] }> {} pub struct TupleByteBool; #[rustc_symbol_name] //~^ ERROR symbol-name //~| ERROR demangling //~| ERROR demangling-alt(>) impl TupleByteBool<{ (1, false) }> {} #[derive(PartialEq, Eq, UnsizedConstParamTy)] pub enum MyOption { Some(T), None, } pub struct OptionUsize>; // 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(::None}>>) impl OptionUsize<{ MyOption::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(::Some(0)}>>) impl OptionUsize<{ MyOption::Some(0) }> {} #[derive(PartialEq, Eq, UnsizedConstParamTy)] pub struct Foo { s: &'static str, ch: char, slice: &'static [u8], } pub struct Foo_; #[rustc_symbol_name] //~^ ERROR symbol-name //~| ERROR demangling //~| ERROR demangling-alt(>) 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, UnsizedConstParamTy)] pub struct Bar { $x: u8, x: u16, } pub struct Bar_; #[rustc_symbol_name] //~^ ERROR symbol-name //~| ERROR demangling //~| ERROR demangling-alt(>) impl Bar_<{ Bar { $x: 123, x: 4096 } }> {} } duplicate_field_name_test!(x); fn main() {}