summary refs log tree commit diff
path: root/src/test/ui/proc-macro/attr-stmt-expr.rs
blob: 14a392db4e11835fbfa5704e5c449c79876760c0 (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
// aux-build:attr-stmt-expr.rs

#![feature(proc_macro_hygiene)]

extern crate attr_stmt_expr;
use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr};

fn print_str(string: &'static str) {
    // macros are handled a bit differently
    #[expect_print_expr]
    //~^ ERROR attributes on expressions are experimental
    //~| HELP add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
    println!("{}", string)
}

fn main() {
    #[expect_let]
    let string = "Hello, world!";

    #[expect_print_stmt]
    println!("{}", string);

    #[expect_expr]
    //~^ ERROR attributes on expressions are experimental
    //~| HELP add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
    print_str("string")
}