diff options
| author | Ralf Jung <post@ralfj.de> | 2025-07-29 13:28:47 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-08-14 09:44:22 +0200 |
| commit | dbc030e0346f0958bea91601de7d115554bbf74e (patch) | |
| tree | 36b8fc36a117123562d8fdd65224b99ef1ccd21d /compiler/rustc_pattern_analysis | |
| parent | a1acbfb050675f197fd525c830203f07412148bd (diff) | |
| download | rust-dbc030e0346f0958bea91601de7d115554bbf74e.tar.gz rust-dbc030e0346f0958bea91601de7d115554bbf74e.zip | |
shrink TestBranch::Constant and PatRangeBoundary::Finite
Diffstat (limited to 'compiler/rustc_pattern_analysis')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/rustc.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index e4703ddfc45..97f1c842797 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -722,7 +722,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { match ScalarInt::try_from_uint(bits, size) { Some(scalar) => { let valtree = ty::ValTree::from_scalar_int(tcx, scalar); - PatRangeBoundary::Finite(ty::Value { ty: ty.inner(), valtree }) + PatRangeBoundary::Finite(valtree) } // The value doesn't fit. Since `x >= 0` and 0 always encodes the minimum value // for a type, the problem isn't that the value is too small. So it must be too @@ -742,7 +742,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { "_".to_string() } else if range.is_singleton() { let lo = cx.hoist_pat_range_bdy(range.lo, ty); - let value = lo.as_finite().unwrap(); + let value = ty::Value { ty: ty.inner(), valtree: lo.as_finite().unwrap() }; value.to_string() } else { // We convert to an inclusive range for diagnostics. @@ -756,7 +756,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { // probably clear enough. let max = ty.numeric_max_val(cx.tcx).unwrap(); let max = ty::ValTree::from_scalar_int(cx.tcx, max.try_to_scalar_int().unwrap()); - lo = PatRangeBoundary::Finite(ty::Value { ty: ty.inner(), valtree: max }); + lo = PatRangeBoundary::Finite(max); } let hi = if let Some(hi) = range.hi.minus_one() { hi |
