diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2021-07-02 11:30:20 -0500 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2021-07-02 11:47:26 -0500 |
| commit | 5c9bd9c2b4fdca00410209d4c33edc3bebc63444 (patch) | |
| tree | df283d8bd21a2bc33179900018f4cd02f3648193 /compiler/rustc_parse/src/parser | |
| parent | f9fa13f705bb8b1c57c6b6fe95055ec4995a40f0 (diff) | |
| download | rust-5c9bd9c2b4fdca00410209d4c33edc3bebc63444.tar.gz rust-5c9bd9c2b4fdca00410209d4c33edc3bebc63444.zip | |
Recover from a misplaced inner doc comment
Fixes #86781
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 8b050389078..e9f0038b2d6 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -64,7 +64,14 @@ impl<'a> Parser<'a> { } 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 }; |
