Skip to content

Commit 6859a17

Browse files
committed
Stabilize assert_matches and move it to core::macros
Closes rust-lang#82775 This is a revive of rust-lang#120234, with the suggested move from the public assert_matches module to macros. This necessitates the rename of the internal macros modules to core_macros and std_macros respectively.
1 parent b880760 commit 6859a17

File tree

117 files changed

+147
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+147
-200
lines changed

compiler/rustc_abi/src/extern_abi/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22
use std::str::FromStr;
33

44
use super::*;

compiler/rustc_abi/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// tidy-alphabetical-start
22
#![cfg_attr(feature = "nightly", allow(internal_features))]
33
#![cfg_attr(feature = "nightly", doc(rust_logo))]
4-
#![cfg_attr(feature = "nightly", feature(assert_matches))]
54
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
65
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
76
#![cfg_attr(feature = "nightly", feature(step_trait))]

compiler/rustc_ast_lowering/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22
use std::ops::ControlFlow;
33
use std::sync::Arc;
44

compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
// tidy-alphabetical-start
3434
#![allow(internal_features)]
3535
#![doc(rust_logo)]
36-
#![feature(assert_matches)]
3736
#![feature(box_patterns)]
3837
#![feature(if_let_guard)]
3938
#![feature(let_chains)]

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![allow(rustc::untranslatable_diagnostic)]
55

6-
use std::assert_matches::assert_matches;
6+
use std::macros::assert_matches;
77

88
use rustc_errors::{Applicability, Diag, EmissionGuarantee};
99
use rustc_hir as hir;

compiler/rustc_borrowck/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// tidy-alphabetical-start
44
#![allow(internal_features)]
55
#![doc(rust_logo)]
6-
#![feature(assert_matches)]
76
#![feature(box_patterns)]
87
#![feature(file_buffered)]
98
#![feature(if_let_guard)]

compiler/rustc_borrowck/src/type_check/input_output.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
88
//! contain revealed `impl Trait` values).
99
10-
use std::assert_matches::assert_matches;
10+
use std::macros::assert_matches;
1111

1212
use itertools::Itertools;
1313
use rustc_hir as hir;

compiler/rustc_builtin_macros/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![allow(rustc::untranslatable_diagnostic)]
88
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
99
#![doc(rust_logo)]
10-
#![feature(assert_matches)]
1110
#![feature(autodiff)]
1211
#![feature(box_patterns)]
1312
#![feature(decl_macro)]

compiler/rustc_builtin_macros/src/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! The expansion from a test function to the appropriate test struct for libtest
22
//! Ideally, this code would be in libtest but for efficiency and error messages it lives here.
33
4-
use std::assert_matches::assert_matches;
54
use std::iter;
5+
use std::macros::assert_matches;
66

77
use rustc_ast::ptr::P;
88
use rustc_ast::{self as ast, GenericParamKind, attr};

compiler/rustc_codegen_llvm/src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22

33
use libc::{c_char, c_uint};
44
use rustc_abi::{BackendRepr, Float, Integer, Primitive, Scalar};

compiler/rustc_codegen_llvm/src/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::assert_matches::assert_matches;
21
use std::cmp::Ordering;
2+
use std::macros::assert_matches;
33

44
use rustc_abi::{Align, BackendRepr, ExternAbi, Float, HasDataLayout, Primitive, Size};
55
use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh};

compiler/rustc_codegen_llvm/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![allow(internal_features)]
99
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1010
#![doc(rust_logo)]
11-
#![feature(assert_matches)]
1211
#![feature(exact_size_is_empty)]
1312
#![feature(extern_types)]
1413
#![feature(file_buffered)]

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::any::Any;
2-
use std::assert_matches::assert_matches;
2+
use std::macros::assert_matches;
33
use std::marker::PhantomData;
44
use std::path::{Path, PathBuf};
55
use std::sync::Arc;

compiler/rustc_codegen_ssa/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#![allow(rustc::untranslatable_diagnostic)]
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
66
#![doc(rust_logo)]
7-
#![feature(assert_matches)]
87
#![feature(box_patterns)]
98
#![feature(debug_closure_helpers)]
109
#![feature(file_buffered)]

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22

33
use arrayvec::ArrayVec;
44
use rustc_abi::{self as abi, FIRST_VARIANT, FieldIdx};

compiler/rustc_codegen_ssa/src/traits/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22
use std::ops::Deref;
33

44
use rustc_abi::{Align, Scalar, Size, WrappingRange};

compiler/rustc_const_eval/src/check_consts/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations.
22
3-
use std::assert_matches::assert_matches;
43
use std::borrow::Cow;
4+
use std::macros::assert_matches;
55
use std::mem;
66
use std::num::NonZero;
77
use std::ops::Deref;

compiler/rustc_const_eval/src/interpret/call.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Manages calling a concrete function (with known MIR body) with argument passing,
22
//! and returning the return value to the caller.
3-
use std::assert_matches::assert_matches;
43
use std::borrow::Cow;
4+
use std::macros::assert_matches;
55

66
use either::{Left, Right};
77
use rustc_abi::{self as abi, ExternAbi, FieldIdx, Integer, VariantIdx};

compiler/rustc_const_eval/src/interpret/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22

33
use rustc_abi::Integer;
44
use rustc_apfloat::ieee::{Double, Half, Quad, Single};

compiler/rustc_const_eval/src/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::debug_assert_matches;
1+
use std::macros::debug_assert_matches;
22

33
use either::{Left, Right};
44
use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout};

compiler/rustc_const_eval/src/interpret/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! looking at their MIR. Intrinsics/functions supported here are shared by CTFE
33
//! and miri.
44
5-
use std::assert_matches::assert_matches;
5+
use std::macros::assert_matches;
66

77
use rustc_abi::Size;
88
use rustc_apfloat::ieee::{Double, Half, Quad, Single};

compiler/rustc_const_eval/src/interpret/memory.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//! integer. It is crucial that these operations call `check_align` *before*
77
//! short-circuiting the empty case!
88
9-
use std::assert_matches::assert_matches;
109
use std::borrow::{Borrow, Cow};
1110
use std::collections::VecDeque;
11+
use std::macros::assert_matches;
1212
use std::{fmt, mem, ptr};
1313

1414
use rustc_abi::{Align, HasDataLayout, Size};

compiler/rustc_const_eval/src/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Functions concerning immediate values and operands, and reading from operands.
22
//! All high-level functions to read from memory work on operands as sources.
33
4-
use std::assert_matches::assert_matches;
4+
use std::macros::assert_matches;
55

66
use either::{Either, Left, Right};
77
use rustc_abi as abi;

compiler/rustc_const_eval/src/interpret/place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! into a place.
33
//! All high-level functions to write to memory work on places as destinations.
44
5-
use std::assert_matches::assert_matches;
5+
use std::macros::assert_matches;
66

77
use either::{Either, Left, Right};
88
use rustc_abi::{BackendRepr, HasDataLayout, Size};

compiler/rustc_const_eval/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(internal_features)]
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![doc(rust_logo)]
5-
#![feature(assert_matches)]
65
#![feature(box_patterns)]
76
#![feature(decl_macro)]
87
#![feature(if_let_guard)]

compiler/rustc_data_structures/src/graph/scc/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
//! Typical examples would include: minimum element in SCC, maximum element
99
//! reachable from it, etc.
1010
11-
use std::assert_matches::debug_assert_matches;
1211
use std::fmt::Debug;
12+
use std::macros::debug_assert_matches;
1313
use std::ops::Range;
1414

1515
use rustc_index::{Idx, IndexSlice, IndexVec};

compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#![feature(array_windows)]
1818
#![feature(ascii_char)]
1919
#![feature(ascii_char_variants)]
20-
#![feature(assert_matches)]
2120
#![feature(auto_traits)]
2221
#![feature(cfg_match)]
2322
#![feature(core_intrinsics)]

compiler/rustc_errors/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1111
#![doc(rust_logo)]
1212
#![feature(array_windows)]
13-
#![feature(assert_matches)]
1413
#![feature(associated_type_defaults)]
1514
#![feature(box_into_inner)]
1615
#![feature(box_patterns)]
@@ -30,14 +29,14 @@
3029

3130
extern crate self as rustc_errors;
3231

33-
use std::assert_matches::assert_matches;
3432
use std::backtrace::{Backtrace, BacktraceStatus};
3533
use std::borrow::Cow;
3634
use std::cell::Cell;
3735
use std::error::Report;
3836
use std::ffi::OsStr;
3937
use std::hash::Hash;
4038
use std::io::Write;
39+
use std::macros::assert_matches;
4140
use std::num::NonZero;
4241
use std::ops::DerefMut;
4342
use std::path::{Path, PathBuf};

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::debug_assert_matches;
1+
use std::macros::debug_assert_matches;
22

33
use rustc_abi::FieldIdx;
44
use rustc_ast::InlineAsmTemplatePiece;

compiler/rustc_hir_analysis/src/coherence/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Check properties that are required by built-in traits and set
22
//! up data structures required by type-checking/codegen.
33
4-
use std::assert_matches::assert_matches;
54
use std::collections::BTreeMap;
5+
use std::macros::assert_matches;
66

77
use rustc_data_structures::fx::FxHashSet;
88
use rustc_errors::{ErrorGuaranteed, MultiSpan};

compiler/rustc_hir_analysis/src/collect/generics_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22
use std::ops::ControlFlow;
33

44
use hir::intravisit::{self, Visitor};

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22

33
use hir::Node;
44
use rustc_data_structures::fx::FxIndexSet;

compiler/rustc_hir_analysis/src/delegation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! For more information about delegation design, see the tracking issue #118212.
44
5-
use std::assert_matches::debug_assert_matches;
5+
use std::macros::debug_assert_matches;
66

77
use rustc_data_structures::fx::FxHashMap;
88
use rustc_hir::def::DefKind;

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub mod errors;
2020
pub mod generics;
2121
mod lint;
2222

23-
use std::assert_matches::assert_matches;
23+
use std::macros::assert_matches;
2424
use std::slice;
2525

2626
use rustc_ast::TraitObjectSyntax;

compiler/rustc_hir_analysis/src/impl_wf_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! specialization errors. These things can (and probably should) be
99
//! fixed, but for the moment it's easier to do these checks early.
1010
11-
use std::assert_matches::debug_assert_matches;
11+
use std::macros::debug_assert_matches;
1212

1313
use min_specialization::check_min_specialization;
1414
use rustc_data_structures::fx::FxHashSet;

compiler/rustc_hir_analysis/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ This API is completely unstable and subject to change.
6161
#![allow(rustc::untranslatable_diagnostic)]
6262
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
6363
#![doc(rust_logo)]
64-
#![feature(assert_matches)]
6564
#![feature(coroutines)]
6665
#![feature(debug_closure_helpers)]
6766
#![feature(if_let_guard)]

compiler/rustc_infer/src/infer/outlives/verify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22

33
use rustc_middle::ty::{self, OutlivesPredicate, Ty, TyCtxt};
44
use rustc_type_ir::outlives::{Component, compute_alias_components_recursive};

compiler/rustc_infer/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#![allow(rustc::untranslatable_diagnostic)]
1919
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2020
#![doc(rust_logo)]
21-
#![feature(assert_matches)]
2221
#![feature(extend_one)]
2322
#![feature(iterator_try_collect)]
2423
#![feature(let_chains)]

compiler/rustc_lint/src/impl_trait_overcaptures.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::assert_matches::debug_assert_matches;
21
use std::cell::LazyCell;
2+
use std::macros::debug_assert_matches;
33

44
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
55
use rustc_data_structures::unord::UnordSet;

compiler/rustc_lint/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2525
#![doc(rust_logo)]
2626
#![feature(array_windows)]
27-
#![feature(assert_matches)]
2827
#![feature(box_patterns)]
2928
#![feature(extract_if)]
3029
#![feature(if_let_guard)]

compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![doc(rust_logo)]
3434
#![feature(allocator_api)]
3535
#![feature(array_windows)]
36-
#![feature(assert_matches)]
3736
#![feature(associated_type_defaults)]
3837
#![feature(box_as_ptr)]
3938
#![feature(box_patterns)]

compiler/rustc_middle/src/ty/consts/kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::assert_matches::assert_matches;
1+
use std::macros::assert_matches;
22

33
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
44

compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
pub mod tls;
66

7-
use std::assert_matches::{assert_matches, debug_assert_matches};
87
use std::borrow::Borrow;
98
use std::cmp::Ordering;
109
use std::hash::{Hash, Hasher};
10+
use std::macros::{assert_matches, debug_assert_matches};
1111
use std::marker::PhantomData;
1212
use std::ops::{Bound, Deref};
1313
use std::sync::{Arc, OnceLock};

compiler/rustc_middle/src/ty/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::assert_matches::assert_matches;
21
use std::fmt;
2+
use std::macros::assert_matches;
33
use std::path::PathBuf;
44

55
use rustc_data_structures::fx::FxHashMap;

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
1212
#![allow(rustc::usage_of_ty_tykind)]
1313

14-
use std::assert_matches::assert_matches;
1514
use std::fmt::Debug;
1615
use std::hash::{Hash, Hasher};
16+
use std::macros::assert_matches;
1717
use std::marker::PhantomData;
1818
use std::num::NonZero;
1919
use std::ptr::NonNull;

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
33
#![allow(rustc::usage_of_ty_tykind)]
44

5-
use std::assert_matches::debug_assert_matches;
65
use std::borrow::Cow;
76
use std::iter;
7+
use std::macros::debug_assert_matches;
88
use std::ops::{ControlFlow, Range};
99

1010
use hir::def::{CtorKind, DefKind};

compiler/rustc_mir_build/src/builder/coverageinfo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::assert_matches::assert_matches;
21
use std::collections::hash_map::Entry;
2+
use std::macros::assert_matches;
33

44
use rustc_data_structures::fx::FxHashMap;
55
use rustc_middle::mir::coverage::{BlockMarkerId, BranchSpan, CoverageInfoHi, CoverageKind};

0 commit comments

Comments
 (0)