rust/src
bors 72b21e1a64 Auto merge of #139558 - camelid:mgca-const-items, r=oli-obk,BoxyUwU
mgca: Add ConstArg representation for const items

tracking issue: rust-lang/rust#132980
fixes rust-lang/rust#131046
fixes rust-lang/rust#134641

As part of implementing `min_generic_const_args`, we need to distinguish const items that can be used in the type system, such as in associated const equality projections, from const items containing arbitrary const code, which must be kept out of the type system. Specifically, all "type consts" must be either concrete (no generics) or generic with a trivial expression like `N` or a path to another type const item.

To syntactically distinguish these cases, we require, for now at least, that users annotate all type consts with the `#[type_const]` attribute. Then, we validate that the const's right-hand side is indeed eligible to be a type const and represent it differently in the HIR.

We accomplish this representation using a new `ConstItemRhs` enum in the HIR, and a similar but simpler enum in the AST. When `#[type_const]` is **not** applied to a const (e.g. on stable), we represent const item right-hand sides (rhs's) as HIR bodies, like before. However, when the attribute is applied, we instead lower to a `hir::ConstArg`. This syntactically distinguishes between trivial const args (paths) and arbitrary expressions, which are represented using `AnonConst`s. Then in `generics_of`, we can take advantage of the existing machinery to bar the `AnonConst` rhs's from using parent generics.
2025-11-08 22:31:33 +00:00
..
bootstrap Auto merge of #147935 - luca3s:add-rtsan, r=petrochenkov 2025-11-08 12:24:15 +00:00
build_helper Include additional hashes in src/stage0 2025-09-27 08:43:22 -04:00
ci Auto merge of #147029 - neuschaefer:memchr-2.7.6, r=marcoieni 2025-11-07 21:58:38 +00:00
doc Auto merge of #147935 - luca3s:add-rtsan, r=petrochenkov 2025-11-08 12:24:15 +00:00
etc Rollup merge of #148570 - TomFryersMidsummer:dir-locals, r=chenyukang 2025-11-07 00:21:21 -05:00
gcc@4e995bd73c Update GCC submodule 2025-08-26 18:09:42 +02:00
librustdoc Auto merge of #139558 - camelid:mgca-const-items, r=oli-obk,BoxyUwU 2025-11-08 22:31:33 +00:00
llvm-project@4f74b76fb6 Update LLVM to 21.1.3 2025-10-09 18:23:56 +08:00
rustc-std-workspace Generalize branch references to HEAD 2025-11-02 11:15:55 +01:00
rustdoc-json-types Add new doc(attribute = "...") attribute 2025-08-28 15:56:29 +02:00
tools Auto merge of #139558 - camelid:mgca-const-items, r=oli-obk,BoxyUwU 2025-11-08 22:31:33 +00:00
README.md
stage0 Bump stage0 to 1.92.0-beta.1 2025-10-28 13:35:43 -07:00
version Bump the version number to 1.93.0 2025-10-24 11:12:06 -07: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.