From 93b7aee2dad93b46ae81e1abb51edde7e6bb957c Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Fri, 16 Jul 2021 09:18:14 -0700 Subject: [PATCH 1/4] rename assert_matches module --- compiler/rustc_middle/src/ich/impls_syntax.rs | 2 +- compiler/rustc_mir/src/interpret/memory.rs | 2 +- library/core/src/lib.rs | 2 +- library/std/src/lib.rs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_middle/src/ich/impls_syntax.rs b/compiler/rustc_middle/src/ich/impls_syntax.rs index 1c66f831b5f4b..acf2990b64348 100644 --- a/compiler/rustc_middle/src/ich/impls_syntax.rs +++ b/compiler/rustc_middle/src/ich/impls_syntax.rs @@ -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; diff --git a/compiler/rustc_mir/src/interpret/memory.rs b/compiler/rustc_mir/src/interpret/memory.rs index 194c478cc99d7..0528a78828413 100644 --- a/compiler/rustc_mir/src/interpret/memory.rs +++ b/compiler/rustc_mir/src/interpret/memory.rs @@ -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}; diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 01d33409a4238..8bbce7e552c9b 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -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}; } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 472bca3460f46..a157a222c43e9 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -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")] From e3dd61691181bf571a3b553c655b4ced725b6d81 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Fri, 16 Jul 2021 11:26:20 -0700 Subject: [PATCH 2/4] fix ui tests --- src/test/ui/macros/assert-matches-macro-msg.rs | 2 +- src/test/ui/matches2021.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/ui/macros/assert-matches-macro-msg.rs b/src/test/ui/macros/assert-matches-macro-msg.rs index 714a6561a6d09..fd8cd5a1a0566 100644 --- a/src/test/ui/macros/assert-matches-macro-msg.rs +++ b/src/test/ui/macros/assert-matches-macro-msg.rs @@ -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"); diff --git a/src/test/ui/matches2021.rs b/src/test/ui/matches2021.rs index a6fa5128d2f86..f5497c1d16de6 100644 --- a/src/test/ui/matches2021.rs +++ b/src/test/ui/matches2021.rs @@ -6,7 +6,7 @@ #![feature(assert_matches)] -use std::assert::assert_matches; +use std::assert_matches::assert_matches; fn main() { assert!(matches!((), ())); From 085d52c5882dba0097b8367f02d303fffd5b95ae Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Fri, 16 Jul 2021 12:16:39 -0700 Subject: [PATCH 3/4] pls this time --- library/core/src/macros/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 8ce441e80bfb7..60eca35068eb7 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -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); @@ -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. From d0e8de68c4c59fd1e0fb4ba1e3ab4c7bbff842a0 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Fri, 16 Jul 2021 13:25:11 -0700 Subject: [PATCH 4/4] i sweat to god --- library/core/src/macros/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 60eca35068eb7..57eedde91643d 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -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);