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 https://github.com/rust-lang/rust/issues/131102 supercedes https://github.com/rust-lang/rust/pull/136130 r? `@oli-obk` cc `@FedericoBruzzone` `@BoxyUwU`
This commit is contained in:
commit
6a66a270b0
50 changed files with 296 additions and 225 deletions
|
@ -1329,7 +1329,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
|
|||
}
|
||||
|
||||
if name == sym::simd_shuffle_generic {
|
||||
let idx = fn_args[2].expect_const().try_to_valtree().unwrap().0.unwrap_branch();
|
||||
let idx = fn_args[2].expect_const().to_value().valtree.unwrap_branch();
|
||||
let n = idx.len() as u64;
|
||||
|
||||
let (out_len, out_ty) = require_simd!(ret_ty, SimdReturn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue