Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document type_length_limit. #546

Merged
merged 3 commits into from
Mar 19, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/attributes/limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ The following [attributes] affect compile-time limits.

## The `recursion_limit` attribute

The *`recursion_limit` attribute* may be applied at the crate level to set the
The *`recursion_limit` attribute* may be applied at the [crate] level to set the
maximum depth for potentially infinitely-recursive compile-time operations
like auto-dereference or macro expansion. It uses the [_MetaNameValueStr_]
Centril marked this conversation as resolved.
Show resolved Hide resolved
Centril marked this conversation as resolved.
Show resolved Hide resolved
syntax to specify the recursion depth. The default is 64.
syntax to specify the recursion depth.

> Note: The default in `rustc` is 64.

```rust,ignore
#![recursion_limit = "4"]
Expand All @@ -26,10 +28,12 @@ a!{}

## The `type_length_limit` attribute

The *`type_length_limit` attribute* limits the maximum size of a type
constructed during monomorphization. It is applied at the crate level, and
uses the [_MetaNameValueStr_] syntax to set the limit based on the number of
type substitutions within the type. The default value is 1048576.
The *`type_length_limit` attribute* limits the maximum number of type
substitutions made when constructing a concrete type during monomorphization.
It is applied at the [crate] level, and uses the [_MetaNameValueStr_] syntax
to set the limit based on the number of type substitutions.

> Note: The default in `rustc` is 1048576.

```rust,ignore
#![type_length_limit = "8"]
Expand All @@ -44,5 +48,6 @@ struct C;
drop::<Option<A>>(None);
Centril marked this conversation as resolved.
Show resolved Hide resolved
```

[attributes]: attributes.html
[_MetaNameValueStr_]: attributes.html#meta-item-attribute-syntax
[attributes]: attributes.html
[crate]: crates-and-source-files.html