From 0e30629600d442f480c6bed29cc4bbe04b0ce926 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 23 Jul 2025 14:34:32 +0200 Subject: [PATCH] Add regression test for matches! + non_exhaustive_omitted_patterns lint --- library/coretests/tests/lib.rs | 1 + library/coretests/tests/macros.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index 4cfac9ecc2ab..c5bfd1574e29 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -76,6 +76,7 @@ #![feature(min_specialization)] #![feature(never_type)] #![feature(next_index)] +#![feature(non_exhaustive_omitted_patterns_lint)] #![feature(numfmt)] #![feature(pattern)] #![feature(pointer_is_aligned_to)] diff --git a/library/coretests/tests/macros.rs b/library/coretests/tests/macros.rs index 1c6aa90dfbca..50b5eb63e43a 100644 --- a/library/coretests/tests/macros.rs +++ b/library/coretests/tests/macros.rs @@ -213,3 +213,9 @@ fn _expression() { } ); } + +#[deny(non_exhaustive_omitted_patterns)] +fn _matches_does_not_trigger_non_exhaustive_omitted_patterns_lint(o: core::sync::atomic::Ordering) { + // Ordering is a #[non_exhaustive] enum from a separate crate + let _m = matches!(o, core::sync::atomic::Ordering::Relaxed); +}