rust/src
Matthias Krüger 6a66a270b0
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`
2025-01-30 20:47:07 +01:00
..
bootstrap Rollup merge of #136157 - onur-ozkan:override-release-profile, r=Kobzol 2025-01-30 20:47:07 +01:00
build_helper Update username in build helper example 2025-01-28 10:51:30 +01:00
ci Auto merge of #136248 - matthiaskrgr:rollup-leaxgfd, r=matthiaskrgr 2025-01-29 16:18:29 +00:00
doc Auto merge of #136038 - compiler-errors:outlives, r=lcnr 2025-01-30 11:40:32 +00:00
etc Rollup merge of #135812 - Walnut356:gdb_osstring, r=Mark-Simulacrum 2025-01-26 01:51:15 -05:00
gcc@fd3498bff0 Update GCC version 2024-09-06 16:01:46 +02:00
librustdoc introduce ty::Value 2025-01-30 17:47:44 +01:00
llvm-project@7e8c93c87c Update to LLVM 19.1.7 2025-01-14 14:46:09 +01:00
rustc-std-workspace update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustdoc-json-types Rollup merge of #135799 - aDotInTheVoid:skrrt-skrrt-revrrt, r=GuillaumeGomez 2025-01-24 08:08:08 +01:00
tools Rollup merge of #136180 - lukas-code:typed-valtree, r=oli-obk 2025-01-30 20:47:07 +01:00
README.md
stage0 bump stage0 2025-01-08 20:03:28 +01:00
version bump version 2025-01-03 10:36:06 +01:00

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.