Skip to content

Commit 9f3f015

Browse files
committed
change StrLit type to ty::Value as well
1 parent 1870bd2 commit 9f3f015

File tree

1 file changed

+2
-5
lines changed
  • compiler/rustc_pattern_analysis/src

1 file changed

+2
-5
lines changed

compiler/rustc_pattern_analysis/src/rustc.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_hir::HirId;
88
use rustc_hir::def_id::DefId;
99
use rustc_index::{Idx, IndexVec};
1010
use rustc_middle::middle::stability::EvalResult;
11-
use rustc_middle::mir::{self, Const};
1211
use rustc_middle::thir::{self, Pat, PatKind, PatRange, PatRangeBoundary};
1312
use rustc_middle::ty::layout::IntegerExt;
1413
use rustc_middle::ty::{
@@ -580,9 +579,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
580579
// subfields.
581580
// Note: `t` is `str`, not `&str`.
582581
let ty = self.reveal_opaque_ty(*t);
583-
// FIXME: why does `Str` need a `mir::Const`?
584-
let val = mir::Const::from_ty_value(self.tcx, *value);
585-
let subpattern = DeconstructedPat::new(Str(val), Vec::new(), 0, ty, pat);
582+
let subpattern = DeconstructedPat::new(Str(*value), Vec::new(), 0, ty, pat);
586583
ctor = Ref;
587584
fields = vec![subpattern.at_index(0)];
588585
arity = 1;
@@ -894,7 +891,7 @@ impl<'p, 'tcx: 'p> PatCx for RustcPatCtxt<'p, 'tcx> {
894891
type Ty = RevealedTy<'tcx>;
895892
type Error = ErrorGuaranteed;
896893
type VariantIdx = VariantIdx;
897-
type StrLit = Const<'tcx>;
894+
type StrLit = ty::Value<'tcx>;
898895
type ArmData = HirId;
899896
type PatData = &'p Pat<'tcx>;
900897

0 commit comments

Comments
 (0)