about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser/attr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-07 22:02:41 +0000
committerbors <bors@rust-lang.org>2019-11-07 22:02:41 +0000
commite8f43b72eb2596f360004f6cdf9cdde4b9e789e1 (patch)
tree4e437fd2ceb9b0c236f649563c15e016816853ff /src/libsyntax/parse/parser/attr.rs
parent50f8aadd746ebc929a752e5ffb133936ee75c52f (diff)
parent333899a736cc5a4c8cb5cd6585fea7395c9b160c (diff)
downloadrust-e8f43b72eb2596f360004f6cdf9cdde4b9e789e1.tar.gz
rust-e8f43b72eb2596f360004f6cdf9cdde4b9e789e1.zip
Auto merge of #66189 - Centril:rollup-3bsf45s, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63793 (Have tidy ensure that we document all `unsafe` blocks in libcore)
 - #64696 ([rustdoc] add sub settings)
 - #65916 (syntax: move stuff around)
 - #66087 (Update some build-pass ui tests to use check-pass where applicable)
 - #66182 (invalid_value lint: fix help text)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/parse/parser/attr.rs')
-rw-r--r--src/libsyntax/parse/parser/attr.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser/attr.rs b/src/libsyntax/parse/parser/attr.rs
index 1c292661f24..31f0a02a483 100644
--- a/src/libsyntax/parse/parser/attr.rs
+++ b/src/libsyntax/parse/parser/attr.rs
@@ -1,10 +1,14 @@
-use super::{SeqSep, PResult, Parser, TokenType, PathStyle};
+use super::{SeqSep, Parser, TokenType, PathStyle};
 use crate::attr;
 use crate::ast;
-use crate::parse::token::{self, Nonterminal, DelimToken};
+use crate::util::comments;
+use crate::token::{self, Nonterminal, DelimToken};
 use crate::tokenstream::{TokenStream, TokenTree};
 use crate::source_map::Span;
 
+use syntax_pos::Symbol;
+use errors::PResult;
+
 use log::debug;
 
 #[derive(Debug)]
@@ -43,7 +47,7 @@ impl<'a> Parser<'a> {
                     just_parsed_doc_comment = false;
                 }
                 token::DocComment(s) => {
-                    let attr = attr::mk_doc_comment(s, self.token.span);
+                    let attr = self.mk_doc_comment(s);
                     if attr.style != ast::AttrStyle::Outer {
                         let mut err = self.fatal("expected outer doc comment");
                         err.note("inner doc comments like this (starting with \
@@ -60,6 +64,11 @@ impl<'a> Parser<'a> {
         Ok(attrs)
     }
 
+    fn mk_doc_comment(&self, s: Symbol) -> ast::Attribute {
+        let style = comments::doc_comment_style(&s.as_str());
+        attr::mk_doc_comment(style, s, self.token.span)
+    }
+
     /// Matches `attribute = # ! [ meta_item ]`.
     ///
     /// If `permit_inner` is `true`, then a leading `!` indicates an inner
@@ -228,7 +237,7 @@ impl<'a> Parser<'a> {
                 }
                 token::DocComment(s) => {
                     // We need to get the position of this token before we bump.
-                    let attr = attr::mk_doc_comment(s, self.token.span);
+                    let attr = self.mk_doc_comment(s);
                     if attr.style == ast::AttrStyle::Inner {
                         attrs.push(attr);
                         self.bump();