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: 3 additions & 0 deletions compiler/rustc_abi/src/extern_abi/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::str::FromStr;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tidy-alphabetical-start
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", feature(assert_matches))]
#![cfg_attr(all(feature = "nightly", bootstrap), feature(assert_matches))]
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
#![cfg_attr(feature = "nightly", feature(step_trait))]
// tidy-alphabetical-end
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]

#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use rustc_errors::{Applicability, Diag, EmissionGuarantee};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(box_patterns)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_borrowck/src/type_check/input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
//! contain revealed `impl Trait` values).
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
Comment on lines +10 to 13
Copy link
Member

Choose a reason for hiding this comment

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

(Continuing in a comment thread to avoid noise)

I was imagining:

  • PR 1: move where the macro is, and (unstably) re-export it from its old path. Requires no large changes;
  • PR 2, after next release train: use the new path everywhere. large change but no cfg(bootstrap) needed.
    Wouldn't that work?


use itertools::Itertools;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(if_let_guard)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_builtin_macros/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! The expansion from a test function to the appropriate test struct for libtest
//! Ideally, this code would be in libtest but for efficiency and error messages it lives here.
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::iter;

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use rustc_abi::{BackendRepr, Float, Integer, Primitive, Scalar};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::sync::Arc;

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::cmp::Ordering;
use std::ffi::c_uint;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! This API is completely unstable and subject to change.
// tidy-alphabetical-start
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(extern_types)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::marker::PhantomData;
use std::panic::AssertUnwindSafe;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(box_patterns)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_ssa/src/traits/builder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::ops::Deref;

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/check_consts/check.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations.
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::borrow::Cow;
use std::mem;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/interpret/call.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Manages calling a concrete function (with known MIR body) with argument passing,
//! and returning the return value to the caller.
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::borrow::Cow;

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/interpret/cast.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use rustc_abi::{FieldIdx, Integer};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/interpret/eval_context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#[cfg(bootstrap)]
use std::assert_matches::debug_assert_matches;
#[cfg(not(bootstrap))]
use std::debug_assert_matches;

use either::{Left, Right};
use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
mod simd;

#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use rustc_abi::{FIRST_VARIANT, FieldIdx, HasDataLayout, Size, VariantIdx};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//! integer. It is crucial that these operations call `check_align` *before*
//! short-circuiting the empty case!

#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::borrow::{Borrow, Cow};
use std::cell::Cell;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/interpret/operand.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Functions concerning immediate values and operands, and reading from operands.
//! All high-level functions to read from memory work on operands as sources.
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use either::{Either, Left, Right};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_const_eval/src/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
//! into a place.
//! All high-level functions to write to memory work on places as destinations.
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use either::{Either, Left, Right};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// tidy-alphabetical-start
#![allow(rustc::diagnostic_outside_of_impl)]
#![feature(array_try_map)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(if_let_guard)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_data_structures/src/graph/scc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
//! Typical examples would include: minimum element in SCC, maximum element
//! reachable from it, etc.
#[cfg(bootstrap)]
use std::assert_matches::debug_assert_matches;
#[cfg(not(bootstrap))]
use std::debug_assert_matches;
use std::fmt::Debug;
use std::marker::PhantomData;
use std::ops::Range;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#![feature(allocator_api)]
#![feature(ascii_char)]
#![feature(ascii_char_variants)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(auto_traits)]
#![feature(cfg_select)]
#![feature(core_intrinsics)]
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#![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))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(default_field_values)]
Expand All @@ -23,6 +23,9 @@

extern crate self as rustc_errors;

#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::backtrace::{Backtrace, BacktraceStatus};
use std::borrow::Cow;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
//! At present, however, we do run collection across all items in the
//! crate as a kind of pass. This should eventually be factored away.
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::cell::Cell;
use std::iter;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/collect/generics_of.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::ops::ControlFlow;

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/collect/predicates_of.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use hir::Node;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
//!
//! For more information about delegation design, see the tracking issue #118212.
#[cfg(bootstrap)]
use std::assert_matches::debug_assert_matches;
#[cfg(not(bootstrap))]
use std::debug_assert_matches;

use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def::DefKind;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ mod dyn_trait;
pub mod errors;
pub mod generics;

#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::slice;

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_analysis/src/impl_wf_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
//! specialization errors. These things can (and probably should) be
//! fixed, but for the moment it's easier to do these checks early.
#[cfg(bootstrap)]
use std::assert_matches::debug_assert_matches;
#[cfg(not(bootstrap))]
use std::debug_assert_matches;

use min_specialization::check_min_specialization;
use rustc_data_structures::fx::FxHashSet;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ 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))]
#![feature(gen_blocks)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// tidy-alphabetical-start
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#[cfg(bootstrap)]
use std::assert_matches::debug_assert_matches;
use std::cell::{Cell, RefCell};
use std::cmp::max;
#[cfg(not(bootstrap))]
use std::debug_assert_matches;
use std::ops::Deref;

use rustc_data_structures::fx::FxHashSet;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_infer/src/infer/outlives/verify.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use rustc_middle::ty::outlives::{Component, compute_alias_components_recursive};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_infer/src/infer/snapshot/undo_log.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// tidy-alphabetical-start
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(extend_one)]
#![recursion_limit = "512"] // For rustdoc
// tidy-alphabetical-end
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_lint/src/impl_trait_overcaptures.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#[cfg(bootstrap)]
use std::assert_matches::debug_assert_matches;
use std::cell::LazyCell;
#[cfg(not(bootstrap))]
use std::debug_assert_matches;

use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
use rustc_data_structures::unord::UnordSet;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(iter_order_by)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(array_windows))]
#![feature(allocator_api)]
#![feature(assert_matches)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(associated_type_defaults)]
#![feature(box_as_ptr)]
#![feature(box_patterns)]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_middle/src/ty/consts/kind.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;

use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

pub mod tls;

#[cfg(bootstrap)]
use std::assert_matches::debug_assert_matches;
use std::borrow::{Borrow, Cow};
use std::cmp::Ordering;
#[cfg(not(bootstrap))]
use std::debug_assert_matches;
use std::env::VarError;
use std::ffi::OsStr;
use std::hash::{Hash, Hasher};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_middle/src/ty/instance.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(bootstrap))]
use std::assert_matches;
#[cfg(bootstrap)]
use std::assert_matches::assert_matches;
use std::fmt;

Expand Down
Loading
Loading