Skip to content

Commit 0dd0f9a

Browse files
committed
Rust: add missing AST nodes to annotations.py
1 parent 460984b commit 0dd0f9a

File tree

1 file changed

+230
-44
lines changed

1 file changed

+230
-44
lines changed

rust/schema/annotations.py

Lines changed: 230 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,30 +1344,6 @@ class _:
13441344
macro_call_expansion: optional[AstNode] | child | rust.detach
13451345

13461346

1347-
@annotate(MacroDef)
1348-
class _:
1349-
"""
1350-
A macro definition.
1351-
1352-
For example:
1353-
```rust
1354-
todo!();
1355-
1356-
1357-
```
1358-
"""
1359-
1360-
1361-
@annotate(MacroExpr, cfg=True)
1362-
class _:
1363-
"""
1364-
A MacroExpr. For example:
1365-
```rust
1366-
todo!()
1367-
```
1368-
"""
1369-
1370-
13711347
@annotate(MacroItems)
13721348
@rust.doc_test_signature(None)
13731349
class _:
@@ -1389,16 +1365,6 @@ class _:
13891365
"""
13901366

13911367

1392-
@annotate(MacroPat, cfg=True)
1393-
class _:
1394-
"""
1395-
A MacroPat. For example:
1396-
```rust
1397-
todo!()
1398-
```
1399-
"""
1400-
1401-
14021368
@annotate(MacroRules)
14031369
class _:
14041370
"""
@@ -1551,16 +1517,6 @@ class _:
15511517
type_repr: drop
15521518

15531519

1554-
@annotate(ParamList)
1555-
class _:
1556-
"""
1557-
A ParamList. For example:
1558-
```rust
1559-
todo!()
1560-
```
1561-
"""
1562-
1563-
15641520
@annotate(ParenExpr)
15651521
class _:
15661522
"""
@@ -2226,3 +2182,233 @@ class FormatArgument(Locatable):
22262182
"""
22272183
parent: Format
22282184
variable: optional[FormatTemplateVariableAccess] | child
2185+
2186+
2187+
@annotate(MacroDef)
2188+
class _:
2189+
"""
2190+
A macro definition using the `macro_rules!` or similar syntax.
2191+
2192+
For example:
2193+
```rust
2194+
macro_rules! my_macro {
2195+
() => {
2196+
println!("This is a macro!");
2197+
};
2198+
}
2199+
```
2200+
"""
2201+
2202+
2203+
@annotate(MacroExpr, cfg=True)
2204+
class _:
2205+
"""
2206+
A macro expression, representing the invocation of a macro that produces an expression.
2207+
2208+
For example:
2209+
```rust
2210+
let y = vec![1, 2, 3];
2211+
```
2212+
"""
2213+
2214+
2215+
@annotate(MacroPat, cfg=True)
2216+
class _:
2217+
"""
2218+
A macro pattern, representing the invocation of a macro that produces a pattern.
2219+
2220+
For example:
2221+
```rust
2222+
match x {
2223+
my_macro!() => "matched",
2224+
_ => "not matched",
2225+
}
2226+
```
2227+
"""
2228+
2229+
2230+
@annotate(ParamList)
2231+
class _:
2232+
"""
2233+
A list of parameters in a function, method, or closure declaration.
2234+
2235+
For example:
2236+
```rust
2237+
fn foo(x: i32, y: i32) {}
2238+
// ^^^^^^^^^^^^^
2239+
```
2240+
"""
2241+
2242+
2243+
@annotate(AsmDirSpec)
2244+
class _:
2245+
"""
2246+
An inline assembly directive specification.
2247+
2248+
For example:
2249+
```rust
2250+
asm!("nop");
2251+
// ^^^^^
2252+
```
2253+
"""
2254+
2255+
2256+
@annotate(AsmOperandExpr)
2257+
class _:
2258+
"""
2259+
An operand expression in an inline assembly block.
2260+
2261+
For example:
2262+
```rust
2263+
asm!("mov {0}, {1}", out(reg) x, in(reg) y);
2264+
// ^ ^
2265+
```
2266+
"""
2267+
2268+
2269+
@annotate(AsmOption)
2270+
class _:
2271+
"""
2272+
An option in an inline assembly block.
2273+
2274+
For example:
2275+
```rust
2276+
asm!("", options(nostack, nomem));
2277+
// ^^^^^^^^^^^^^^^^
2278+
```
2279+
"""
2280+
2281+
2282+
@annotate(AsmRegSpec)
2283+
class _:
2284+
"""
2285+
A register specification in an inline assembly block.
2286+
2287+
For example:
2288+
```rust
2289+
asm!("mov {0}, {1}", out("eax") x, in("ebx") y);
2290+
// ^^^ ^^^
2291+
```
2292+
"""
2293+
2294+
2295+
@annotate(AsmClobberAbi)
2296+
class _:
2297+
"""
2298+
A clobbered ABI in an inline assembly block.
2299+
2300+
For example:
2301+
```rust
2302+
asm!("", clobber_abi("C"));
2303+
// ^^^^^^^^^^^^^^^^
2304+
```
2305+
"""
2306+
2307+
2308+
@annotate(AsmConst)
2309+
class _:
2310+
"""
2311+
A constant operand in an inline assembly block.
2312+
2313+
For example:
2314+
```rust
2315+
asm!("mov eax, {const}", const 42);
2316+
// ^^^^^^^
2317+
```
2318+
"""
2319+
2320+
2321+
@annotate(AsmLabel)
2322+
class _:
2323+
"""
2324+
A label in an inline assembly block.
2325+
2326+
For example:
2327+
```rust
2328+
asm!("jmp {label}", label = sym my_label);
2329+
// ^^^^^^^^^^^^^^^^^^^^^^
2330+
```
2331+
"""
2332+
2333+
2334+
@annotate(AsmOperandNamed)
2335+
class _:
2336+
"""
2337+
A named operand in an inline assembly block.
2338+
2339+
For example:
2340+
```rust
2341+
asm!("mov {out}, {in}", out = out(reg) x, in = in(reg) y);
2342+
// ^^^^^ ^^^^
2343+
```
2344+
"""
2345+
2346+
2347+
@annotate(AsmOptionsList)
2348+
class _:
2349+
"""
2350+
A list of options in an inline assembly block.
2351+
2352+
For example:
2353+
```rust
2354+
asm!("", options(nostack, nomem));
2355+
// ^^^^^^^^^^^^^^^^
2356+
```
2357+
"""
2358+
2359+
2360+
@annotate(AsmRegOperand)
2361+
class _:
2362+
"""
2363+
A register operand in an inline assembly block.
2364+
2365+
For example:
2366+
```rust
2367+
asm!("mov {0}, {1}", out(reg) x, in(reg) y);
2368+
// ^ ^
2369+
```
2370+
"""
2371+
2372+
2373+
@annotate(AsmSym)
2374+
class _:
2375+
"""
2376+
A symbol operand in an inline assembly block.
2377+
2378+
For example:
2379+
```rust
2380+
asm!("call {sym}", sym = sym my_function);
2381+
// ^^^^^^^^^^^^^^^^^^^^^^
2382+
```
2383+
"""
2384+
2385+
2386+
@annotate(UseBoundGenericArgs)
2387+
class _:
2388+
"""
2389+
A use<..> bound to control which generic parameters are captured by an impl Trait return type.
2390+
2391+
For example:
2392+
```rust
2393+
pub fn hello<'a, T, const N: usize>() -> impl Sized + use<'a, T, N> {}
2394+
// ^^^^^^^^
2395+
```
2396+
"""
2397+
2398+
2399+
@annotate(ParenthesizedArgList)
2400+
class _:
2401+
"""
2402+
A parenthesized argument list as used in function traits.
2403+
2404+
For example:
2405+
```rust
2406+
fn call_with_42<F>(f: F) -> i32
2407+
where
2408+
F: Fn(i32, String) -> i32,
2409+
// ^^^^^^^^^^^
2410+
{
2411+
f(42, "Don't panic".to_string())
2412+
}
2413+
```
2414+
"""

0 commit comments

Comments
 (0)