Skip to content

Commit 46ec6be

Browse files
committed
parser::attr: remove .fatal calls
1 parent 85dbbaa commit 46ec6be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_parse/parser/attr.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ impl<'a> Parser<'a> {
4646
token::DocComment(s) => {
4747
let attr = self.mk_doc_comment(s);
4848
if attr.style != ast::AttrStyle::Outer {
49-
let mut err = self.fatal("expected outer doc comment");
49+
let span = self.token.span;
50+
let mut err = self.struct_span_err(span, "expected outer doc comment");
5051
err.note(
5152
"inner doc comments like this (starting with \
5253
`//!` or `/*!`) can only appear before items",
@@ -156,7 +157,8 @@ impl<'a> Parser<'a> {
156157
}
157158
_ => {
158159
let token_str = pprust::token_to_string(&self.token);
159-
return Err(self.fatal(&format!("expected `#`, found `{}`", token_str)));
160+
let msg = &format!("expected `#`, found `{}`", token_str);
161+
return Err(self.struct_span_err(self.token.span, msg));
160162
}
161163
};
162164

0 commit comments

Comments
 (0)