File tree Expand file tree Collapse file tree
src/doc/unstable-book/src/language-features Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,18 +6,22 @@ The tracking issue for this feature is: [#156874]
66
77------
88
9+ <!--
10+ FIXME(#159429): temporarily renamed `#[unroll]` to mitigate a nameres ambiguity
11+ -->
12+
913Loop unrolling can be a powerful optimization but like inlining, it is sometimes useful to
1014manually provide hints to optimizations.
1115
12- ` #[unroll ] ` will encourage unrolling of a loop.
16+ ` #[rustc_unroll ] ` will encourage unrolling of a loop.
1317
14- ` #[unroll (full)] ` is a stronger hint and can cause optimizations to completely ignore the code
18+ ` #[rustc_unroll (full)] ` is a stronger hint and can cause optimizations to completely ignore the code
1519side growth from repeating a loop body.
1620
17- ` #[unroll (never)] ` is a strong hint to not unroll the loop at all. Note that other loop
21+ ` #[rustc_unroll (never)] ` is a strong hint to not unroll the loop at all. Note that other loop
1822optimizations may still be applied.
1923
20- ` #[unroll (N)] ` is a hint to unroll ` N ` iterations of the loop.
24+ ` #[rustc_unroll (N)] ` is a hint to unroll ` N ` iterations of the loop.
2125
2226In all cases these are just hints and may be ignored. But unlike function inlining hints,
2327loops tend to be heavily modified during compilation, which can make obeying hints challenging.
You can’t perform that action at this time.
0 commit comments