Skip to content

Commit 94543ff

Browse files
author
Lukas Markeffsky
committed
fix matches! and assert_matches! on edition 2021
1 parent b2aff2e commit 94543ff

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
#![feature(no_coverage)] // rust-lang/rust#84605
169169
#![feature(int_error_matching)]
170170
#![deny(unsafe_op_in_unsafe_fn)]
171+
#![deny(or_patterns_back_compat)]
171172

172173
// allow using `core::` in intra-doc links
173174
#[allow(unused_extern_crates)]

core/src/macros/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ macro_rules! assert_ne {
138138
#[unstable(feature = "assert_matches", issue = "82775")]
139139
#[allow_internal_unstable(core_panic)]
140140
macro_rules! assert_matches {
141-
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => ({
141+
($left:expr, $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => ({
142142
match $left {
143143
$( $pattern )|+ $( if $guard )? => {}
144144
ref left_val => {
@@ -150,7 +150,7 @@ macro_rules! assert_matches {
150150
}
151151
}
152152
});
153-
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )?, $($arg:tt)+) => ({
153+
($left:expr, $( $pattern:pat_param )|+ $( if $guard: expr )?, $($arg:tt)+) => ({
154154
match $left {
155155
$( $pattern )|+ $( if $guard )? => {}
156156
ref left_val => {
@@ -315,7 +315,7 @@ macro_rules! debug_assert_matches {
315315
#[macro_export]
316316
#[stable(feature = "matches_macro", since = "1.42.0")]
317317
macro_rules! matches {
318-
($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => {
318+
($expression:expr, $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
319319
match $expression {
320320
$( $pattern )|+ $( if $guard )? => true,
321321
_ => false

0 commit comments

Comments
 (0)