From 5f89a60f1a0feab1e2e0dd37e642877552675da4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 19 Apr 2021 17:11:49 +0300 Subject: fix: false positive about inner attrs in docs closes #8541 --- .../syntax/test_data/parser/ok/0045_block_attrs.rs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 crates/syntax/test_data/parser/ok/0045_block_attrs.rs (limited to 'crates/syntax/test_data/parser/ok/0045_block_attrs.rs') diff --git a/crates/syntax/test_data/parser/ok/0045_block_attrs.rs b/crates/syntax/test_data/parser/ok/0045_block_attrs.rs new file mode 100644 index 000000000..ed4593759 --- /dev/null +++ b/crates/syntax/test_data/parser/ok/0045_block_attrs.rs @@ -0,0 +1,24 @@ +fn inner() { + #![doc("Inner attributes allowed here")] + //! As are ModuleDoc style comments + { + #![doc("Inner attributes are allowed in blocks used as statements")] + #![doc("Being validated is not affected by duplcates")] + //! As are ModuleDoc style comments + }; + { + #![doc("Inner attributes are allowed in blocks when they are the last statement of another block")] + //! As are ModuleDoc style comments + } +} + +fn outer() { + let _ = #[doc("Outer attributes are always allowed")] {}; +} + +// https://github.com/rust-analyzer/rust-analyzer/issues/689 +impl Whatever { + fn salsa_event(&self, event_fn: impl Fn() -> Event) { + #![allow(unused_variables)] // this is `inner_attr` of the block + } +} -- cgit v1.2.3