about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-30 20:47:07 +0100
committerGitHub <noreply@github.com>2025-01-30 20:47:07 +0100
commit6a66a270b09abc76110db5558b8a2220ae9b71bd (patch)
tree660cf407243b75d7f84a5476f7cc3690aa9f0f89 /compiler/rustc_hir_analysis/src
parent6c9c69813d40a65ad2fe368adc985a2e28e43a25 (diff)
parentca3ff832e34cc32d93c9e940d8f6d3e4034203fa (diff)
downloadrust-6a66a270b09abc76110db5558b8a2220ae9b71bd.tar.gz
rust-6a66a270b09abc76110db5558b8a2220ae9b71bd.zip
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`
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
0 files changed, 0 insertions, 0 deletions