about summary refs log tree commit diff
path: root/tests/ui/parser/doc-comment-after-missing-comma-issue-142311.rs
blob: 7ac6fa127f4d3fd83878dc167b89703c70913749 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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() {}