]> git.lizzy.rs Git - rust.git/blob - tests/ui/proc-macro/attr-stmt-expr-rpass.rs
Rollup merge of #106788 - estebank:elaborate_pred_E0599, r=compiler-errors
[rust.git] / tests / ui / proc-macro / attr-stmt-expr-rpass.rs
1 // run-pass
2 // aux-build:attr-stmt-expr-rpass.rs
3
4 #![feature(stmt_expr_attributes, proc_macro_hygiene)]
5
6 extern crate attr_stmt_expr_rpass as attr_stmt_expr;
7 use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr,
8                      no_output, noop};
9
10 fn print_str(string: &'static str) {
11     // macros are handled a bit differently
12     #[expect_print_expr]
13     println!("{}", string)
14 }
15
16 fn main() {
17     #[expect_let]
18     let string = "Hello, world!";
19
20     #[expect_print_stmt]
21     println!("{}", string);
22
23     let _: () = {
24         #[no_output]
25         "Hello, world!"
26     };
27
28     let _: &'static str = #[noop] "Hello, world!";
29
30     let _: &'static str = {
31         #[noop] "Hello, world!"
32     };
33
34     #[expect_expr]
35     print_str("string")
36 }