about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-07-22 12:28:17 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-08-06 22:13:11 +0300
commit712de2b5211ec9aad434358d459e843ca9a4622d (patch)
tree9dd9fc5fc54d018b0094a6670ec644251157247a /src/librustc_parse/parser
parent000c070b70eba07a903db82fb8505433842fe1f1 (diff)
rustc_expand: Don not beautify doc comments before passing them to macros
Beautify all doc strings in rustdoc instead, including those in `#[doc]` attributes
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/mod.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs
index 1b7fc4dafa2..ededfc43669 100644
--- a/src/librustc_parse/parser/mod.rs
+++ b/src/librustc_parse/parser/mod.rs
@@ -22,7 +22,6 @@ use rustc_ast::ast::{
 use rustc_ast::ptr::P;
 use rustc_ast::token::{self, DelimToken, Token, TokenKind};
 use rustc_ast::tokenstream::{self, DelimSpan, TokenStream, TokenTree, TreeAndJoint};
-use rustc_ast::util::comments::strip_doc_comment_decoration;
 use rustc_ast_pretty::pprust;
 use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, FatalError, PResult};
 use rustc_session::parse::ParseSess;
@@ -209,20 +208,18 @@ impl TokenCursor {
     }
 
     fn next_desugared(&mut self) -> Token {
-        let (data, comment_kind, attr_style, sp) = match self.next() {
-            Token { kind: token::DocComment(comment_kind, attr_style, data), span } => {
-                (data, comment_kind, attr_style, span)
+        let (data, attr_style, sp) = match self.next() {
+            Token { kind: token::DocComment(_, attr_style, data), span } => {
+                (data, attr_style, span)
             }
             tok => return tok,
         };
 
-        let stripped = strip_doc_comment_decoration(data, comment_kind);
-
         // Searches for the occurrences of `"#*` and returns the minimum number of `#`s
         // required to wrap the text.
         let mut num_of_hashes = 0;
         let mut count = 0;
-        for ch in stripped.chars() {
+        for ch in data.as_str().chars() {
             count = match ch {
                 '"' => 1,
                 '#' if count > 0 => count + 1,
@@ -238,10 +235,7 @@ impl TokenCursor {
             [
                 TokenTree::token(token::Ident(sym::doc, false), sp),
                 TokenTree::token(token::Eq, sp),
-                TokenTree::token(
-                    TokenKind::lit(token::StrRaw(num_of_hashes), Symbol::intern(&stripped), None),
-                    sp,
-                ),
+                TokenTree::token(TokenKind::lit(token::StrRaw(num_of_hashes), data, None), sp),
             ]
             .iter()
             .cloned()