about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-04-22 11:08:50 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-04-22 11:08:50 +0200
commit3390ff97b22e082bb553cc0f175ae5ca18bd5e60 (patch)
tree01761c04aa67f97140bae68bb709483f1ab3ba24 /src/librustc_parse/parser
parent2dc5b602eee35d70e8e6e506a7ea07b6c7e0197d (diff)
downloadrust-3390ff97b22e082bb553cc0f175ae5ca18bd5e60.tar.gz
rust-3390ff97b22e082bb553cc0f175ae5ca18bd5e60.zip
Add error code to inner doc comment attribute error
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/attr.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs
index b56dd30739d..803f14a2a22 100644
--- a/src/librustc_parse/parser/attr.rs
+++ b/src/librustc_parse/parser/attr.rs
@@ -4,7 +4,7 @@ use rustc_ast::attr;
 use rustc_ast::token::{self, Nonterminal};
 use rustc_ast::util::comments;
 use rustc_ast_pretty::pprust;
-use rustc_errors::PResult;
+use rustc_errors::{error_code, PResult};
 use rustc_span::{Span, Symbol};
 
 use log::debug;
@@ -50,10 +50,16 @@ impl<'a> Parser<'a> {
             } else if let token::DocComment(s) = self.token.kind {
                 let attr = self.mk_doc_comment(s);
                 if attr.style != ast::AttrStyle::Outer {
-                    self.struct_span_err(self.token.span, "expected outer doc comment")
+                    self.sess
+                        .span_diagnostic
+                        .struct_span_err_with_code(
+                            self.token.span,
+                            "expected outer doc comment",
+                            error_code!(E0753),
+                        )
                         .note(
                             "inner doc comments like this (starting with \
-                              `//!` or `/*!`) can only appear before items",
+                             `//!` or `/*!`) can only appear before items",
                         )
                         .emit();
                 }