@@ -644,7 +644,8 @@ class _:
644644 An inline assembly expression. For example:
645645 ```rust
646646 unsafe {
647- builtin # asm(_);
647+ #[inline(always)]
648+ builtin # asm("cmp {0}, {1}", in(reg) a, in(reg) b);
648649 }
649650 ```
650651 """
@@ -1135,8 +1136,13 @@ class _:
11351136
11361137 For example:
11371138 ```rust
1138- for <'a> fn(&'a str)
1139- // ^^^^^
1139+ fn foo<T>(value: T)
1140+ where
1141+ T: for<'a> Fn(&'a str) -> &'a str
1142+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1143+ {
1144+ // ...
1145+ }
11401146 ```
11411147 """
11421148
@@ -1311,8 +1317,8 @@ class _:
13111317
13121318 For example:
13131319 ```rust
1314- Foo <'a>
1315- // ^^
1320+ let text: Text <'a>;
1321+ // ^^
13161322 ```
13171323 """
13181324
@@ -1399,6 +1405,9 @@ class _:
13991405
14001406 For example:
14011407 ```rust
1408+ macro_rules! macro_type {
1409+ () => { i32 };
1410+ }
14021411 type T = macro_type!();
14031412 // ^^^^^^^^^^^^^
14041413 ```
@@ -1445,8 +1454,13 @@ class _:
14451454
14461455 For example:
14471456 ```rust
1448- #[cfg(feature = "foo")]
1449- // ^^^^^^^^^^^^^^^
1457+ #[unsafe(lint::name = "reason_for_bypass")]
1458+ //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1459+ #[deprecated(since = "1.2.0", note = "Use bar instead", unsafe=true)]
1460+ //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1461+ fn foo() {
1462+ // ...
1463+ }
14501464 ```
14511465 """
14521466
@@ -1578,8 +1592,8 @@ class _:
15781592 """
15791593 A path referring to a type. For example:
15801594 ```rust
1581- let x: ( i32) ;
1582- // ^^^
1595+ type X = std::collections::HashMap<i32, i32> ;
1596+ type Y = X::Item;
15831597 ```
15841598 """
15851599
@@ -2219,8 +2233,14 @@ class _:
22192233
22202234 For example:
22212235 ```rust
2236+ macro_rules! my_macro {
2237+ () => {
2238+ Ok(_)
2239+ };
2240+ }
22222241 match x {
22232242 my_macro!() => "matched",
2243+ // ^^^^^^^^^^^
22242244 _ => "not matched",
22252245 }
22262246 ```
@@ -2243,12 +2263,13 @@ class _:
22432263@annotate (AsmDirSpec )
22442264class _ :
22452265 """
2246- An inline assembly directive specification .
2266+ An inline assembly direction specifier .
22472267
22482268 For example:
22492269 ```rust
2250- asm!("nop");
2251- // ^^^^^
2270+ use core::arch::asm;
2271+ asm!("mov {input:x}, {input:x}", output = out(reg) x, input = in(reg) y);
2272+ // ^^^ ^^
22522273 ```
22532274 """
22542275
@@ -2260,6 +2281,7 @@ class _:
22602281
22612282 For example:
22622283 ```rust
2284+ use core::arch::asm;
22632285 asm!("mov {0}, {1}", out(reg) x, in(reg) y);
22642286 // ^ ^
22652287 ```
@@ -2273,6 +2295,7 @@ class _:
22732295
22742296 For example:
22752297 ```rust
2298+ use core::arch::asm;
22762299 asm!("", options(nostack, nomem));
22772300 // ^^^^^^^^^^^^^^^^
22782301 ```
@@ -2286,8 +2309,9 @@ class _:
22862309
22872310 For example:
22882311 ```rust
2289- asm!("mov {0}, {1}", out("eax") x, in("ebx") y);
2290- // ^^^ ^^^
2312+ use core::arch::asm;
2313+ asm!("mov {0}, {1}", out("eax") x, in(EBX) y);
2314+ // ^^^ ^^^
22912315 ```
22922316 """
22932317
@@ -2299,6 +2323,7 @@ class _:
22992323
23002324 For example:
23012325 ```rust
2326+ use core::arch::asm;
23022327 asm!("", clobber_abi("C"));
23032328 // ^^^^^^^^^^^^^^^^
23042329 ```
@@ -2312,6 +2337,7 @@ class _:
23122337
23132338 For example:
23142339 ```rust
2340+ use core::arch::asm;
23152341 asm!("mov eax, {const}", const 42);
23162342 // ^^^^^^^
23172343 ```
@@ -2325,8 +2351,12 @@ class _:
23252351
23262352 For example:
23272353 ```rust
2328- asm!("jmp {label}", label = sym my_label);
2329- // ^^^^^^^^^^^^^^^^^^^^^^
2354+ use core::arch::asm;
2355+ asm!(
2356+ "jmp {}",
2357+ label { println!("Jumped from asm!"); }
2358+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2359+ );
23302360 ```
23312361 """
23322362
@@ -2338,8 +2368,9 @@ class _:
23382368
23392369 For example:
23402370 ```rust
2341- asm!("mov {out}, {in}", out = out(reg) x, in = in(reg) y);
2342- // ^^^^^ ^^^^
2371+ use core::arch::asm;
2372+ asm!("mov {0:x}, {input:x}", out(reg) x, input = in(reg) y);
2373+ // ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
23432374 ```
23442375 """
23452376
@@ -2351,6 +2382,7 @@ class _:
23512382
23522383 For example:
23532384 ```rust
2385+ use core::arch::asm;
23542386 asm!("", options(nostack, nomem));
23552387 // ^^^^^^^^^^^^^^^^
23562388 ```
@@ -2364,6 +2396,7 @@ class _:
23642396
23652397 For example:
23662398 ```rust
2399+ use core::arch::asm;
23672400 asm!("mov {0}, {1}", out(reg) x, in(reg) y);
23682401 // ^ ^
23692402 ```
@@ -2377,6 +2410,7 @@ class _:
23772410
23782411 For example:
23792412 ```rust
2413+ use core::arch::asm;
23802414 asm!("call {sym}", sym = sym my_function);
23812415 // ^^^^^^^^^^^^^^^^^^^^^^
23822416 ```
0 commit comments