Skip to content

Commit cb3adb7

Browse files
committed
coretests stop relying on inline_const_pat
1 parent 57d1815 commit cb3adb7

File tree

3 files changed

+609
-601
lines changed

3 files changed

+609
-601
lines changed

library/coretests/tests/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#![feature(generic_assert_internals)]
4040
#![feature(hasher_prefixfree_extras)]
4141
#![feature(hashmap_internals)]
42-
#![feature(inline_const_pat)]
4342
#![feature(int_roundings)]
4443
#![feature(ip)]
4544
#![feature(ip_from)]
@@ -95,16 +94,17 @@
9594

9695
/// Version of `assert_matches` that ignores fancy runtime printing in const context and uses structural equality.
9796
macro_rules! assert_eq_const_safe {
98-
($left:expr, $right:expr) => {
99-
assert_eq_const_safe!($left, $right, concat!(stringify!($left), " == ", stringify!($right)));
97+
($t:ty: $left:expr, $right:expr) => {
98+
assert_eq_const_safe!($t: $left, $right, concat!(stringify!($left), " == ", stringify!($right)));
10099
};
101-
($left:expr, $right:expr$(, $($arg:tt)+)?) => {
100+
($t:ty: $left:expr, $right:expr$(, $($arg:tt)+)?) => {
102101
{
103102
fn runtime() {
104103
assert_eq!($left, $right, $($($arg)*),*);
105104
}
106105
const fn compiletime() {
107-
assert!(matches!($left, const { $right }));
106+
const PAT: $t = $right;
107+
assert!(matches!($left, PAT), $($($arg)*),*);
108108
}
109109
core::intrinsics::const_eval_select((), compiletime, runtime)
110110
}

0 commit comments

Comments
 (0)