diff --git a/compiler/rustc_infer/src/traits/mod.rs b/compiler/rustc_infer/src/traits/mod.rs index 7e7c8588ffb40..a3c4920fa8af3 100644 --- a/compiler/rustc_infer/src/traits/mod.rs +++ b/compiler/rustc_infer/src/traits/mod.rs @@ -57,7 +57,7 @@ pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>; // `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger. #[cfg(target_arch = "x86_64")] -static_assert_size!(PredicateObligation<'_>, 40); +static_assert_size!(PredicateObligation<'_>, 32); pub type Obligations<'tcx, O> = Vec>; pub type PredicateObligations<'tcx> = Vec>; diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index d6cf68a900ce0..b7530c077ccd1 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1751,9 +1751,6 @@ pub struct ParamEnv<'tcx> { /// /// Note: This is packed, use the reveal() method to access it. packed: CopyTaggedPtr<&'tcx List>, traits::Reveal, true>, - - /// FIXME: This field is not used, but removing it causes a performance degradation. See #76913. - unused_field: Option, } unsafe impl rustc_data_structures::tagged_ptr::Tag for traits::Reveal { @@ -1834,7 +1831,7 @@ impl<'tcx> ParamEnv<'tcx> { /// Construct a trait environment with the given set of predicates. #[inline] pub fn new(caller_bounds: &'tcx List>, reveal: Reveal) -> Self { - ty::ParamEnv { packed: CopyTaggedPtr::new(caller_bounds, reveal), unused_field: None } + ty::ParamEnv { packed: CopyTaggedPtr::new(caller_bounds, reveal) } } pub fn with_user_facing(mut self) -> Self { diff --git a/compiler/rustc_mir_build/src/thir/pattern/_match.rs b/compiler/rustc_mir_build/src/thir/pattern/_match.rs index 904524e13ae08..04de9a7a58dda 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/_match.rs @@ -1787,9 +1787,32 @@ impl<'tcx> IntRange<'tcx> { param_env: ty::ParamEnv<'tcx>, pat: &Pat<'tcx>, ) -> Option> { - match pat_constructor(tcx, param_env, pat)? { - IntRange(range) => Some(range), - _ => None, + // This MUST be kept in sync with `pat_constructor`. + match *pat.kind { + PatKind::AscribeUserType { .. } => bug!(), // Handled by `expand_pattern` + PatKind::Or { .. } => bug!("Or-pattern should have been expanded earlier on."), + + PatKind::Binding { .. } + | PatKind::Wild + | PatKind::Leaf { .. } + | PatKind::Deref { .. } + | PatKind::Variant { .. } + | PatKind::Array { .. } + | PatKind::Slice { .. } => None, + + PatKind::Constant { value } => Self::from_const(tcx, param_env, value, pat.span), + + PatKind::Range(PatRange { lo, hi, end }) => { + let ty = lo.ty; + Self::from_range( + tcx, + lo.eval_bits(tcx, param_env, lo.ty), + hi.eval_bits(tcx, param_env, hi.ty), + ty, + &end, + pat.span, + ) + } } } @@ -2196,6 +2219,7 @@ fn pat_constructor<'tcx>( param_env: ty::ParamEnv<'tcx>, pat: &Pat<'tcx>, ) -> Option> { + // This MUST be kept in sync with `IntRange::from_pat`. match *pat.kind { PatKind::AscribeUserType { .. } => bug!(), // Handled by `expand_pattern` PatKind::Binding { .. } | PatKind::Wild => None, diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 7e5be8276f7ff..fdebd88a086c7 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -87,7 +87,7 @@ pub struct PendingPredicateObligation<'tcx> { // `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger. #[cfg(target_arch = "x86_64")] -static_assert_size!(PendingPredicateObligation<'_>, 64); +static_assert_size!(PendingPredicateObligation<'_>, 56); impl<'a, 'tcx> FulfillmentContext<'tcx> { /// Creates a new fulfillment context.