Rust: fix duplicate asm! expressions

This commit is contained in:
Paolo Tranquilli
2025-08-19 14:01:25 +02:00
parent d38459a50a
commit 49bf48eda1
30 changed files with 163 additions and 140 deletions

View File

@@ -1404,17 +1404,25 @@ class _:
"""
@annotate(MacroBlockExpr, replace_bases={AstNode: Expr}, cfg=True)
@rust.doc_test_signature(None)
class _:
class MacroBlockExpr(Expr):
"""
A sequence of statements generated by a `MacroCall`. For example:
```rust
fn main() {
println!("Hello, world!"); // This macro expands into a list of statements
macro_rules! my_macro {
() => {
let mut x = 40;
x += 2;
x
};
}
my_macro!(); // this macro expands to a sequence of statements (and an expression)
```
"""
__cfg__ = True
statements: list[Stmt] | child
tail_expr: optional[Expr] | child
@annotate(MacroTypeRepr)

4
rust/schema/ast.py generated
View File

@@ -399,10 +399,6 @@ class MacroRules(Item, ):
token_tree: optional["TokenTree"] | child
visibility: optional["Visibility"] | child
class MacroBlockExpr(AstNode, ):
tail_expr: optional["Expr"] | child
statements: list["Stmt"] | child
class MacroTypeRepr(TypeRepr, ):
macro_call: optional["MacroCall"] | child