From c83b22a6932240194879ea7d9e783a4c0daf1b79 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Thu, 25 Jul 2024 14:27:41 +0200 Subject: Move procedural macro test to their own directory gcc/testsuite/ChangeLog: * rust/compile/macros/proc/proc_macro.exp: New deja gnu file to execute proc-macro tests. * rust/compile/proc_macro_attribute_crate_type.rs: Move to... * rust/compile/macros/proc/attribute_crate_type.rs: ...here. * rust/compile/proc_macro_attribute_non_function.rs: Move to... * rust/compile/macros/proc/attribute_non_function.rs: ...here. * rust/compile/proc_macro_attribute_non_root_function.rs: Move to... * rust/compile/macros/proc/attribute_non_root_function.rs: ...here. * rust/compile/proc_macro_attribute_non_root_method.rs: Move to... * rust/compile/macros/proc/attribute_non_root_method.rs: ...here. * rust/compile/proc_macro_attribute_non_root_module.rs: Move to... * rust/compile/macros/proc/attribute_non_root_module.rs: ...here. * rust/compile/proc_macro_attribute_private.rs: Move to... * rust/compile/macros/proc/attribute_private.rs: ...here. * rust/compile/proc_macro_crate_type.rs: Move to... * rust/compile/macros/proc/crate_type.rs: ...here. * rust/compile/proc_macro_derive_crate_type.rs: Move to... * rust/compile/macros/proc/derive_crate_type.rs: ...here. * rust/compile/proc_macro_derive_malformed.rs: Move to... * rust/compile/macros/proc/derive_malformed.rs: ...here. * rust/compile/proc_macro_derive_non_function.rs: Move to... * rust/compile/macros/proc/derive_non_function.rs: ...here. * rust/compile/proc_macro_derive_non_root_function.rs: Move to... * rust/compile/macros/proc/derive_non_root_function.rs: ...here. * rust/compile/proc_macro_derive_non_root_module.rs: Move to... * rust/compile/macros/proc/derive_non_root_module.rs: ...here. * rust/compile/proc_macro_derive_private.rs: Move to... * rust/compile/macros/proc/derive_private.rs: ...here. * rust/compile/proc_macro_non_function.rs: Move to... * rust/compile/macros/proc/non_function.rs: ...here. * rust/compile/proc_macro_non_root_function.rs: Move to... * rust/compile/macros/proc/non_root_function.rs: ...here. * rust/compile/proc_macro_non_root_method.rs: Move to... * rust/compile/macros/proc/non_root_method.rs: ...here. * rust/compile/proc_macro_non_root_module.rs: Move to... * rust/compile/macros/proc/non_root_module.rs: ...here. * rust/compile/proc_macro_derive_non_root_method.rs: Move to... * rust/compile/macros/proc/non_root_trait_method.rs: ...here. * rust/compile/proc_macro_private.rs: Move to... * rust/compile/macros/proc/private.rs: ...here. * rust/compile/proc_macro_pub_function.rs: Move to... * rust/compile/macros/proc/pub_function.rs: ...here. * rust/compile/proc_macro_pub_module.rs: Move to... * rust/compile/macros/proc/pub_module.rs: ...here. Signed-off-by: Pierre-Emmanuel Patry --- .../compile/macros/proc/attribute_crate_type.rs | 4 ++ .../compile/macros/proc/attribute_non_function.rs | 58 +++++++++++++++++++++ .../macros/proc/attribute_non_root_function.rs | 6 +++ .../macros/proc/attribute_non_root_method.rs | 10 ++++ .../macros/proc/attribute_non_root_module.rs | 6 +++ .../rust/compile/macros/proc/attribute_private.rs | 4 ++ .../rust/compile/macros/proc/crate_type.rs | 4 ++ .../rust/compile/macros/proc/derive_crate_type.rs | 6 +++ .../rust/compile/macros/proc/derive_malformed.rs | 4 ++ .../compile/macros/proc/derive_non_function.rs | 60 ++++++++++++++++++++++ .../macros/proc/derive_non_root_function.rs | 6 +++ .../compile/macros/proc/derive_non_root_module.rs | 6 +++ .../rust/compile/macros/proc/derive_private.rs | 6 +++ .../rust/compile/macros/proc/non_function.rs | 57 ++++++++++++++++++++ .../rust/compile/macros/proc/non_root_function.rs | 6 +++ .../rust/compile/macros/proc/non_root_method.rs | 10 ++++ .../rust/compile/macros/proc/non_root_module.rs | 6 +++ .../compile/macros/proc/non_root_trait_method.rs | 12 +++++ gcc/testsuite/rust/compile/macros/proc/private.rs | 4 ++ .../rust/compile/macros/proc/proc_macro.exp | 35 +++++++++++++ .../rust/compile/macros/proc/pub_function.rs | 3 ++ .../rust/compile/macros/proc/pub_module.rs | 3 ++ .../compile/proc_macro_attribute_crate_type.rs | 4 -- .../compile/proc_macro_attribute_non_function.rs | 58 --------------------- .../proc_macro_attribute_non_root_function.rs | 6 --- .../proc_macro_attribute_non_root_method.rs | 10 ---- .../proc_macro_attribute_non_root_module.rs | 6 --- .../rust/compile/proc_macro_attribute_private.rs | 4 -- .../rust/compile/proc_macro_crate_type.rs | 4 -- .../rust/compile/proc_macro_derive_crate_type.rs | 6 --- .../rust/compile/proc_macro_derive_malformed.rs | 4 -- .../rust/compile/proc_macro_derive_non_function.rs | 60 ---------------------- .../compile/proc_macro_derive_non_root_function.rs | 6 --- .../compile/proc_macro_derive_non_root_method.rs | 12 ----- .../compile/proc_macro_derive_non_root_module.rs | 6 --- .../rust/compile/proc_macro_derive_private.rs | 6 --- .../rust/compile/proc_macro_non_function.rs | 57 -------------------- .../rust/compile/proc_macro_non_root_function.rs | 6 --- .../rust/compile/proc_macro_non_root_method.rs | 10 ---- .../rust/compile/proc_macro_non_root_module.rs | 6 --- gcc/testsuite/rust/compile/proc_macro_private.rs | 4 -- .../rust/compile/proc_macro_pub_function.rs | 3 -- .../rust/compile/proc_macro_pub_module.rs | 3 -- 43 files changed, 316 insertions(+), 281 deletions(-) create mode 100644 gcc/testsuite/rust/compile/macros/proc/attribute_crate_type.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/attribute_non_function.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/attribute_non_root_function.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/attribute_non_root_method.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/attribute_non_root_module.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/attribute_private.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/crate_type.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/derive_crate_type.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/derive_malformed.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/derive_non_function.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/derive_non_root_function.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/derive_non_root_module.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/derive_private.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/non_function.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/non_root_function.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/non_root_method.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/non_root_module.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/non_root_trait_method.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/private.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/proc_macro.exp create mode 100644 gcc/testsuite/rust/compile/macros/proc/pub_function.rs create mode 100644 gcc/testsuite/rust/compile/macros/proc/pub_module.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_attribute_non_function.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_attribute_non_root_function.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_attribute_non_root_method.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_attribute_non_root_module.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_attribute_private.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_crate_type.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_malformed.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_non_function.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_non_root_function.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_non_root_method.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_non_root_module.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_private.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_non_function.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_non_root_function.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_non_root_method.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_non_root_module.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_private.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_pub_function.rs delete mode 100644 gcc/testsuite/rust/compile/proc_macro_pub_module.rs (limited to 'gcc') diff --git a/gcc/testsuite/rust/compile/macros/proc/attribute_crate_type.rs b/gcc/testsuite/rust/compile/macros/proc/attribute_crate_type.rs new file mode 100644 index 0000000..c13128e --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/attribute_crate_type.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=lib" } + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute is only usable with crates of the .proc-macro. crate type" } +pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/macros/proc/attribute_non_function.rs b/gcc/testsuite/rust/compile/macros/proc/attribute_non_function.rs new file mode 100644 index 0000000..0e88bbe --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/attribute_non_function.rs @@ -0,0 +1,58 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +mod inner { + struct InnerStruct; +} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +type AliasedType = inner::InnerStruct; + +// { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" "" { target *-*-* } .+1 } +#[proc_macro_attribute] +use inner::InnerStruct; + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +struct MyStruct; + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +struct MyCurlyStruct { + member: usize, +} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +struct MyTupleStruct(usize); + +#[proc_macro_attribute] +// { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" "" { target *-*-* } .-1 } +extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." } + // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 } + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +mod my_module {} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +enum MyEnum {} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +union MyUnion { + f1: u32, + f2: f32, +} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +const MY_CONST_STR: &str = "my_string"; + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +static MY_STATIC_USIZE: usize = 10; + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +trait MyTrait {} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +impl MyStruct {} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +impl MyTrait for MyStruct {} + +#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } +extern "C" {} diff --git a/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_function.rs b/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_function.rs new file mode 100644 index 0000000..709119c --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_function.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +fn outer_function() { + #[proc_macro_attribute] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must currently reside in the root of the crate" } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_method.rs b/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_method.rs new file mode 100644 index 0000000..30f3196 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_method.rs @@ -0,0 +1,10 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +struct DummyStruct; + +impl DummyStruct { + pub fn method(self) { + #[proc_macro_attribute] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must currently reside in the root of the crate" } + } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_module.rs b/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_module.rs new file mode 100644 index 0000000..60165be --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/attribute_non_root_module.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +mod test_module { + #[proc_macro_attribute] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must currently reside in the root of the crate" } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/attribute_private.rs b/gcc/testsuite/rust/compile/macros/proc/attribute_private.rs new file mode 100644 index 0000000..00b5ac6 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/attribute_private.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +#[proc_macro_attribute] +fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/macros/proc/crate_type.rs b/gcc/testsuite/rust/compile/macros/proc/crate_type.rs new file mode 100644 index 0000000..880026d --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/crate_type.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=lib" } + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute is only usable with crates of the .proc-macro. crate type" } +pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/macros/proc/derive_crate_type.rs b/gcc/testsuite/rust/compile/macros/proc/derive_crate_type.rs new file mode 100644 index 0000000..7d4234b --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/derive_crate_type.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=lib" } + +trait Dungeness {} + +#[proc_macro_derive(Dungeness)] // { dg-error "the .#.proc_macro_derive.. attribute is only usable with crates of the .proc-macro. crate type" } +pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/macros/proc/derive_malformed.rs b/gcc/testsuite/rust/compile/macros/proc/derive_malformed.rs new file mode 100644 index 0000000..d83256b --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/derive_malformed.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +#[proc_macro_derive] // { dg-excess-errors "malformed 'proc_macro_derive' attribute input" } +pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/macros/proc/derive_non_function.rs b/gcc/testsuite/rust/compile/macros/proc/derive_non_function.rs new file mode 100644 index 0000000..7cb4c0b --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/derive_non_function.rs @@ -0,0 +1,60 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +trait ToDerive {} + +mod inner { + struct InnerStruct; +} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +type AliasedType = inner::InnerStruct; + +// { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" "" { target *-*-* } .+1 } +#[proc_macro_derive(ToDerive)] +use inner::InnerStruct; + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +struct MyStruct; + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +struct MyCurlyStruct { + member: usize, +} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +struct MyTupleStruct(usize); + +#[proc_macro_derive(ToDerive)] +// { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" "" { target *-*-* } .-1 } +extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." } + // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 } + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +mod my_module {} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +enum MyEnum {} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +union MyUnion { + f1: u32, + f2: f32, +} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +const MY_CONST_STR: &str = "my_string"; + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +static MY_STATIC_USIZE: usize = 10; + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +trait MyTrait {} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +impl MyStruct {} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +impl MyTrait for MyStruct {} + +#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } +extern "C" {} diff --git a/gcc/testsuite/rust/compile/macros/proc/derive_non_root_function.rs b/gcc/testsuite/rust/compile/macros/proc/derive_non_root_function.rs new file mode 100644 index 0000000..69d5ca1 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/derive_non_root_function.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +fn outer_function() { + #[proc_macro_derive(SomeTrait)] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must currently reside in the root of the crate" } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/derive_non_root_module.rs b/gcc/testsuite/rust/compile/macros/proc/derive_non_root_module.rs new file mode 100644 index 0000000..45d7a47 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/derive_non_root_module.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +mod test_module { + #[proc_macro_derive(SomeTrait)] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must currently reside in the root of the crate" } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/derive_private.rs b/gcc/testsuite/rust/compile/macros/proc/derive_private.rs new file mode 100644 index 0000000..69922be --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/derive_private.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +trait Chesapeake {} + +#[proc_macro_derive(Chesapeake)] +fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/macros/proc/non_function.rs b/gcc/testsuite/rust/compile/macros/proc/non_function.rs new file mode 100644 index 0000000..ff2083c --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/non_function.rs @@ -0,0 +1,57 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +mod inner { + struct InnerStruct; +} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +type AliasedType = inner::InnerStruct; + +// { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" "" { target *-*-* } .+1 } +#[proc_macro] +use inner::InnerStruct; + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +struct MyStruct; + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +struct MyCurlyStruct { + member: usize, +} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +struct MyTupleStruct(usize); + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." } + // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 } + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +mod my_module {} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +enum MyEnum {} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +union MyUnion { + f1: u32, + f2: f32, +} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +const MY_CONST_STR: &str = "my_string"; + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +static MY_STATIC_USIZE: usize = 10; + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +trait MyTrait {} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +impl MyStruct {} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +impl MyTrait for MyStruct {} + +#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } +extern "C" {} diff --git a/gcc/testsuite/rust/compile/macros/proc/non_root_function.rs b/gcc/testsuite/rust/compile/macros/proc/non_root_function.rs new file mode 100644 index 0000000..9309940 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/non_root_function.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +fn outer_function() { + #[proc_macro] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro.. must currently reside in the root of the crate" } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/non_root_method.rs b/gcc/testsuite/rust/compile/macros/proc/non_root_method.rs new file mode 100644 index 0000000..ee52c324 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/non_root_method.rs @@ -0,0 +1,10 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +struct DummyStruct; + +impl DummyStruct { + pub fn method(self) { + #[proc_macro] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro.. must currently reside in the root of the crate" } + } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/non_root_module.rs b/gcc/testsuite/rust/compile/macros/proc/non_root_module.rs new file mode 100644 index 0000000..1028612 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/non_root_module.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +mod test_module { + #[proc_macro] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro.. must currently reside in the root of the crate" } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/non_root_trait_method.rs b/gcc/testsuite/rust/compile/macros/proc/non_root_trait_method.rs new file mode 100644 index 0000000..523b37a --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/non_root_trait_method.rs @@ -0,0 +1,12 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +trait SomeTrait {} + +struct DummyStruct; + +impl DummyStruct { + pub fn method(self) { + #[proc_macro_derive(SomeTrait)] + pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must currently reside in the root of the crate" } + } +} diff --git a/gcc/testsuite/rust/compile/macros/proc/private.rs b/gcc/testsuite/rust/compile/macros/proc/private.rs new file mode 100644 index 0000000..17e85f4 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/private.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +#[proc_macro] +fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/macros/proc/proc_macro.exp b/gcc/testsuite/rust/compile/macros/proc/proc_macro.exp new file mode 100644 index 0000000..ac891db --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/proc_macro.exp @@ -0,0 +1,35 @@ +# Copyright (C) 2021-2024 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Compile tests, no torture testing. +# +# These tests raise errors in the front end; torture testing doesn't apply. + +# Load support procs. +load_lib rust-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. +set saved-dg-do-what-default ${dg-do-what-default} + +set dg-do-what-default "compile" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.rs]] "" "" +set dg-do-what-default ${saved-dg-do-what-default} + +# All done. +dg-finish diff --git a/gcc/testsuite/rust/compile/macros/proc/pub_function.rs b/gcc/testsuite/rust/compile/macros/proc/pub_function.rs new file mode 100644 index 0000000..52f5d38 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/pub_function.rs @@ -0,0 +1,3 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +pub fn wild_pub_function() {} // { dg-error ".proc-macro. crate types currently cannot export any items other than functions tagged with .#.proc_macro.., .#.proc_macro_derive.. or .#.proc_macro_attribute.." } diff --git a/gcc/testsuite/rust/compile/macros/proc/pub_module.rs b/gcc/testsuite/rust/compile/macros/proc/pub_module.rs new file mode 100644 index 0000000..a8bc0e8 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/proc/pub_module.rs @@ -0,0 +1,3 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +pub fn wild_pub_module() {} // { dg-error ".proc-macro. crate types currently cannot export any items other than functions tagged with .#.proc_macro.., .#.proc_macro_derive.. or .#.proc_macro_attribute.." } diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs deleted file mode 100644 index c13128e..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-additional-options "-frust-crate-type=lib" } - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute is only usable with crates of the .proc-macro. crate type" } -pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_non_function.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_non_function.rs deleted file mode 100644 index 0e88bbe..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_attribute_non_function.rs +++ /dev/null @@ -1,58 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -mod inner { - struct InnerStruct; -} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -type AliasedType = inner::InnerStruct; - -// { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" "" { target *-*-* } .+1 } -#[proc_macro_attribute] -use inner::InnerStruct; - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -struct MyStruct; - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -struct MyCurlyStruct { - member: usize, -} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -struct MyTupleStruct(usize); - -#[proc_macro_attribute] -// { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" "" { target *-*-* } .-1 } -extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." } - // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 } - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -mod my_module {} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -enum MyEnum {} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -union MyUnion { - f1: u32, - f2: f32, -} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -const MY_CONST_STR: &str = "my_string"; - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -static MY_STATIC_USIZE: usize = 10; - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -trait MyTrait {} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -impl MyStruct {} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -impl MyTrait for MyStruct {} - -#[proc_macro_attribute] // { dg-error "the .#.proc_macro_attribute.. attribute may only be used on bare functions" } -extern "C" {} diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_function.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_function.rs deleted file mode 100644 index 709119c..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_function.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -fn outer_function() { - #[proc_macro_attribute] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must currently reside in the root of the crate" } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_method.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_method.rs deleted file mode 100644 index 30f3196..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_method.rs +++ /dev/null @@ -1,10 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -struct DummyStruct; - -impl DummyStruct { - pub fn method(self) { - #[proc_macro_attribute] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must currently reside in the root of the crate" } - } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_module.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_module.rs deleted file mode 100644 index 60165be..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_attribute_non_root_module.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -mod test_module { - #[proc_macro_attribute] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must currently reside in the root of the crate" } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs deleted file mode 100644 index 00b5ac6..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -#[proc_macro_attribute] -fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/proc_macro_crate_type.rs b/gcc/testsuite/rust/compile/proc_macro_crate_type.rs deleted file mode 100644 index 880026d..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_crate_type.rs +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-additional-options "-frust-crate-type=lib" } - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute is only usable with crates of the .proc-macro. crate type" } -pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs b/gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs deleted file mode 100644 index 7d4234b..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=lib" } - -trait Dungeness {} - -#[proc_macro_derive(Dungeness)] // { dg-error "the .#.proc_macro_derive.. attribute is only usable with crates of the .proc-macro. crate type" } -pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_malformed.rs b/gcc/testsuite/rust/compile/proc_macro_derive_malformed.rs deleted file mode 100644 index d83256b..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_derive_malformed.rs +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -#[proc_macro_derive] // { dg-excess-errors "malformed 'proc_macro_derive' attribute input" } -pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_non_function.rs b/gcc/testsuite/rust/compile/proc_macro_derive_non_function.rs deleted file mode 100644 index 7cb4c0b..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_derive_non_function.rs +++ /dev/null @@ -1,60 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -trait ToDerive {} - -mod inner { - struct InnerStruct; -} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -type AliasedType = inner::InnerStruct; - -// { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" "" { target *-*-* } .+1 } -#[proc_macro_derive(ToDerive)] -use inner::InnerStruct; - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -struct MyStruct; - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -struct MyCurlyStruct { - member: usize, -} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -struct MyTupleStruct(usize); - -#[proc_macro_derive(ToDerive)] -// { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" "" { target *-*-* } .-1 } -extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." } - // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 } - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -mod my_module {} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -enum MyEnum {} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -union MyUnion { - f1: u32, - f2: f32, -} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -const MY_CONST_STR: &str = "my_string"; - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -static MY_STATIC_USIZE: usize = 10; - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -trait MyTrait {} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -impl MyStruct {} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -impl MyTrait for MyStruct {} - -#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } -extern "C" {} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_non_root_function.rs b/gcc/testsuite/rust/compile/proc_macro_derive_non_root_function.rs deleted file mode 100644 index 69d5ca1..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_derive_non_root_function.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -fn outer_function() { - #[proc_macro_derive(SomeTrait)] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must currently reside in the root of the crate" } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_non_root_method.rs b/gcc/testsuite/rust/compile/proc_macro_derive_non_root_method.rs deleted file mode 100644 index 523b37a..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_derive_non_root_method.rs +++ /dev/null @@ -1,12 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -trait SomeTrait {} - -struct DummyStruct; - -impl DummyStruct { - pub fn method(self) { - #[proc_macro_derive(SomeTrait)] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must currently reside in the root of the crate" } - } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_non_root_module.rs b/gcc/testsuite/rust/compile/proc_macro_derive_non_root_module.rs deleted file mode 100644 index 45d7a47..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_derive_non_root_module.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -mod test_module { - #[proc_macro_derive(SomeTrait)] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must currently reside in the root of the crate" } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_private.rs b/gcc/testsuite/rust/compile/proc_macro_derive_private.rs deleted file mode 100644 index 69922be..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_derive_private.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -trait Chesapeake {} - -#[proc_macro_derive(Chesapeake)] -fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/proc_macro_non_function.rs b/gcc/testsuite/rust/compile/proc_macro_non_function.rs deleted file mode 100644 index ff2083c..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_non_function.rs +++ /dev/null @@ -1,57 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -mod inner { - struct InnerStruct; -} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -type AliasedType = inner::InnerStruct; - -// { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" "" { target *-*-* } .+1 } -#[proc_macro] -use inner::InnerStruct; - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -struct MyStruct; - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -struct MyCurlyStruct { - member: usize, -} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -struct MyTupleStruct(usize); - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." } - // { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 } - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -mod my_module {} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -enum MyEnum {} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -union MyUnion { - f1: u32, - f2: f32, -} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -const MY_CONST_STR: &str = "my_string"; - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -static MY_STATIC_USIZE: usize = 10; - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -trait MyTrait {} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -impl MyStruct {} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -impl MyTrait for MyStruct {} - -#[proc_macro] // { dg-error "the .#.proc_macro.. attribute may only be used on bare functions" } -extern "C" {} diff --git a/gcc/testsuite/rust/compile/proc_macro_non_root_function.rs b/gcc/testsuite/rust/compile/proc_macro_non_root_function.rs deleted file mode 100644 index 9309940..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_non_root_function.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -fn outer_function() { - #[proc_macro] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro.. must currently reside in the root of the crate" } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_non_root_method.rs b/gcc/testsuite/rust/compile/proc_macro_non_root_method.rs deleted file mode 100644 index ee52c324..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_non_root_method.rs +++ /dev/null @@ -1,10 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -struct DummyStruct; - -impl DummyStruct { - pub fn method(self) { - #[proc_macro] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro.. must currently reside in the root of the crate" } - } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_non_root_module.rs b/gcc/testsuite/rust/compile/proc_macro_non_root_module.rs deleted file mode 100644 index 1028612..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_non_root_module.rs +++ /dev/null @@ -1,6 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -mod test_module { - #[proc_macro] - pub fn non_root_function() {} // { dg-error "functions tagged with .#.proc_macro.. must currently reside in the root of the crate" } -} diff --git a/gcc/testsuite/rust/compile/proc_macro_private.rs b/gcc/testsuite/rust/compile/proc_macro_private.rs deleted file mode 100644 index 17e85f4..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_private.rs +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -#[proc_macro] -fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/proc_macro_pub_function.rs b/gcc/testsuite/rust/compile/proc_macro_pub_function.rs deleted file mode 100644 index 52f5d38..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_pub_function.rs +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -pub fn wild_pub_function() {} // { dg-error ".proc-macro. crate types currently cannot export any items other than functions tagged with .#.proc_macro.., .#.proc_macro_derive.. or .#.proc_macro_attribute.." } diff --git a/gcc/testsuite/rust/compile/proc_macro_pub_module.rs b/gcc/testsuite/rust/compile/proc_macro_pub_module.rs deleted file mode 100644 index a8bc0e8..0000000 --- a/gcc/testsuite/rust/compile/proc_macro_pub_module.rs +++ /dev/null @@ -1,3 +0,0 @@ -// { dg-additional-options "-frust-crate-type=proc-macro" } - -pub fn wild_pub_module() {} // { dg-error ".proc-macro. crate types currently cannot export any items other than functions tagged with .#.proc_macro.., .#.proc_macro_derive.. or .#.proc_macro_attribute.." } -- cgit v1.1