1
Fork 0

Rename pattern_complexity attr as pattern_complexity_limit.

For consistency with `recursion_limit`, `move_size_limit`, and
`type_length_limit`.
This commit is contained in:
Nicholas Nethercote 2025-02-07 15:58:00 +11:00
parent 223c95fd59
commit 7a8c0fc117
10 changed files with 18 additions and 18 deletions

View file

@ -1149,7 +1149,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
"the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite", "the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite",
), ),
rustc_attr!( rustc_attr!(
TEST, pattern_complexity, CrateLevel, template!(NameValueStr: "N"), TEST, pattern_complexity_limit, CrateLevel, template!(NameValueStr: "N"),
ErrorFollowing, EncodeCrossCrate::No, ErrorFollowing, EncodeCrossCrate::No,
), ),
]; ];

View file

@ -227,7 +227,7 @@ declare_features! (
/// Allows using `#[omit_gdb_pretty_printer_section]`. /// Allows using `#[omit_gdb_pretty_printer_section]`.
(internal, omit_gdb_pretty_printer_section, "1.5.0", None), (internal, omit_gdb_pretty_printer_section, "1.5.0", None),
/// Set the maximum pattern complexity allowed (not limited by default). /// Set the maximum pattern complexity allowed (not limited by default).
(internal, pattern_complexity, "1.78.0", None), (internal, pattern_complexity_limit, "1.78.0", None),
/// Allows using pattern types. /// Allows using pattern types.
(internal, pattern_types, "1.79.0", Some(123646)), (internal, pattern_types, "1.79.0", Some(123646)),
/// Allows using `#[prelude_import]` on glob `use` items. /// Allows using `#[prelude_import]` on glob `use` items.

View file

@ -36,7 +36,7 @@ pub(crate) fn provide(providers: &mut Providers) {
pattern_complexity_limit: get_limit( pattern_complexity_limit: get_limit(
tcx.hir().krate_attrs(), tcx.hir().krate_attrs(),
tcx.sess, tcx.sess,
sym::pattern_complexity, sym::pattern_complexity_limit,
Limit::unlimited(), Limit::unlimited(),
), ),
} }

View file

@ -1512,7 +1512,7 @@ symbols! {
path_main_separator, path_main_separator,
path_to_pathbuf, path_to_pathbuf,
pathbuf_as_path, pathbuf_as_path,
pattern_complexity, pattern_complexity_limit,
pattern_parentheses, pattern_parentheses,
pattern_type, pattern_type,
pattern_types, pattern_types,

View file

@ -9107,8 +9107,8 @@ The tracking issue for this feature is: [#27721]
deny_since: None, deny_since: None,
}, },
Lint { Lint {
label: "pattern_complexity", label: "pattern_complexity_limit",
description: r##"# `pattern_complexity` description: r##"# `pattern_complexity_limit`
This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use. This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.

View file

@ -0,0 +1,6 @@
// check that `pattern_complexity_limit` is feature-gated
#![pattern_complexity_limit = "42"]
//~^ ERROR: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests
fn main() {}

View file

@ -1,8 +1,8 @@
error[E0658]: the `#[pattern_complexity]` attribute is just used for rustc unit tests and will never be stable error[E0658]: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests and will never be stable
--> $DIR/feature-gate-pattern-complexity.rs:3:1 --> $DIR/feature-gate-pattern-complexity-limit.rs:3:1
| |
LL | #![pattern_complexity = "42"] LL | #![pattern_complexity_limit = "42"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

View file

@ -1,6 +0,0 @@
// check that `pattern_complexity` is feature-gated
#![pattern_complexity = "42"]
//~^ ERROR: the `#[pattern_complexity]` attribute is just used for rustc unit tests
fn main() {}

View file

@ -1,5 +1,5 @@
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![pattern_complexity = "10000"] #![pattern_complexity_limit = "10000"]
#[derive(Default)] #[derive(Default)]
struct BaseCommand { struct BaseCommand {

View file

@ -1,5 +1,5 @@
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![pattern_complexity = "61"] #![pattern_complexity_limit = "61"]
//@ check-pass //@ check-pass
struct BaseCommand { struct BaseCommand {