Skip to content

Commit fd02f90

Browse files
committed
auto merge of #12586 : chris-morgan/rust/fix-pretty-print-slash-star-star-star-crash, r=alexcrichton
The pretty printer was treating block comments with more than two asterisks after the first slash (e.g. `/***`) as doc comments (which are attributes), whereas in actual fact they are just regular comments.
2 parents b4d9238 + e6b032a commit fd02f90

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/libsyntax/parse/comments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ fn read_block_comment(rdr: &StringReader,
260260
let mut curr_line = ~"/*";
261261
262262
// doc-comments are not really comments, they are attributes
263-
if rdr.curr_is('*') || rdr.curr_is('!') {
263+
if (rdr.curr_is('*') && !nextch_is(rdr, '*')) || rdr.curr_is('!') {
264264
while !(rdr.curr_is('*') && nextch_is(rdr, '/')) && !is_eof(rdr) {
265265
curr_line.push_char(rdr.curr.get().unwrap());
266266
bump(rdr);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// pp-exact
12+
/***
13+
More than two asterisks means that it isn't a doc comment.
14+
*/

0 commit comments

Comments
 (0)