diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2024-08-24 21:03:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-24 21:03:31 -0500 |
| commit | dfe7d5c31e51d61c866a294393e4d839d4b42131 (patch) | |
| tree | 7cabef644fc4e793ed5ad954170e922ae7ddd167 /compiler/rustc_parse/src/parser/stmt.rs | |
| parent | 00308920aec0795e9de1a3f80324ac93b502a483 (diff) | |
| parent | 22aa104bce457e7d70b05d7a32cdf09f25ac06b1 (diff) | |
| download | rust-dfe7d5c31e51d61c866a294393e4d839d4b42131.tar.gz rust-dfe7d5c31e51d61c866a294393e4d839d4b42131.zip | |
Rollup merge of #128524 - chenyukang:yukang-fix-127930-invalid-outer-style-sugg, r=cjgillot
Don't suggest turning crate-level attributes into outer style Fixes #127930
Diffstat (limited to 'compiler/rustc_parse/src/parser/stmt.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 69044192780..26ad39e06cd 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -459,11 +459,16 @@ impl<'a> Parser<'a> { pub fn parse_block(&mut self) -> PResult<'a, P<Block>> { let (attrs, block) = self.parse_inner_attrs_and_block()?; if let [.., last] = &*attrs { + let suggest_to_outer = match &last.kind { + ast::AttrKind::Normal(attr) => attr.item.is_valid_for_outer_style(), + _ => false, + }; self.error_on_forbidden_inner_attr( last.span, super::attr::InnerAttrPolicy::Forbidden(Some( InnerAttrForbiddenReason::InCodeBlock, )), + suggest_to_outer, ); } Ok(block) |
