Skip to content

Commit 9f99d79

Browse files
authored
Unrolled build for #151359
Rollup merge of #151359 - assert-matches, r=BoxyUwU,Noratrieb compiler: Temporarily re-export `assert_matches!` to reduce stabilization churn #137487 proposes to stabilize `feature(assert_matches)`, while simultaneously moving the `assert_matches!` and `debug_assert_matches!` macros out of the `std::assert_matches` submodule and exporting them directly from the `std` crate root instead. Unfortunately, that moving step would cause a lot of `cfg(bootstrap)` churn and noise in the compiler, because the compiler imports and uses those macros in dozens of places. This PR therefore aims to reduce the overall compiler churn, by temporarily adjusting the compiler to always use `assert_matches!` via a re-export from `rustc_data_structures`. That way, the stabilization itself would only need to add `cfg(bootstrap)` to that single re-export (plus the associated `#![feature(assert_matches)]` attributes), greatly reducing the immediate impact on the compiler. Once `assert_matches!` is stable in the stage0 bootstrap compiler, we can go back and delete the re-export, and adjust the rest of the compiler to import directly from `std` instead.
2 parents 158ae9e + 7ec34de commit 9f99d79

File tree

58 files changed

+64
-79
lines changed

Some content is hidden

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

58 files changed

+64
-79
lines changed

compiler/rustc_abi/src/extern_abi/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::assert_matches::assert_matches;
21
use std::str::FromStr;
32

3+
use rustc_data_structures::assert_matches;
4+
45
use super::*;
56

67
#[allow(non_snake_case)]

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![allow(rustc::untranslatable_diagnostic)]
55

6-
use std::assert_matches::assert_matches;
7-
6+
use rustc_data_structures::assert_matches;
87
use rustc_errors::{Applicability, Diag, EmissionGuarantee};
98
use rustc_hir as hir;
109
use rustc_hir::intravisit::Visitor;

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
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;
11-
1210
use itertools::Itertools;
11+
use rustc_data_structures::assert_matches;
1312
use rustc_hir as hir;
1413
use rustc_infer::infer::{BoundRegionConversionTime, RegionVariableOrigin};
1514
use rustc_middle::mir::*;

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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;
65

76
use rustc_ast::{self as ast, GenericParamKind, HasNodeId, attr, join_path_idents};
87
use rustc_ast_pretty::pprust;
98
use rustc_attr_parsing::AttributeParser;
9+
use rustc_data_structures::assert_matches;
1010
use rustc_errors::{Applicability, Diag, Level};
1111
use rustc_expand::base::*;
1212
use rustc_hir::Attribute;

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use std::assert_matches::assert_matches;
2-
31
use rustc_abi::{BackendRepr, Float, Integer, Primitive, Scalar};
42
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
53
use rustc_codegen_ssa::mir::operand::OperandValue;
64
use rustc_codegen_ssa::traits::*;
5+
use rustc_data_structures::assert_matches;
76
use rustc_data_structures::fx::FxHashMap;
87
use rustc_middle::ty::Instance;
98
use rustc_middle::ty::layout::TyAndLayout;

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use std::assert_matches::assert_matches;
21
use std::sync::Arc;
32

43
use itertools::Itertools;
54
use rustc_abi::Align;
65
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, ConstCodegenMethods};
6+
use rustc_data_structures::assert_matches;
77
use rustc_data_structures::fx::FxIndexMap;
88
use rustc_index::IndexVec;
99
use rustc_middle::ty::TyCtxt;

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::assert_matches::assert_matches;
21
use std::cmp::Ordering;
32
use std::ffi::c_uint;
43
use std::ptr;
@@ -13,6 +12,7 @@ use rustc_codegen_ssa::errors::{ExpectedPointerMutability, InvalidMonomorphizati
1312
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
1413
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
1514
use rustc_codegen_ssa::traits::*;
15+
use rustc_data_structures::assert_matches;
1616
use rustc_hir::def_id::LOCAL_CRATE;
1717
use rustc_hir::{self as hir};
1818
use rustc_middle::mir::BinOp;

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::assert_matches::assert_matches;
21
use std::marker::PhantomData;
32
use std::panic::AssertUnwindSafe;
43
use std::path::{Path, PathBuf};
@@ -8,6 +7,7 @@ use std::{fs, io, mem, str, thread};
87

98
use rustc_abi::Size;
109
use rustc_ast::attr;
10+
use rustc_data_structures::assert_matches;
1111
use rustc_data_structures::fx::FxIndexMap;
1212
use rustc_data_structures::jobserver::{self, Acquired};
1313
use rustc_data_structures::memmap::Mmap;

compiler/rustc_codegen_ssa/src/traits/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use std::assert_matches::assert_matches;
21
use std::ops::Deref;
32

43
use rustc_abi::{Align, Scalar, Size, WrappingRange};
4+
use rustc_data_structures::assert_matches;
55
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
66
use rustc_middle::mir;
77
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};

compiler/rustc_const_eval/src/check_consts/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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;
54
use std::mem;
65
use std::num::NonZero;
76
use std::ops::Deref;
87

8+
use rustc_data_structures::assert_matches;
99
use rustc_errors::{Diag, ErrorGuaranteed};
1010
use rustc_hir::def::DefKind;
1111
use rustc_hir::def_id::DefId;

0 commit comments

Comments
 (0)