--- /dev/null
+// { 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" }
+}
--- /dev/null
+// { 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" }
+ }
+}
--- /dev/null
+// { 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" }
+}
--- /dev/null
+// { 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" }
+}
--- /dev/null
+// { 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" }
+ }
+}
--- /dev/null
+// { 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" }
+}
--- /dev/null
+// { 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" }
+}
--- /dev/null
+// { 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" }
+ }
+}
--- /dev/null
+// { 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" }
+}