I am really confused

⚓ Rust    📅 2026-03-24    👤 surdeus    👁️ 1      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: I am really confused

if we go to this page

we will see this structure

BlockExpression →
    {
        InnerAttribute*
        Statements?
    }

Statements →
      Statement+
    | Statement+ ExpressionWithoutBlock
    | ExpressionWithoutBlock

but it is impossible to put an attribute such #![allow(unused_variables)] inside a macro like this

macro_rules! show_block {
    ($b:block) => {
        println!("Result: {}", $b);
    };
}

fn main() {
    show_block!({
        #![allow(unused_assignments)]
        
    });
}

are attributes not meant to be used with macros ????

then why is the reference mentioning them ????

BlockExpression →
    {
        InnerAttribute*
        Statements?
    }

it says inner and then statement am i reading it correctly ????

i followed this link

RUST FRAGMENTS

and click on blockexpression

here * block: a BlockExpression

2 posts - 2 participants

Read full topic

🏷️ Rust_feed