about summary refs log tree commit diff
path: root/tests/ui/parser/attribute-on-empty.rs
blob: 5932377f73eca2b5bafbb82d408bbe722fceeb96 (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
25
26
27
28
29
//! Regression test for: <https://github.com/rust-lang/rust/issues/144132>
//!                      <https://github.com/rust-lang/rust/issues/135017>

struct Baz<const N: usize>(i32);

fn main() {
    let _: Baz<#[cfg(any())]> = todo!();
    //~^ ERROR attributes cannot be applied here
}

fn f(_param: #[attr]) {}
//~^ ERROR attributes cannot be applied to a function parameter's type
//~| ERROR expected type, found `)`

fn g() -> #[attr] { 0 }
//~^ ERROR attributes cannot be applied here

struct S {
    field: #[attr],
    //~^ ERROR attributes cannot be applied here
    field1: (#[attr], i32),
    //~^ ERROR attributes cannot be applied here
}

type Tuple = (#[attr], String);
//~^ ERROR attributes cannot be applied here

impl #[attr] {}
//~^ ERROR attributes cannot be applied here