2018-03-16 01:20:56 -05:00
|
|
|
// aux-build:attr-stmt-expr.rs
|
|
|
|
|
2018-07-05 20:09:35 -05:00
|
|
|
#![feature(proc_macro_hygiene)]
|
2018-03-16 01:20:56 -05:00
|
|
|
|
|
|
|
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")
|
|
|
|
}
|