let mut just_parsed_doc_comment = false;
let start_pos = self.token_cursor.num_next_calls;
loop {
- debug!("parse_outer_attributes: self.token={:?}", self.token);
let attr = if self.check(&token::Pound) {
let inner_error_reason = if just_parsed_doc_comment {
"an inner attribute is not permitted following an outer doc comment"
}
self.bump();
just_parsed_doc_comment = true;
- Some(attr::mk_doc_comment(comment_kind, attr_style, data, self.prev_token.span))
+ // Always make an outer attribute - this allows us to recover from a misplaced
+ // inner attribute.
+ Some(attr::mk_doc_comment(
+ comment_kind,
+ ast::AttrStyle::Outer,
+ data,
+ self.prev_token.span,
+ ))
} else {
None
};