Skip to content
Open
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
3 changes: 2 additions & 1 deletion compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// tidy-alphabetical-start
#![cfg_attr(all(feature = "nightly", bootstrap), feature(assert_matches))]
#![cfg_attr(all(feature = "nightly", not(bootstrap)), feature(assert_matches_re_export))]
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", feature(assert_matches))]
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
#![cfg_attr(feature = "nightly", feature(step_trait))]
// tidy-alphabetical-end
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(if_let_guard)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
//! This API is completely unstable and subject to change.

// tidy-alphabetical-start
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(extern_types)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_const_eval/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(array_try_map)]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(if_let_guard)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(allocator_api)]
#![feature(ascii_char)]
#![feature(ascii_char_variants)]
#![feature(assert_matches)]
#![feature(auto_traits)]
#![feature(cfg_select)]
#![feature(const_default)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(default_field_values)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ This API is completely unstable and subject to change.
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(gen_blocks)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// tidy-alphabetical-start
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

// tidy-alphabetical-start
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(extend_one)]
#![recursion_limit = "512"] // For rustdoc
// tidy-alphabetical-end
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(iter_order_by)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(allocator_api)]
#![feature(assert_matches)]
#![feature(associated_type_defaults)]
#![feature(box_as_ptr)]
#![feature(box_patterns)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_mir_build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(try_blocks)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_mir_dataflow/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// tidy-alphabetical-start
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(exact_size_is_empty)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(const_type_name)]
#![feature(cow_is_borrowed)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(box_patterns)]
#![feature(debug_closure_helpers)]
#![feature(default_field_values)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_query_system/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(core_intrinsics)]
#![feature(min_specialization)]
// tidy-alphabetical-end
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(arbitrary_self_types)]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(const_default)]
#![feature(const_trait_impl)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_symbol_mangling/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
//! DefPaths which are much more robust in the face of changes to the code base.

// tidy-alphabetical-start
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
// tidy-alphabetical-end

use rustc_hir::def::DefKind;
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(default_field_values)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ty_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
//! This API is completely unstable and subject to change.
// tidy-alphabetical-start
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![cfg_attr(not(bootstrap), feature(assert_matches_re_export))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(if_let_guard)]
Expand Down
5 changes: 2 additions & 3 deletions library/alloc/src/collections/btree/map/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::assert_matches::assert_matches;
use std::iter;
use std::ops::Bound::{Excluded, Included, Unbounded};
use std::panic::{AssertUnwindSafe, catch_unwind};
Expand Down Expand Up @@ -2578,14 +2577,14 @@ fn cursor_peek_prev_agrees_with_cursor_mut() {
assert!(cursor.peek_next().is_none());

let prev = cursor.peek_prev();
assert_matches!(prev, Some((&3, _)));
assert!(matches!(prev, Some((&3, _))));

// Shadow names so the two parts of this test match.
let mut cursor = map.lower_bound_mut(Bound::Excluded(&3));
assert!(cursor.peek_next().is_none());

let prev = cursor.peek_prev();
assert_matches!(prev, Some((&3, _)));
assert!(matches!(prev, Some((&3, _))));
}

#[test]
Expand Down
1 change: 0 additions & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
#![feature(allocator_api)]
#![feature(array_into_iter_constructors)]
#![feature(ascii_char)]
#![feature(assert_matches)]
#![feature(async_fn_traits)]
#![feature(async_iterator)]
#![feature(box_vec_non_null)]
Expand Down
1 change: 0 additions & 1 deletion library/alloctests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// tidy-alphabetical-start
#![feature(allocator_api)]
#![feature(array_into_iter_constructors)]
#![feature(assert_matches)]
#![feature(box_vec_non_null)]
#![feature(char_internals)]
#![feature(const_alloc_error)]
Expand Down
2 changes: 1 addition & 1 deletion library/alloctests/tests/c_str2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use alloc::ffi::CString;
use alloc::rc::Rc;
use alloc::sync::Arc;
use core::assert_matches::assert_matches;
use core::assert_matches;
use core::ffi::{CStr, FromBytesUntilNulError, c_char};
#[allow(deprecated)]
use core::hash::SipHasher13 as DefaultHasher;
Expand Down
1 change: 0 additions & 1 deletion library/alloctests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![feature(const_heap)]
#![feature(deque_extend_front)]
#![feature(iter_array_chunks)]
#![feature(assert_matches)]
#![feature(wtf8_internals)]
#![feature(cow_is_borrowed)]
#![feature(core_intrinsics)]
Expand Down
2 changes: 1 addition & 1 deletion library/alloctests/tests/str.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(invalid_from_utf8)]

use std::assert_matches::assert_matches;
use std::assert_matches;
use std::borrow::Cow;
use std::cmp::Ordering::{Equal, Greater, Less};
use std::str::{from_utf8, from_utf8_unchecked};
Expand Down
2 changes: 1 addition & 1 deletion library/alloctests/tests/string.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::borrow::Cow;
use std::cell::Cell;
use std::collections::TryReserveErrorKind::*;
Expand Down
2 changes: 1 addition & 1 deletion library/alloctests/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::num::NonZero;
use core::ptr::NonNull;
use core::{assert_eq, assert_ne};
use std::alloc::System;
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::borrow::Cow;
use std::cell::Cell;
use std::collections::TryReserveErrorKind::*;
Expand Down
2 changes: 1 addition & 1 deletion library/alloctests/tests/vec_deque.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::cell::Cell;
use core::num::NonZero;
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::TryReserveErrorKind::*;
use std::collections::VecDeque;
use std::collections::vec_deque::Drain;
Expand Down
12 changes: 6 additions & 6 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ use prelude::rust_2024::*;
#[macro_use]
mod macros;

#[unstable(feature = "assert_matches", issue = "82775")]
/// Unstable module containing the unstable `assert_matches` macro.
pub mod assert_matches {
#[unstable(feature = "assert_matches", issue = "82775")]
pub use crate::macros::{assert_matches, debug_assert_matches};
}
// These macros are explicitly exported here and not in the preludes - for now - to require manual
// import by users to avoid compatibility issues such as with the third-party assert_matches macro.
// See https://github.com/rust-lang/rust/pull/137487 and
// https://github.com/rust-lang/rust/issues/82913
#[stable(feature = "assert_matches", since = "CURRENT_RUSTC_VERSION")]
pub use crate::macros::{assert_matches, debug_assert_matches};
Comment on lines -225 to +230
Copy link
Member

@RalfJung RalfJung Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does 2 things at once, when typically we prefer to do them separately: the stabilization PR should only change the stability of a feature, not change how it works.

Put differently, all code that worked before a stabilization PR should keep working, with the only difference being that there are new warnings about using feature on an already-stable feature.

I said this from the start:

So any moving around of the definition should ideally be done first in a separate PR.

Your replies were always about something unrelated. I can't figure out why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, will do.

Copy link
Contributor Author

@Voultapher Voultapher Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your replies were always about something unrelated. I can't figure out why.

There are two different renames/moves, the client-side rename of use and the export path. I believe you were talking about the latter or both and I was mostly talking and thinking about the former. In my mind I understood the issue as too much changes at once and the former was the major source of change.


#[unstable(feature = "derive_from", issue = "144889")]
/// Unstable module containing the unstable `From` derive macro.
Expand Down
16 changes: 6 additions & 10 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ macro_rules! assert_ne {
/// be disabled. See [`debug_assert_matches!`] for assertions that are disabled in
/// release builds by default.
///
/// [`debug_assert_matches!`]: crate::assert_matches::debug_assert_matches
/// [`debug_assert_matches!`]: crate::debug_assert_matches
///
/// On panic, this macro will print the value of the expression with its debug representation.
///
Expand All @@ -147,9 +147,7 @@ macro_rules! assert_ne {
/// # Examples
///
/// ```
/// #![feature(assert_matches)]
///
/// use std::assert_matches::assert_matches;
/// use std::assert_matches;
///
/// let a = Some(345);
/// let b = Some(56);
Expand All @@ -166,7 +164,7 @@ macro_rules! assert_ne {
/// assert_matches!(a, Some(x) if x > 100);
/// // assert_matches!(a, Some(x) if x < 100); // panics
/// ```
#[unstable(feature = "assert_matches", issue = "82775")]
#[stable(feature = "assert_matches", since = "CURRENT_RUSTC_VERSION")]
#[allow_internal_unstable(panic_internals)]
#[rustc_macro_transparency = "semiopaque"]
pub macro assert_matches {
Expand Down Expand Up @@ -380,9 +378,7 @@ macro_rules! debug_assert_ne {
/// # Examples
///
/// ```
/// #![feature(assert_matches)]
///
/// use std::assert_matches::debug_assert_matches;
/// use std::debug_assert_matches;
///
/// let a = Some(345);
/// let b = Some(56);
Expand All @@ -399,12 +395,12 @@ macro_rules! debug_assert_ne {
/// debug_assert_matches!(a, Some(x) if x > 100);
/// // debug_assert_matches!(a, Some(x) if x < 100); // panics
/// ```
#[unstable(feature = "assert_matches", issue = "82775")]
#[stable(feature = "assert_matches", since = "CURRENT_RUSTC_VERSION")]
#[allow_internal_unstable(assert_matches)]
#[rustc_macro_transparency = "semiopaque"]
pub macro debug_assert_matches($($arg:tt)*) {
if $crate::cfg!(debug_assertions) {
$crate::assert_matches::assert_matches!($($arg)*);
$crate::assert_matches!($($arg)*);
}
}

Expand Down
Loading
Loading