Skip to content

Commit 6cce6cb

Browse files
authored
Rollup merge of #136180 - lukas-code:typed-valtree, r=oli-obk
Introduce a wrapper for "typed valtrees" and properly check the type before extracting the value This PR adds a new wrapper type `ty::Value` to replace the tuple `(Ty, ty::ValTree)` and become the new canonical representation of type-level constant values. The value extraction methods `try_to_bits`/`try_to_bool`/`try_to_target_usize` are moved to this new type. For `try_to_bits` in particular, this avoids some redundant matches on `ty::ConstKind::Value`. Furthermore, these methods and will now properly check the type before extracting the value, which fixes some ICEs. The name `ty::Value` was chosen to be consistent with `ty::Expr`. Commit 1 should be non-functional and commit 2 adds the type check. --- fixes rust-lang/rust#131102 supercedes rust-lang/rust#136130 r? `@oli-obk` cc `@FedericoBruzzone` `@BoxyUwU`
2 parents 93db844 + a0d2e9f commit 6cce6cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/intrinsics/simd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
640640
let (dest, dest_len) = this.project_to_simd(dest)?;
641641

642642
let index =
643-
generic_args[2].expect_const().try_to_valtree().unwrap().0.unwrap_branch();
643+
generic_args[2].expect_const().to_value().valtree.unwrap_branch();
644644
let index_len = index.len();
645645

646646
assert_eq!(left_len, right_len);

0 commit comments

Comments
 (0)