1 // normalize-stderr-test: "existed:.*\(" -> "existed: $$FILE_NOT_FOUND_MSG ("
3 // test that errors in a (selection) of macros don't kill compilation
4 // immediately, so that we get more errors listed at a time.
7 #![feature(trace_macros, concat_idents)]
8 #![feature(stmt_expr_attributes, arbitrary_enum_discriminant)]
9 #![feature(derive_default_enum)]
10 #![allow(deprecated)] // llvm_asm!
15 struct DefaultInnerAttrStruct
{
16 #[default] //~ ERROR the `#[default]` attribute may only be used on unit enum variants
21 struct DefaultInnerAttrTupleStruct(#[default] ());
22 //~^ ERROR the `#[default]` attribute may only be used on unit enum variants
25 #[default] //~ ERROR the `#[default]` attribute may only be used on unit enum variants
26 struct DefaultOuterAttrStruct {}
29 #[default] //~ ERROR the `#[default]` attribute may only be used on unit enum variants
30 enum DefaultOuterAttrEnum
{
35 #[rustfmt::skip] // needs some work to handle this case
38 enum AttrOnInnerExpression
{
39 Foo
= #[default] 0, //~ ERROR the `#[default]` attribute may only be used on unit enum variants
40 Bar([u8; #[default] 1]), //~ ERROR the `#[default]` attribute may only be used on unit enum variants
45 #[derive(Default)] //~ ERROR no default declared
46 enum NoDeclaredDefault
{
51 #[derive(Default)] //~ ERROR multiple declared defaults
52 enum MultipleDefaults
{
62 enum ExtraDeriveTokens
{
63 #[default = 1] //~ ERROR `#[default]` attribute does not accept a value
68 enum TwoDefaultAttrs
{
71 Foo
, //~ERROR multiple `#[default]` attributes
76 enum ManyDefaultAttrs
{
81 Foo
, //~ERROR multiple `#[default]` attributes
86 enum DefaultHasFields
{
88 Foo {}
, //~ ERROR the `#[default]` attribute may only be used on unit enum variants
93 enum NonExhaustiveDefault
{
96 Foo
, //~ ERROR default variant must be exhaustive
101 asm
!(invalid
); //~ ERROR
102 llvm_asm
!(invalid
); //~ ERROR
104 concat_idents
!("not", "idents"); //~ ERROR
106 option_env
!(invalid
); //~ ERROR
107 env
!(invalid
); //~ ERROR
108 env
!(foo
, abr
, baz
); //~ ERROR
109 env
!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); //~ ERROR
111 format
!(invalid
); //~ ERROR
113 include
!(invalid
); //~ ERROR
115 include_str
!(invalid
); //~ ERROR
116 include_str
!("i'd be quite surprised if a file with this name existed"); //~ ERROR
117 include_bytes
!(invalid
); //~ ERROR
118 include_bytes
!("i'd be quite surprised if a file with this name existed"); //~ ERROR
120 trace_macros
!(invalid
); //~ ERROR