summaryrefslogtreecommitdiffstats
path: root/tests/ui/proc-macro
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /tests/ui/proc-macro
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/proc-macro')
-rw-r--r--tests/ui/proc-macro/module.rs2
-rw-r--r--tests/ui/proc-macro/module_with_attrs.rs2
-rw-r--r--tests/ui/proc-macro/outer/inner.rs2
-rw-r--r--tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs2
-rw-r--r--tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs2
-rw-r--r--tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs2
-rw-r--r--tests/ui/proc-macro/test-same-crate.rs16
-rw-r--r--tests/ui/proc-macro/test-same-crate.stderr10
8 files changed, 32 insertions, 6 deletions
diff --git a/tests/ui/proc-macro/module.rs b/tests/ui/proc-macro/module.rs
index 5777ed899..a750083c6 100644
--- a/tests/ui/proc-macro/module.rs
+++ b/tests/ui/proc-macro/module.rs
@@ -1 +1 @@
-// ignore-test
+// ignore-test (auxiliary, used by other tests)
diff --git a/tests/ui/proc-macro/module_with_attrs.rs b/tests/ui/proc-macro/module_with_attrs.rs
index 63e66a62a..0b2604f95 100644
--- a/tests/ui/proc-macro/module_with_attrs.rs
+++ b/tests/ui/proc-macro/module_with_attrs.rs
@@ -1,4 +1,4 @@
-// ignore-test
+// ignore-test (auxiliary, used by other tests)
#![rustfmt::skip]
#![print_attr]
diff --git a/tests/ui/proc-macro/outer/inner.rs b/tests/ui/proc-macro/outer/inner.rs
index 5777ed899..a750083c6 100644
--- a/tests/ui/proc-macro/outer/inner.rs
+++ b/tests/ui/proc-macro/outer/inner.rs
@@ -1 +1 @@
-// ignore-test
+// ignore-test (auxiliary, used by other tests)
diff --git a/tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs b/tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs
index 9501980fa..889f399a7 100644
--- a/tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs
+++ b/tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs
@@ -1,4 +1,4 @@
-// ignore-test
+// ignore-test (auxiliary, used by other tests)
#[derive(Print)]
enum ProceduralMasqueradeDummyType {
diff --git a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs b/tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs
index 9501980fa..889f399a7 100644
--- a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs
+++ b/tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs
@@ -1,4 +1,4 @@
-// ignore-test
+// ignore-test (auxiliary, used by other tests)
#[derive(Print)]
enum ProceduralMasqueradeDummyType {
diff --git a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs b/tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs
index 9501980fa..889f399a7 100644
--- a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs
+++ b/tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs
@@ -1,4 +1,4 @@
-// ignore-test
+// ignore-test (auxiliary, used by other tests)
#[derive(Print)]
enum ProceduralMasqueradeDummyType {
diff --git a/tests/ui/proc-macro/test-same-crate.rs b/tests/ui/proc-macro/test-same-crate.rs
new file mode 100644
index 000000000..c13f384fa
--- /dev/null
+++ b/tests/ui/proc-macro/test-same-crate.rs
@@ -0,0 +1,16 @@
+// compile-flags: --test
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::TokenStream;
+
+#[proc_macro]
+pub fn mac(input: TokenStream) -> TokenStream { loop {} }
+
+#[cfg(test)]
+mod test {
+ #[test]
+ fn t() { crate::mac!(A) }
+ //~^ ERROR can't use a procedural macro from the same crate that defines it
+ //~| HELP you can define integration tests in a directory named `tests`
+}
diff --git a/tests/ui/proc-macro/test-same-crate.stderr b/tests/ui/proc-macro/test-same-crate.stderr
new file mode 100644
index 000000000..5d12e149c
--- /dev/null
+++ b/tests/ui/proc-macro/test-same-crate.stderr
@@ -0,0 +1,10 @@
+error: can't use a procedural macro from the same crate that defines it
+ --> $DIR/test-same-crate.rs:13:14
+ |
+LL | fn t() { crate::mac!(A) }
+ | ^^^^^^^^^^
+ |
+ = help: you can define integration tests in a directory named `tests`
+
+error: aborting due to previous error
+