summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/layout.rs
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-02-05 15:22:10 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-03-06 10:47:40 +0000
commite8f7a382be12a812b7d73f58967f740a0cf9d9af (patch)
tree81db85c4e7c42a85898967fe3b8601f9377d15e7 /compiler/rustc_ty_utils/src/layout.rs
parent0e7b2835735fc7fee08505fa6c14670bc7ee7601 (diff)
downloadrust-e8f7a382be12a812b7d73f58967f740a0cf9d9af.tar.gz
rust-e8f7a382be12a812b7d73f58967f740a0cf9d9af.zip
Remove the `Option` part of range ends in the HIR
Diffstat (limited to 'compiler/rustc_ty_utils/src/layout.rs')
-rw-r--r--compiler/rustc_ty_utils/src/layout.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index e5f4a8b87bb..a53f0538c58 100644
--- a/compiler/rustc_ty_utils/src/layout.rs
+++ b/compiler/rustc_ty_utils/src/layout.rs
@@ -205,7 +205,7 @@ fn layout_of_uncached<'tcx>(
             let layout = cx.layout_of(ty)?.layout;
             let mut layout = LayoutData::clone(&layout.0);
             match *pat {
-                ty::PatternKind::Range { start, end, include_end } => {
+                ty::PatternKind::Range { start, end } => {
                     if let BackendRepr::Scalar(scalar) | BackendRepr::ScalarPair(scalar, _) =
                         &mut layout.backend_repr
                     {
@@ -213,14 +213,9 @@ fn layout_of_uncached<'tcx>(
                             .try_to_bits(tcx, cx.typing_env)
                             .ok_or_else(|| error(cx, LayoutError::Unknown(ty)))?;
 
-                        let mut end = extract_const_value(cx, ty, end)?
+                        scalar.valid_range_mut().end = extract_const_value(cx, ty, end)?
                             .try_to_bits(tcx, cx.typing_env)
                             .ok_or_else(|| error(cx, LayoutError::Unknown(ty)))?;
-                        match include_end {
-                            rustc_hir::RangeEnd::Included => {}
-                            rustc_hir::RangeEnd::Excluded => end = end.wrapping_sub(1),
-                        }
-                        scalar.valid_range_mut().end = end;
 
                         let niche = Niche {
                             offset: Size::ZERO,