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.
6 #![feature(asm, llvm_asm)]
7 #![feature(trace_macros, concat_idents)]
8 #![feature(stmt_expr_attributes, arbitrary_enum_discriminant)]
9 #![feature(derive_default_enum)]
12 struct DefaultInnerAttrStruct {
13 #[default] //~ ERROR the `#[default]` attribute may only be used on unit enum variants
18 struct DefaultInnerAttrTupleStruct(#[default] ());
19 //~^ ERROR the `#[default]` attribute may only be used on unit enum variants
22 #[default] //~ ERROR the `#[default]` attribute may only be used on unit enum variants
23 struct DefaultOuterAttrStruct {}
26 #[default] //~ ERROR the `#[default]` attribute may only be used on unit enum variants
27 enum DefaultOuterAttrEnum {
32 #[rustfmt::skip] // needs some work to handle this case
35 enum AttrOnInnerExpression {
36 Foo = #[default] 0, //~ ERROR the `#[default]` attribute may only be used on unit enum variants
37 Bar([u8; #[default] 1]), //~ ERROR the `#[default]` attribute may only be used on unit enum variants
42 #[derive(Default)] //~ ERROR no default declared
43 enum NoDeclaredDefault {
48 #[derive(Default)] //~ ERROR multiple declared defaults
49 enum MultipleDefaults {
59 enum ExtraDeriveTokens {
60 #[default = 1] //~ ERROR `#[default]` attribute does not accept a value
65 enum TwoDefaultAttrs {
68 Foo, //~ERROR multiple `#[default]` attributes
73 enum ManyDefaultAttrs {
78 Foo, //~ERROR multiple `#[default]` attributes
83 enum DefaultHasFields {
85 Foo {}, //~ ERROR the `#[default]` attribute may only be used on unit enum variants
90 enum NonExhaustiveDefault {
93 Foo, //~ ERROR default variant must be exhaustive
98 asm!(invalid); //~ ERROR
99 llvm_asm!(invalid); //~ ERROR
101 concat_idents!("not", "idents"); //~ ERROR
103 option_env!(invalid); //~ ERROR
104 env!(invalid); //~ ERROR
105 env!(foo, abr, baz); //~ ERROR
106 env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); //~ ERROR
108 format!(invalid); //~ ERROR
110 include!(invalid); //~ ERROR
112 include_str!(invalid); //~ ERROR
113 include_str!("i'd be quite surprised if a file with this name existed"); //~ ERROR
114 include_bytes!(invalid); //~ ERROR
115 include_bytes!("i'd be quite surprised if a file with this name existed"); //~ ERROR
117 trace_macros!(invalid); //~ ERROR