05-限制
1分钟内可阅读完
译文 · 基于 The Rust Reference
原文链接: https://doc.rust-lang.org/reference/attributes/limits.html
r[attributes.limits]
限制
下列属性影响编译期限制。
r[attributes.limits.recursion_limit]
recursion_limit 属性
r[attributes.limits.recursion_limit.intro]
recursion_limit 属性可应用于 crate 级别,以设置可能无限递归的编译期操作(如宏展开或自动解引用)的最大深度。
r[attributes.limits.recursion_limit.syntax] 它使用 [MetaNameValueStr] 语法来指定递归深度。
注意
rustc中的默认值为 128。
| |
| |
r[attributes.limits.type_length_limit]
type_length_limit 属性
r[attributes.limits.type_length_limit.intro]
*type_length_limit 属性*设置在单态化期间构造具体类型时允许的最大类型替换次数。
注意 仅当启用 nightly 的
-Zenforce-type-length-limit标志时,rustc才会强制该限制。更多信息见 Rust PR #127670。
| |
注意
rustc中的默认值为1048576。
r[attributes.limits.type_length_limit.syntax]
type_length_limit 属性使用 [MetaNameValueStr] 语法。字符串中的值必须是非负数字。
r[attributes.limits.type_length_limit.allowed-positions]
type_length_limit 属性只能应用于 crate 根。
注意
rustc会忽略其他位置上的使用,但会对其发出 lint。将来这可能变成错误。
r[attributes.limits.type_length_limit.duplicates]
对同一项多次使用 type_length_limit 时,仅第一次生效。
注意
rustc会对第一次之后的使用发出 lint。将来这可能变成错误。