Skip to content

Commit

Permalink
Rename pattern_complexity attr as pattern_complexity_limit.
Browse files Browse the repository at this point in the history
For consistency with `recursion_limit`, `move_size_limit`, and
`type_length_limit`.
  • Loading branch information
nnethercote committed Feb 10, 2025
1 parent 1becb2a commit 65caf76
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
"the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite",
),
rustc_attr!(
TEST, pattern_complexity, CrateLevel, template!(NameValueStr: "N"),
TEST, pattern_complexity_limit, CrateLevel, template!(NameValueStr: "N"),
ErrorFollowing, EncodeCrossCrate::No,
),
];
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ declare_features! (
/// Allows using `#[omit_gdb_pretty_printer_section]`.
(internal, omit_gdb_pretty_printer_section, "1.5.0", None),
/// 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.
(internal, pattern_types, "1.79.0", Some(123646)),
/// Allows using `#[prelude_import]` on glob `use` items.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) fn provide(providers: &mut Providers) {
pattern_complexity_limit: get_limit(
tcx.hir().krate_attrs(),
tcx.sess,
sym::pattern_complexity,
sym::pattern_complexity_limit,
Limit::unlimited(),
),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ symbols! {
path_main_separator,
path_to_pathbuf,
pathbuf_as_path,
pattern_complexity,
pattern_complexity_limit,
pattern_parentheses,
pattern_type,
pattern_types,
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9107,8 +9107,8 @@ The tracking issue for this feature is: [#27721]
deny_since: None,
},
Lint {
label: "pattern_complexity",
description: r##"# `pattern_complexity`
label: "pattern_complexity_limit",
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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0658]: the `#[pattern_complexity]` attribute is just used for rustc unit tests and will never be stable
--> $DIR/feature-gate-pattern-complexity.rs:3:1
error[E0658]: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests and will never be stable
--> $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
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
Expand Down
6 changes: 0 additions & 6 deletions tests/ui/feature-gates/feature-gate-pattern-complexity.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/ui/pattern/complexity_limit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(rustc_attrs)]
#![pattern_complexity = "10000"]
#![pattern_complexity_limit = "10000"]

#[derive(Default)]
struct BaseCommand {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(rustc_attrs)]
#![pattern_complexity = "61"]
#![pattern_complexity_limit = "61"]

//@ check-pass
struct BaseCommand {
Expand Down

0 comments on commit 65caf76

Please sign in to comment.