1
Fork 0

Rename core_pattern_type and core_pattern_types lib feature gates to pattern_type_macro

That's what the gates are actually gating, and the single char difference in naming was not helpful either
This commit is contained in:
Oli Scherer 2024-12-04 16:01:31 +00:00
parent 96e51d9482
commit f613636ae8
31 changed files with 53 additions and 74 deletions

View file

@ -345,7 +345,7 @@ pub mod net;
pub mod option; pub mod option;
pub mod panic; pub mod panic;
pub mod panicking; pub mod panicking;
#[unstable(feature = "core_pattern_types", issue = "123646")] #[unstable(feature = "pattern_type_macro", issue = "123646")]
pub mod pat; pub mod pat;
pub mod pin; pub mod pin;
#[unstable(feature = "random", issue = "130703")] #[unstable(feature = "random", issue = "130703")]

View file

@ -6,7 +6,7 @@
/// ``` /// ```
#[macro_export] #[macro_export]
#[rustc_builtin_macro(pattern_type)] #[rustc_builtin_macro(pattern_type)]
#[unstable(feature = "core_pattern_type", issue = "123646")] #[unstable(feature = "pattern_type_macro", issue = "123646")]
macro_rules! pattern_type { macro_rules! pattern_type {
($($arg:tt)*) => { ($($arg:tt)*) => {
/* compiler built-in */ /* compiler built-in */

View file

@ -589,7 +589,7 @@ pub mod net;
pub mod num; pub mod num;
pub mod os; pub mod os;
pub mod panic; pub mod panic;
#[unstable(feature = "core_pattern_types", issue = "123646")] #[unstable(feature = "pattern_type_macro", issue = "123646")]
pub mod pat; pub mod pat;
pub mod path; pub mod path;
#[unstable(feature = "anonymous_pipe", issue = "127154")] #[unstable(feature = "anonymous_pipe", issue = "127154")]

View file

@ -3936,17 +3936,8 @@ The tracking issue for this feature is: [#117693]
"##, "##,
}, },
Lint { Lint {
label: "core_pattern_type", label: "pattern_type_macro",
description: r##"# `core_pattern_type` description: r##"# `pattern_type_macro`
This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use.
------------------------
"##,
},
Lint {
label: "core_pattern_types",
description: r##"# `core_pattern_types`
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

@ -4,8 +4,7 @@
//@ compile-flags: -Csymbol-mangling-version=v0 -Copt-level=0 --crate-type=lib //@ compile-flags: -Csymbol-mangling-version=v0 -Copt-level=0 --crate-type=lib
#![feature(pattern_types)] #![feature(pattern_types)]
#![feature(core_pattern_types)] #![feature(pattern_type_macro)]
#![feature(core_pattern_type)]
use std::pat::pattern_type; use std::pat::pattern_type;

View file

@ -1,4 +1,4 @@
#![feature(pattern_types, core_pattern_type)] #![feature(pattern_types, pattern_type_macro)]
#![allow(internal_features)] #![allow(internal_features)]
type Pat<const START: u32, const END: u32> = type Pat<const START: u32, const END: u32> =

View file

@ -1,6 +1,5 @@
#![feature(pattern_types)] #![feature(pattern_types)]
#![feature(core_pattern_types)] #![feature(pattern_type_macro)]
#![feature(core_pattern_type)]
use std::pat::pattern_type; use std::pat::pattern_type;

View file

@ -1,5 +1,5 @@
error[E0586]: inclusive range with no end error[E0586]: inclusive range with no end
--> $DIR/bad_pat.rs:7:43 --> $DIR/bad_pat.rs:6:43
| |
LL | type NonNullU32_2 = pattern_type!(u32 is 1..=); LL | type NonNullU32_2 = pattern_type!(u32 is 1..=);
| ^^^ | ^^^
@ -12,7 +12,7 @@ LL + type NonNullU32_2 = pattern_type!(u32 is 1..);
| |
error[E0586]: inclusive range with no end error[E0586]: inclusive range with no end
--> $DIR/bad_pat.rs:9:40 --> $DIR/bad_pat.rs:8:40
| |
LL | type Positive2 = pattern_type!(i32 is 0..=); LL | type Positive2 = pattern_type!(i32 is 0..=);
| ^^^ | ^^^
@ -25,7 +25,7 @@ LL + type Positive2 = pattern_type!(i32 is 0..);
| |
error: wildcard patterns are not permitted for pattern types error: wildcard patterns are not permitted for pattern types
--> $DIR/bad_pat.rs:11:33 --> $DIR/bad_pat.rs:10:33
| |
LL | type Wild = pattern_type!(() is _); LL | type Wild = pattern_type!(() is _);
| ^ | ^

View file

@ -1,8 +1,7 @@
//@ check-pass //@ check-pass
#![feature(pattern_types)] #![feature(pattern_types)]
#![feature(core_pattern_types)] #![feature(pattern_type_macro)]
#![feature(core_pattern_type)]
use std::pat::pattern_type; use std::pat::pattern_type;

View file

@ -1,8 +1,7 @@
//! Check that pattern types don't implement traits of their base automatically //! Check that pattern types don't implement traits of their base automatically
#![feature(pattern_types)] #![feature(pattern_types)]
#![feature(core_pattern_types)] #![feature(pattern_type_macro)]
#![feature(core_pattern_type)]
use std::pat::pattern_type; use std::pat::pattern_type;

View file

@ -1,5 +1,5 @@
error[E0369]: binary operation `==` cannot be applied to type `(i32) is 0..=999999999` error[E0369]: binary operation `==` cannot be applied to type `(i32) is 0..=999999999`
--> $DIR/derives.rs:11:20 --> $DIR/derives.rs:10:20
| |
LL | #[derive(Clone, Copy, PartialEq)] LL | #[derive(Clone, Copy, PartialEq)]
| --------- in this derive macro expansion | --------- in this derive macro expansion

View file

@ -3,12 +3,12 @@
use std::pat::pattern_type; use std::pat::pattern_type;
type NonNullU32 = pattern_type!(u32 is 1..); type NonNullU32 = pattern_type!(u32 is 1..);
//~^ use of unstable library feature `core_pattern_type` //~^ use of unstable library feature `pattern_type_macro`
type Percent = pattern_type!(u32 is 0..=100); type Percent = pattern_type!(u32 is 0..=100);
//~^ use of unstable library feature `core_pattern_type` //~^ use of unstable library feature `pattern_type_macro`
type Negative = pattern_type!(i32 is ..=0); type Negative = pattern_type!(i32 is ..=0);
//~^ use of unstable library feature `core_pattern_type` //~^ use of unstable library feature `pattern_type_macro`
type Positive = pattern_type!(i32 is 0..); type Positive = pattern_type!(i32 is 0..);
//~^ use of unstable library feature `core_pattern_type` //~^ use of unstable library feature `pattern_type_macro`
type Always = pattern_type!(Option<u32> is Some(_)); type Always = pattern_type!(Option<u32> is Some(_));
//~^ use of unstable library feature `core_pattern_type` //~^ use of unstable library feature `pattern_type_macro`

View file

@ -1,51 +1,51 @@
error[E0658]: use of unstable library feature `core_pattern_type` error[E0658]: use of unstable library feature `pattern_type_macro`
--> $DIR/feature-gate-pattern_types.rs:5:19 --> $DIR/feature-gate-pattern_types.rs:5:19
| |
LL | type NonNullU32 = pattern_type!(u32 is 1..); LL | type NonNullU32 = pattern_type!(u32 is 1..);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information = note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information
= help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = help: add `#![feature(pattern_type_macro)]` 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
error[E0658]: use of unstable library feature `core_pattern_type` error[E0658]: use of unstable library feature `pattern_type_macro`
--> $DIR/feature-gate-pattern_types.rs:7:16 --> $DIR/feature-gate-pattern_types.rs:7:16
| |
LL | type Percent = pattern_type!(u32 is 0..=100); LL | type Percent = pattern_type!(u32 is 0..=100);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information = note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information
= help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = help: add `#![feature(pattern_type_macro)]` 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
error[E0658]: use of unstable library feature `core_pattern_type` error[E0658]: use of unstable library feature `pattern_type_macro`
--> $DIR/feature-gate-pattern_types.rs:9:17 --> $DIR/feature-gate-pattern_types.rs:9:17
| |
LL | type Negative = pattern_type!(i32 is ..=0); LL | type Negative = pattern_type!(i32 is ..=0);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information = note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information
= help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = help: add `#![feature(pattern_type_macro)]` 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
error[E0658]: use of unstable library feature `core_pattern_type` error[E0658]: use of unstable library feature `pattern_type_macro`
--> $DIR/feature-gate-pattern_types.rs:11:17 --> $DIR/feature-gate-pattern_types.rs:11:17
| |
LL | type Positive = pattern_type!(i32 is 0..); LL | type Positive = pattern_type!(i32 is 0..);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information = note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information
= help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = help: add `#![feature(pattern_type_macro)]` 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
error[E0658]: use of unstable library feature `core_pattern_type` error[E0658]: use of unstable library feature `pattern_type_macro`
--> $DIR/feature-gate-pattern_types.rs:13:15 --> $DIR/feature-gate-pattern_types.rs:13:15
| |
LL | type Always = pattern_type!(Option<u32> is Some(_)); LL | type Always = pattern_type!(Option<u32> is Some(_));
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information = note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information
= help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = help: add `#![feature(pattern_type_macro)]` 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
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -1,7 +1,7 @@
//@ compile-flags: -Zno-analysis //@ compile-flags: -Zno-analysis
//@ check-pass //@ check-pass
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
use std::pat::pattern_type; use std::pat::pattern_type;

View file

@ -1,4 +1,4 @@
#![feature(core_pattern_type, core_pattern_types)] #![feature(pattern_type_macro)]
use std::pat::pattern_type; use std::pat::pattern_type;

View file

@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)] #![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
//@ normalize-stderr-test: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr-test: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"

View file

@ -37,7 +37,7 @@ error: layout_of(NonZero<u32>) = Layout {
max_repr_align: None, max_repr_align: None,
unadjusted_abi_align: Align(4 bytes), unadjusted_abi_align: Align(4 bytes),
} }
--> $DIR/range_patterns.rs:11:1 --> $DIR/range_patterns.rs:10:1
| |
LL | type X = std::num::NonZeroU32; LL | type X = std::num::NonZeroU32;
| ^^^^^^ | ^^^^^^
@ -74,7 +74,7 @@ error: layout_of((u32) is 1..=) = Layout {
max_repr_align: None, max_repr_align: None,
unadjusted_abi_align: Align(4 bytes), unadjusted_abi_align: Align(4 bytes),
} }
--> $DIR/range_patterns.rs:13:1 --> $DIR/range_patterns.rs:12:1
| |
LL | type Y = pattern_type!(u32 is 1..); LL | type Y = pattern_type!(u32 is 1..);
| ^^^^^^ | ^^^^^^
@ -182,7 +182,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
max_repr_align: None, max_repr_align: None,
unadjusted_abi_align: Align(4 bytes), unadjusted_abi_align: Align(4 bytes),
} }
--> $DIR/range_patterns.rs:15:1 --> $DIR/range_patterns.rs:14:1
| |
LL | type Z = Option<pattern_type!(u32 is 1..)>; LL | type Z = Option<pattern_type!(u32 is 1..)>;
| ^^^^^^ | ^^^^^^
@ -290,7 +290,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
max_repr_align: None, max_repr_align: None,
unadjusted_abi_align: Align(4 bytes), unadjusted_abi_align: Align(4 bytes),
} }
--> $DIR/range_patterns.rs:17:1 --> $DIR/range_patterns.rs:16:1
| |
LL | type A = Option<std::num::NonZeroU32>; LL | type A = Option<std::num::NonZeroU32>;
| ^^^^^^ | ^^^^^^
@ -334,7 +334,7 @@ error: layout_of(NonZeroU32New) = Layout {
max_repr_align: None, max_repr_align: None,
unadjusted_abi_align: Align(4 bytes), unadjusted_abi_align: Align(4 bytes),
} }
--> $DIR/range_patterns.rs:19:1 --> $DIR/range_patterns.rs:18:1
| |
LL | struct NonZeroU32New(pattern_type!(u32 is 1..)); LL | struct NonZeroU32New(pattern_type!(u32 is 1..));
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)] #![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
//! check that pattern types can have traits implemented for them if //! check that pattern types can have traits implemented for them if

View file

@ -1,12 +1,12 @@
error[E0390]: cannot define inherent `impl` for primitive types outside of `core` error[E0390]: cannot define inherent `impl` for primitive types outside of `core`
--> $DIR/range_patterns_inherent_impls.rs:13:1 --> $DIR/range_patterns_inherent_impls.rs:12:1
| |
LL | impl Y { LL | impl Y {
| ^^^^^^ | ^^^^^^
| |
= help: consider moving this inherent impl into `core` if possible = help: consider moving this inherent impl into `core` if possible
help: alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items help: alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items
--> $DIR/range_patterns_inherent_impls.rs:15:5 --> $DIR/range_patterns_inherent_impls.rs:14:5
| |
LL | fn foo() {} LL | fn foo() {}
| ^^^^^^^^ | ^^^^^^^^

View file

@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)] #![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
//! check that pattern types can have local traits //! check that pattern types can have local traits

View file

@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)] #![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
//! check that pattern types can have local traits //! check that pattern types can have local traits

View file

@ -1,5 +1,5 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/range_patterns_trait_impls2.rs:13:1 --> $DIR/range_patterns_trait_impls2.rs:12:1
| |
LL | impl Eq for Y {} LL | impl Eq for Y {}
| ^^^^^^^^^^^^- | ^^^^^^^^^^^^-

View file

@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)] #![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
//! Some practical niche checks. //! Some practical niche checks.

View file

@ -1,5 +1,5 @@
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/range_patterns_unusable.rs:14:35 --> $DIR/range_patterns_unusable.rs:13:35
| |
LL | let _: Option<u32> = unsafe { std::mem::transmute(z) }; LL | let _: Option<u32> = unsafe { std::mem::transmute(z) };
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^

View file

@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)] #![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
//! check that pattern types don't have an `Add` impl. //! check that pattern types don't have an `Add` impl.

View file

@ -1,5 +1,5 @@
error[E0369]: cannot add `u32` to `(u32) is 1..=` error[E0369]: cannot add `u32` to `(u32) is 1..=`
--> $DIR/range_patterns_unusable_math.rs:15:15 --> $DIR/range_patterns_unusable_math.rs:14:15
| |
LL | let x = x + 1_u32; LL | let x = x + 1_u32;
| - ^ ----- u32 | - ^ ----- u32

View file

@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)] #![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
//@ check-pass //@ check-pass

View file

@ -1,8 +1,7 @@
//! This test ensures we do not ICE for unimplemented //! This test ensures we do not ICE for unimplemented
//! patterns unless the feature gate is enabled. //! patterns unless the feature gate is enabled.
#![feature(core_pattern_type)] #![feature(pattern_type_macro)]
#![feature(core_pattern_types)]
use std::pat::pattern_type; use std::pat::pattern_type;

View file

@ -1,5 +1,5 @@
error[E0658]: pattern types are unstable error[E0658]: pattern types are unstable
--> $DIR/unimplemented_pat.rs:9:15 --> $DIR/unimplemented_pat.rs:8:15
| |
LL | type Always = pattern_type!(Option<u32> is Some(_)); LL | type Always = pattern_type!(Option<u32> is Some(_));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -9,7 +9,7 @@ LL | type Always = pattern_type!(Option<u32> is Some(_));
= 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
error[E0658]: pattern types are unstable error[E0658]: pattern types are unstable
--> $DIR/unimplemented_pat.rs:12:16 --> $DIR/unimplemented_pat.rs:11:16
| |
LL | type Binding = pattern_type!(Option<u32> is x); LL | type Binding = pattern_type!(Option<u32> is x);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -8,7 +8,6 @@
#![feature(builtin_syntax)] #![feature(builtin_syntax)]
#![feature(concat_idents)] #![feature(concat_idents)]
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![feature(core_pattern_type)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(deref_patterns)] #![feature(deref_patterns)]
#![feature(explicit_tail_calls)] #![feature(explicit_tail_calls)]
@ -18,6 +17,7 @@
#![feature(never_patterns)] #![feature(never_patterns)]
#![feature(never_type)] #![feature(never_type)]
#![feature(pattern_types)] #![feature(pattern_types)]
#![feature(pattern_type_macro)]
#![feature(prelude_import)] #![feature(prelude_import)]
#![feature(specialization)] #![feature(specialization)]
#![feature(trace_macros)] #![feature(trace_macros)]

View file

@ -9,7 +9,6 @@
#![feature(builtin_syntax)] #![feature(builtin_syntax)]
#![feature(concat_idents)] #![feature(concat_idents)]
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![feature(core_pattern_type)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(deref_patterns)] #![feature(deref_patterns)]
#![feature(explicit_tail_calls)] #![feature(explicit_tail_calls)]
@ -19,6 +18,7 @@
#![feature(never_patterns)] #![feature(never_patterns)]
#![feature(never_type)] #![feature(never_type)]
#![feature(pattern_types)] #![feature(pattern_types)]
#![feature(pattern_type_macro)]
#![feature(prelude_import)] #![feature(prelude_import)]
#![feature(specialization)] #![feature(specialization)]
#![feature(trace_macros)] #![feature(trace_macros)]