diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-22 12:18:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-22 12:18:34 +0200 |
| commit | 372d37b106f4385e28eeeffb60bdfc666ef9f59d (patch) | |
| tree | 8416ff6e34f75d26d5a99780fcf855a84dd88c86 /src/librustc_parse | |
| parent | 7b1ce6e98ddb97bc70281a6dbaf3c9b2c938917a (diff) | |
| parent | 038f5b74336f310f495af0c15e4a2b4d0750cfee (diff) | |
Rollup merge of #71214 - GuillaumeGomez:add-error-code-inner-doc-error, r=Dylan-DPC
Add error code for inner doc error r? @Dylan-DPC cc @oli-obk
Diffstat (limited to 'src/librustc_parse')
| -rw-r--r-- | src/librustc_parse/parser/attr.rs | 12 |
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(); } |
