aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/test_data/parser/ok/0045_block_attrs.rs
blob: ed4593759aceda05ded008619d5f370434303f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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<Self>) {
        #![allow(unused_variables)] // this is  `inner_attr` of the block
    }
}