mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
Treat comments beginning with four slashes as regular line comments
This commit is contained in:
parent
da1f316b02
commit
b6560e3ebb
@ -242,6 +242,21 @@ fn test_comments_preserve_trailing_whitespace() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_four_slash_line_comment() {
|
||||||
|
let file = SourceFile::parse(
|
||||||
|
r#"
|
||||||
|
//// too many slashes to be a doc comment
|
||||||
|
/// doc comment
|
||||||
|
mod foo {}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.ok()
|
||||||
|
.unwrap();
|
||||||
|
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
|
||||||
|
assert_eq!("doc comment", module.doc_comment_text().unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_where_predicates() {
|
fn test_where_predicates() {
|
||||||
fn assert_bound(text: &str, bound: Option<TypeBound>) {
|
fn assert_bound(text: &str, bound: Option<TypeBound>) {
|
||||||
|
@ -48,6 +48,7 @@ pub enum CommentPlacement {
|
|||||||
const COMMENT_PREFIX_TO_KIND: &[(&str, CommentKind)] = {
|
const COMMENT_PREFIX_TO_KIND: &[(&str, CommentKind)] = {
|
||||||
use {CommentPlacement::*, CommentShape::*};
|
use {CommentPlacement::*, CommentShape::*};
|
||||||
&[
|
&[
|
||||||
|
("////", CommentKind { shape: Line, doc: None }),
|
||||||
("///", CommentKind { shape: Line, doc: Some(Outer) }),
|
("///", CommentKind { shape: Line, doc: Some(Outer) }),
|
||||||
("//!", CommentKind { shape: Line, doc: Some(Inner) }),
|
("//!", CommentKind { shape: Line, doc: Some(Inner) }),
|
||||||
("/**", CommentKind { shape: Block, doc: Some(Outer) }),
|
("/**", CommentKind { shape: Block, doc: Some(Outer) }),
|
||||||
|
Loading…
Reference in New Issue
Block a user