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` |
||
|---|---|---|
| .. | ||
| bootstrap | ||
| build_helper | ||
| ci | ||
| doc | ||
| etc | ||
| gcc@fd3498bff0 | ||
| librustdoc | ||
| llvm-project@7e8c93c87c | ||
| rustc-std-workspace | ||
| rustdoc-json-types | ||
| tools | ||
| README.md | ||
| stage0 | ||
| version | ||
This directory contains some source code for the Rust project, including:
- The bootstrapping build system
- Various submodules for tools, like cargo, tidy, etc.
For more information on how various parts of the compiler work, see the rustc dev guide.