File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,21 @@ fn test_comments_preserve_trailing_whitespace() {
242242 ) ;
243243}
244244
245+ #[ test]
246+ fn test_four_slash_line_comment ( ) {
247+ let file = SourceFile :: parse (
248+ r#"
249+ //// too many slashes to be a doc comment
250+ /// doc comment
251+ mod foo {}
252+ "# ,
253+ )
254+ . ok ( )
255+ . unwrap ( ) ;
256+ let module = file. syntax ( ) . descendants ( ) . find_map ( Module :: cast) . unwrap ( ) ;
257+ assert_eq ! ( "doc comment" , module. doc_comment_text( ) . unwrap( ) ) ;
258+ }
259+
245260#[ test]
246261fn test_where_predicates ( ) {
247262 fn assert_bound ( text : & str , bound : Option < TypeBound > ) {
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ pub enum CommentPlacement {
4848const COMMENT_PREFIX_TO_KIND : & [ ( & str , CommentKind ) ] = {
4949 use { CommentPlacement :: * , CommentShape :: * } ;
5050 & [
51+ ( "////" , CommentKind { shape : Line , doc : None } ) ,
5152 ( "///" , CommentKind { shape : Line , doc : Some ( Outer ) } ) ,
5253 ( "//!" , CommentKind { shape : Line , doc : Some ( Inner ) } ) ,
5354 ( "/**" , CommentKind { shape : Block , doc : Some ( Outer ) } ) ,
You can’t perform that action at this time.
0 commit comments