Skip to content

Commit 6556bcb

Browse files
committed
Update recursion_limit to use the attribute template
1 parent eae626e commit 6556bcb

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/attributes/limits.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ r[attributes.limits.recursion_limit]
77
## The `recursion_limit` attribute
88

99
r[attributes.limits.recursion_limit.intro]
10-
The *`recursion_limit` attribute* may be applied at the [crate] level to set the maximum depth for potentially infinitely-recursive compile-time operations like macro expansion or auto-dereference.
10+
The *`recursion_limit` [attribute][attributes]* sets the maximum depth for potentially infinitely-recursive compile-time operations like macro expansion or auto-dereference.
1111

1212
> [!EXAMPLE]
1313
> ```rust,compile_fail
@@ -37,7 +37,19 @@ The *`recursion_limit` attribute* may be applied at the [crate] level to set the
3737
> The default recursion limit in `rustc` is 128.
3838
3939
r[attributes.limits.recursion_limit.syntax]
40-
It uses the [MetaNameValueStr] syntax to specify the recursion depth.
40+
The `recursion_limit` attribute uses the [MetaNameValueStr] syntax to specify the recursion depth. The value in the string must be a non-negative integer.
41+
42+
r[attributes.limits.recursion_limit.allowed-positions]
43+
The `recursion_limit` attribute may only be applied to the crate root.
44+
45+
> [!NOTE]
46+
> `rustc` currently warns in other positions, but this may be rejected in the future.
47+
48+
r[attributes.limits.recursion_limit.duplicates]
49+
Only the first instance of `recursion_limit` on an item is honored. Subsequent `recursion_limit` attributes are ignored.
50+
51+
> [!NOTE]
52+
> `rustc` currently warns on following duplicate `recursion_limit` attributes. This may become an error in the future.
4153
4254
r[attributes.limits.type_length_limit]
4355
## The `type_length_limit` attribute

0 commit comments

Comments
 (0)