summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-12-13 16:20:00 +0100
committerJosh Stone <jistone@redhat.com>2025-01-02 14:28:32 -0800
commite09de50ce0ded8b290098874f9d778f521b8b0cc (patch)
tree60c57c0686acc175566fbd2194f78b2f79657ef0
parent31236a39f86ad8128323afd0cead010227444c2a (diff)
downloadrust-e09de50ce0ded8b290098874f9d778f521b8b0cc.tar.gz
rust-e09de50ce0ded8b290098874f9d778f521b8b0cc.zip
Add ui regression test for #134221
(cherry picked from commit 9c4a61ff52a635ef96bd92a2ff1fad4a8bb2ce73)
-rw-r--r--tests/rustdoc-ui/doctest/comment-in-attr-134221.rs23
-rw-r--r--tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout36
2 files changed, 59 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs
new file mode 100644
index 00000000000..fa8cd106659
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs
@@ -0,0 +1,23 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/134221>.
+// It checks that even if there are comments in the attributes, the attributes
+// will still be generated correctly (and therefore fail in this test).
+
+//@ compile-flags:--test --test-args --test-threads=1
+//@ failure-status: 101
+//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
+
+/*!
+```rust
+#![feature(
+  foo, //
+)]
+```
+
+```rust
+#![feature(
+  foo,
+)]
+```
+*/
diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout b/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout
new file mode 100644
index 00000000000..728bfdb010f
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout
@@ -0,0 +1,36 @@
+
+running 2 tests
+test $DIR/comment-in-attr-134221.rs - (line 11) ... FAILED
+test $DIR/comment-in-attr-134221.rs - (line 17) ... FAILED
+
+failures:
+
+---- $DIR/comment-in-attr-134221.rs - (line 11) stdout ----
+error[E0635]: unknown feature `foo`
+  --> $DIR/comment-in-attr-134221.rs:$LINE:$COL
+   |
+LL |   foo, //
+   |   ^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0635`.
+Couldn't compile the test.
+---- $DIR/comment-in-attr-134221.rs - (line 17) stdout ----
+error[E0635]: unknown feature `foo`
+  --> $DIR/comment-in-attr-134221.rs:$LINE:$COL
+   |
+LL |   foo,
+   |   ^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0635`.
+Couldn't compile the test.
+
+failures:
+    $DIR/comment-in-attr-134221.rs - (line 11)
+    $DIR/comment-in-attr-134221.rs - (line 17)
+
+test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+