about summary refs log tree commit diff
path: root/tests/ui/parser/doc-comment-after-missing-comma-issue-142311.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/doc-comment-after-missing-comma-issue-142311.rs')
-rw-r--r--tests/ui/parser/doc-comment-after-missing-comma-issue-142311.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/parser/doc-comment-after-missing-comma-issue-142311.rs b/tests/ui/parser/doc-comment-after-missing-comma-issue-142311.rs
new file mode 100644
index 00000000000..7ac6fa127f4
--- /dev/null
+++ b/tests/ui/parser/doc-comment-after-missing-comma-issue-142311.rs
@@ -0,0 +1,34 @@
+//! Check that if the parser suggests converting `///` to a regular comment
+//! when it appears after a missing comma in an list (e.g. `enum` variants).
+//!
+//! Related issue
+//! - https://github.com/rust-lang/rust/issues/142311
+
+enum Foo {
+    /// Like the noise a sheep makes
+    Bar
+    /// Like where people drink
+    //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found doc comment `/// Like where people drink`
+    Baa///xxxxxx
+    //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found doc comment `///xxxxxx`
+    Baz///xxxxxx
+    //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found doc comment `///xxxxxx`
+}
+
+fn foo() {
+    let a = [
+        1///xxxxxx
+        //~^ ERROR expected one of `,`, `.`, `;`, `?`, `]`, or an operator, found doc comment `///xxxxxx`
+        2
+    ];
+}
+
+fn bar() {
+    let a = [
+        1,
+        2///xxxxxx
+        //~^ ERROR expected one of `,`, `.`, `?`, `]`, or an operator, found doc comment `///xxxxxx`
+    ];
+}
+
+fn main() {}