diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-08-03 20:55:50 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-08-11 19:57:30 +1000 |
| commit | 9952e4d4c8ba5def2861e1a39af61506f0a91655 (patch) | |
| tree | 00f5a5f10151b4652e597a6931537367e56a1146 /compiler/rustc_pattern_analysis/src/rustc.rs | |
| parent | 283243ac5a3bcf68627491ea64b0d725db8c62f3 (diff) | |
| download | rust-9952e4d4c8ba5def2861e1a39af61506f0a91655.tar.gz rust-9952e4d4c8ba5def2861e1a39af61506f0a91655.zip | |
Remove `PatKind::Constant`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/rustc.rs')
| -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 97d4a94756d..9bd17b822af 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -784,7 +784,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { } else if range.is_singleton() { let lo = cx.hoist_pat_range_bdy(range.lo, ty); let value = lo.as_finite().unwrap(); - PatKind::Constant { value } + PatKind::Print(value.to_string()) } else { // We convert to an inclusive range for diagnostics. let mut end = rustc_hir::RangeEnd::Included; @@ -827,7 +827,8 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { let cx = self; let hoist = |p| Box::new(cx.hoist_witness_pat(p)); let kind = match pat.ctor() { - Bool(b) => PatKind::Constant { value: mir::Const::from_bool(cx.tcx, *b) }, + Bool(b) => PatKind::Print(b.to_string()), + Str(s) => PatKind::Print(s.to_string()), IntRange(range) => return self.hoist_pat_range(range, *pat.ty()), Struct if pat.ty().is_box() => { // Outside of the `alloc` crate, the only way to create a struct pattern @@ -901,7 +902,6 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { PatKind::Slice { prefix, has_dot_dot, suffix } } - &Str(value) => PatKind::Constant { value }, Never if self.tcx.features().never_patterns => PatKind::Never, Never | Wildcard | NonExhaustive | Hidden | PrivateUninhabited => { PatKind::Print("_".to_string()) |
