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 assert_matches module #87195

Merged
merged 4 commits into from
Jul 17, 2021
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 compiler/rustc_middle/src/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::ich::StableHashingContext;
use rustc_ast as ast;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_span::{BytePos, NormalizedPos, SourceFile};
use std::assert::assert_matches;
use std::assert_matches::assert_matches;

use smallvec::SmallVec;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! integer. It is crucial that these operations call `check_align` *before*
//! short-circuiting the empty case!

use std::assert::assert_matches;
use std::assert_matches::assert_matches;
use std::borrow::Cow;
use std::collections::VecDeque;
use std::convert::{TryFrom, TryInto};
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ mod macros;
#[cfg(not(test))]
#[unstable(feature = "assert_matches", issue = "82775")]
/// Unstable module containing the unstable `assert_matches` macro.
pub mod assert {
pub mod assert_matches {
#[unstable(feature = "assert_matches", issue = "82775")]
pub use crate::macros::{assert_matches, debug_assert_matches};
}
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ macro_rules! assert_ne {
/// ```
/// #![feature(assert_matches)]
///
/// use std::assert::assert_matches;
/// use std::assert_matches::assert_matches;
///
/// let a = 1u32.checked_add(2);
/// let b = 1u32.checked_sub(2);
Expand Down Expand Up @@ -286,7 +286,7 @@ macro_rules! debug_assert_ne {
/// ```
/// #![feature(assert_matches)]
///
/// use std::assert::debug_assert_matches;
/// use std::assert_matches::debug_assert_matches;
///
/// let a = 1u32.checked_add(2);
/// let b = 1u32.checked_sub(2);
Expand All @@ -301,7 +301,7 @@ macro_rules! debug_assert_ne {
#[allow_internal_unstable(assert_matches)]
#[rustc_macro_transparency = "semitransparent"]
pub macro debug_assert_matches($($arg:tt)*) {
if $crate::cfg!(debug_assertions) { $crate::assert::assert_matches!($($arg)*); }
if $crate::cfg!(debug_assertions) { $crate::assert_matches::assert_matches!($($arg)*); }
}

/// Returns whether the given expression matches any of the given patterns.
Expand Down
6 changes: 3 additions & 3 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ pub use core::{
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
#[allow(deprecated)]
pub use core::{
asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax,
module_path, option_env, stringify, trace_macros,
asm, assert, assert_matches, cfg, column, compile_error, concat, concat_idents, env, file,
format_args, format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm,
log_syntax, module_path, option_env, stringify, trace_macros,
};

#[stable(feature = "core_primitive", since = "1.43.0")]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/macros/assert-matches-macro-msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#![feature(assert_matches)]

use std::assert::assert_matches;
use std::assert_matches::assert_matches;

fn main() {
assert_matches!(1 + 1, 3, "1 + 1 definitely should be 3");
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/matches2021.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#![feature(assert_matches)]

use std::assert::assert_matches;
use std::assert_matches::assert_matches;

fn main() {
assert!(matches!((), ()));
Expand Down