2018-03-15 23:20:56 -07:00
|
|
|
//! Attributes producing expressions in invalid locations
|
|
|
|
|
|
2024-11-24 17:37:25 -08:00
|
|
|
//@ proc-macro: attr-stmt-expr.rs
|
2025-09-26 13:59:06 +02:00
|
|
|
//@ ignore-backends: gcc
|
2020-02-01 01:02:31 +03:00
|
|
|
|
|
|
|
|
#![feature(proc_macro_hygiene)]
|
|
|
|
|
#![feature(stmt_expr_attributes)]
|
2018-03-15 23:20:56 -07:00
|
|
|
|
|
|
|
|
extern crate attr_stmt_expr;
|
|
|
|
|
use attr_stmt_expr::{duplicate, no_output};
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let _ = #[no_output] "Hello, world!";
|
2019-05-21 17:47:23 -07:00
|
|
|
//~^ ERROR expected expression, found end of macro arguments
|
2018-03-15 23:20:56 -07:00
|
|
|
|
|
|
|
|
let _ = #[duplicate] "Hello, world!";
|
2024-04-17 17:08:58 +10:00
|
|
|
//~^ ERROR macro expansion ignores `,` and any tokens following
|
2018-03-15 23:20:56 -07:00
|
|
|
|
|
|
|
|
let _ = {
|
|
|
|
|
#[no_output]
|
|
|
|
|
"Hello, world!"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let _ = {
|
|
|
|
|
#[duplicate]
|
2024-04-17 17:08:58 +10:00
|
|
|
//~^ ERROR macro expansion ignores `,` and any tokens following
|
2018-03-15 23:20:56 -07:00
|
|
|
"Hello, world!"
|
|
|
|
|
};
|
|
|
|
|
}
|