Skip to content

Commit ee2bd23

Browse files
committed
Update type_length_limit to use the attribute template
1 parent 051af05 commit ee2bd23

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
@@ -44,7 +44,7 @@ r[attributes.limits.type_length_limit]
4444
## The `type_length_limit` attribute
4545

4646
r[attributes.limits.type_length_limit.intro]
47-
The *`type_length_limit` attribute* limits the maximum number of type substitutions made when constructing a concrete type during monomorphization.
47+
The *`type_length_limit` [attribute][attributes]* limits the maximum number of type substitutions made when constructing a concrete type during monomorphization.
4848

4949
> [!NOTE]
5050
> In `rustc` this limit is only enforced when the nightly `-Zenforce-type-length-limit` flag is active.
@@ -67,7 +67,19 @@ The *`type_length_limit` attribute* limits the maximum number of type substituti
6767
> The default in `rustc` is 1048576.
6868
6969
r[attributes.limits.type_length_limit.syntax]
70-
It is applied at the [crate] level, and uses the [MetaNameValueStr] syntax to set the limit based on the number of type substitutions.
70+
The `type_length_limit` attribute uses the [MetaNameValueStr] syntax to set the limit. The value in the string must be a non-negative number.
71+
72+
r[attributes.limits.type_length_limit.allowed-positions]
73+
The `type_length_limit` attribute may only be applied to the crate root.
74+
75+
> [!NOTE]
76+
> `rustc` currently warns in other positions, but this may be rejected in the future.
77+
78+
r[attributes.limits.type_length_limit.duplicates]
79+
Only the first instance of `type_length_limit` on an item is honored. Subsequent `type_length_limit` attributes are ignored.
80+
81+
> [!NOTE]
82+
> `rustc` currently warns on following duplicate `type_length_limit` attributes. This may become an error in the future.
7183
7284
[attributes]: ../attributes.md
7385
[crate]: ../crates-and-source-files.md

0 commit comments

Comments
 (0)