diff options
| author | Michael Goulet <michael@errs.io> | 2024-09-22 14:11:44 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-09-22 14:12:37 -0400 |
| commit | 2273aeed9decabdbbb0713a8b0749de0e9cd4ea7 (patch) | |
| tree | 8f70b3fb244172a6d34d6bde29974354de63cd40 /compiler/rustc_mir_build/src/thir/pattern | |
| parent | 0af7f0f4c4bdec179f42d0db4ec322040582de9d (diff) | |
Replace calls to Const::eval in mir build
Diffstat (limited to 'compiler/rustc_mir_build/src/thir/pattern')
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index d78e1f5da09..04e921ecc2e 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -441,7 +441,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { ty::Slice(..) => PatKind::Slice { prefix, slice, suffix }, // Fixed-length array, `[T; len]`. ty::Array(_, len) => { - let len = len.eval_target_usize(self.tcx, self.param_env); + let len = len + .try_to_target_usize(self.tcx) + .expect("expected len of array pat to be definite"); assert!(len >= prefix.len() as u64 + suffix.len() as u64); PatKind::Array { prefix, slice, suffix } } |
