]> git.lizzy.rs Git - rust.git/commitdiff
parser::attr: remove .fatal calls
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 31 Dec 2019 00:13:00 +0000 (01:13 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Tue, 31 Dec 2019 03:33:34 +0000 (04:33 +0100)
src/librustc_parse/parser/attr.rs

index d26677a6c32c0ea604bef6177f43bed7f71bbabb..26df4f1c090d65ccc347eef23fdb23d6501b9933 100644 (file)
@@ -46,7 +46,8 @@ pub(super) fn parse_outer_attributes(&mut self) -> PResult<'a, Vec<ast::Attribut
                 token::DocComment(s) => {
                     let attr = self.mk_doc_comment(s);
                     if attr.style != ast::AttrStyle::Outer {
-                        let mut err = self.fatal("expected outer doc comment");
+                        let span = self.token.span;
+                        let mut err = self.struct_span_err(span, "expected outer doc comment");
                         err.note(
                             "inner doc comments like this (starting with \
                                   `//!` or `/*!`) can only appear before items",
@@ -156,7 +157,8 @@ fn parse_attribute_with_inner_parse_policy(
             }
             _ => {
                 let token_str = pprust::token_to_string(&self.token);
-                return Err(self.fatal(&format!("expected `#`, found `{}`", token_str)));
+                let msg = &format!("expected `#`, found `{}`", token_str);
+                return Err(self.struct_span_err(self.token.span, msg));
             }
         };