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

Rename core_pattern_type and core_pattern_types lib feature gates to pattern_type_macro #133863

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ pub mod net;
pub mod option;
pub mod panic;
pub mod panicking;
#[unstable(feature = "core_pattern_types", issue = "123646")]
#[unstable(feature = "pattern_type_macro", issue = "123646")]
pub mod pat;
pub mod pin;
#[unstable(feature = "random", issue = "130703")]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// ```
#[macro_export]
#[rustc_builtin_macro(pattern_type)]
#[unstable(feature = "core_pattern_type", issue = "123646")]
#[unstable(feature = "pattern_type_macro", issue = "123646")]
macro_rules! pattern_type {
($($arg:tt)*) => {
/* compiler built-in */
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ pub mod net;
pub mod num;
pub mod os;
pub mod panic;
#[unstable(feature = "core_pattern_types", issue = "123646")]
#[unstable(feature = "pattern_type_macro", issue = "123646")]
pub mod pat;
pub mod path;
#[unstable(feature = "anonymous_pipe", issue = "127154")]
Expand Down
13 changes: 2 additions & 11 deletions src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3936,17 +3936,8 @@ The tracking issue for this feature is: [#117693]
"##,
},
Lint {
label: "core_pattern_type",
description: r##"# `core_pattern_type`

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`
label: "pattern_type_macro",
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.

Expand Down
3 changes: 1 addition & 2 deletions tests/codegen/pattern_type_symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
//@ compile-flags: -Csymbol-mangling-version=v0 -Copt-level=0 --crate-type=lib

#![feature(pattern_types)]
#![feature(core_pattern_types)]
#![feature(core_pattern_type)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(pattern_types, core_pattern_type)]
#![feature(pattern_types, pattern_type_macro)]
#![allow(internal_features)]

type Pat<const START: u32, const END: u32> =
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/bad_pat.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types)]
#![feature(core_pattern_types)]
#![feature(core_pattern_type)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

Expand Down
6 changes: 3 additions & 3 deletions tests/ui/type/pattern_types/bad_pat.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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..=);
| ^^^
Expand All @@ -12,7 +12,7 @@ LL + type NonNullU32_2 = pattern_type!(u32 is 1..);
|

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..=);
| ^^^
Expand All @@ -25,7 +25,7 @@ LL + type Positive2 = pattern_type!(i32 is 0..);
|

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 _);
| ^
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/const_generics.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//@ check-pass

#![feature(pattern_types)]
#![feature(core_pattern_types)]
#![feature(core_pattern_type)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/derives.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! Check that pattern types don't implement traits of their base automatically

#![feature(pattern_types)]
#![feature(core_pattern_types)]
#![feature(core_pattern_type)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/type/pattern_types/derives.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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)]
| --------- in this derive macro expansion
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/type/pattern_types/feature-gate-pattern_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use std::pat::pattern_type;

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);
//~^ use of unstable library feature `core_pattern_type`
//~^ use of unstable library feature `pattern_type_macro`
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..);
//~^ use of unstable library feature `core_pattern_type`
//~^ use of unstable library feature `pattern_type_macro`
type Always = pattern_type!(Option<u32> is Some(_));
//~^ use of unstable library feature `core_pattern_type`
//~^ use of unstable library feature `pattern_type_macro`
20 changes: 10 additions & 10 deletions tests/ui/type/pattern_types/feature-gate-pattern_types.stderr
Original file line number Diff line number Diff line change
@@ -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
|
LL | type NonNullU32 = pattern_type!(u32 is 1..);
| ^^^^^^^^^^^^
|
= 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

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
|
LL | type Percent = pattern_type!(u32 is 0..=100);
| ^^^^^^^^^^^^
|
= 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

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
|
LL | type Negative = pattern_type!(i32 is ..=0);
| ^^^^^^^^^^^^
|
= 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

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
|
LL | type Positive = pattern_type!(i32 is 0..);
| ^^^^^^^^^^^^
|
= 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

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
|
LL | type Always = pattern_type!(Option<u32> is Some(_));
| ^^^^^^^^^^^^
|
= 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

error: aborting due to 5 previous errors
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/type/pattern_types/feature-gate-pattern_types2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ compile-flags: -Zno-analysis
//@ check-pass

#![feature(core_pattern_type)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/type/pattern_types/missing-is.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(core_pattern_type, core_pattern_types)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/range_patterns.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]
#![allow(incomplete_features)]

//@ normalize-stderr-test: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/type/pattern_types/range_patterns.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ error: layout_of(NonZero<u32>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/range_patterns.rs:11:1
--> $DIR/range_patterns.rs:10:1
|
LL | type X = std::num::NonZeroU32;
| ^^^^^^
Expand Down Expand Up @@ -74,7 +74,7 @@ error: layout_of((u32) is 1..=) = Layout {
max_repr_align: None,
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..);
| ^^^^^^
Expand Down Expand Up @@ -182,7 +182,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
max_repr_align: None,
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..)>;
| ^^^^^^
Expand Down Expand Up @@ -290,7 +290,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
max_repr_align: None,
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>;
| ^^^^^^
Expand Down Expand Up @@ -334,7 +334,7 @@ error: layout_of(NonZeroU32New) = Layout {
max_repr_align: None,
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..));
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/range_patterns_inherent_impls.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]
#![allow(incomplete_features)]

//! check that pattern types can have traits implemented for them if
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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 {
| ^^^^^^
|
= help: consider moving this inherent impl into `core` if possible
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() {}
| ^^^^^^^^
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/range_patterns_trait_impls.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]
#![allow(incomplete_features)]

//! check that pattern types can have local traits
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/range_patterns_trait_impls2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]
#![allow(incomplete_features)]

//! check that pattern types can have local traits
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 {}
| ^^^^^^^^^^^^-
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/range_patterns_unusable.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]
#![allow(incomplete_features)]

//! Some practical niche checks.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/type/pattern_types/range_patterns_unusable.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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) };
| ^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/range_patterns_unusable_math.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]
#![allow(incomplete_features)]

//! check that pattern types don't have an `Add` impl.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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;
| - ^ ----- u32
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/range_patterns_usage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]
#![allow(incomplete_features)]
//@ check-pass

Expand Down
3 changes: 1 addition & 2 deletions tests/ui/type/pattern_types/unimplemented_pat.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! This test ensures we do not ICE for unimplemented
//! patterns unless the feature gate is enabled.

#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/type/pattern_types/unimplemented_pat.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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(_));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -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

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);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unpretty/expanded-exhaustive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#![feature(builtin_syntax)]
#![feature(concat_idents)]
#![feature(const_trait_impl)]
#![feature(core_pattern_type)]
#![feature(decl_macro)]
#![feature(deref_patterns)]
#![feature(explicit_tail_calls)]
Expand All @@ -18,6 +17,7 @@
#![feature(never_patterns)]
#![feature(never_type)]
#![feature(pattern_types)]
#![feature(pattern_type_macro)]
#![feature(prelude_import)]
#![feature(specialization)]
#![feature(trace_macros)]
Expand Down
Loading
Loading