rust/src
bors aa95b9648a Auto merge of #138464 - compiler-errors:less-type-ir, r=lcnr
Use `rustc_type_ir` directly less in the codebase

cc https://github.com/rust-lang/rust/issues/138449

This is a somewhat opinionated bundle of changes that will make working on https://github.com/rust-lang/rust/issues/138449 more easy, since it cuts out the bulk of the changes that would be necessitated by the lint. Namely:

1. Fold `rustc_middle::ty::fold` and `rustc_middle::ty::visit` into `rustc_middle::ty`. This is because we already reexport some parts of these modules into `rustc_middle::ty`, and there's really no benefit from namespacing away the rest of these modules's functionality given how important folding and visiting is to the type layer.
2. Rename `{Decodable,Encodable}_Generic` to `{Decodable,Encodable}_NoContext`[^why], change it to be "perfect derive" (`synstructure::AddBounds::Fields`), use it throughout `rustc_type_ir` instead of `TyEncodable`/`TyDecodable`.
3. Make `TyEncodable` and `TyDecodable` derives use `::rustc_middle::ty::codec::TyEncoder` (etc) for its generated paths, and move the `rustc_type_ir::codec` module back to `rustc_middle::ty::codec` 🎉.
4. Stop using `rustc_type_ir` in crates that aren't "fundamental" to the type system, namely middle/infer/trait-selection. This amounted mostly to changing imports from `use rustc_type_ir::...` to `use rustc_middle::ty::...`, but also this means that we can't glob import `TyKind::*` since the reexport into `rustc_middle::ty::TyKind` is a type alias. Instead, use the prefixed variants like `ty::Str` everywhere -- IMO this is a good change, since it makes it more regularized with most of the rest of the compiler.

[^why]: `_NoContext` is the name for derive macros with no additional generic bounds and which do "perfect derive" by generating bounds based on field types. See `HashStable_NoContext`.

I'm happy to cut out some of these changes into separate PRs to make landing it a bit easier, though I don't expect to have much trouble with bitrot.

r? lcnr
2025-03-15 08:36:38 +00:00
..
bootstrap Rollup merge of #138451 - Kobzol:gcc-ci-build-gcc, r=GuillaumeGomez 2025-03-15 00:18:23 +01:00
build_helper Add post-merge analysis CI workflow 2025-03-07 09:43:52 +01:00
ci Rollup merge of #138507 - Kobzol:netbsd-mirror, r=Mark-Simulacrum 2025-03-15 00:18:26 +01:00
doc Rollup merge of #138485 - BoxyUwU:rdg-push, r=jieyouxu 2025-03-14 17:26:37 +01:00
etc Remove separate src/tools/x from rust-analyzer settings 2025-03-13 12:21:21 -07:00
gcc@48664a6cab Update gcc submodule 2025-02-26 09:23:52 +01:00
librustdoc Squash fold into ty 2025-03-15 06:34:36 +00:00
llvm-project@1c3bb96fdb Update to LLVM 20 rc 3 2025-02-27 09:34:19 +01:00
rustc-std-workspace update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustdoc-json-types make precise capturing args in rustdoc Json typed 2025-03-10 21:40:09 +09:00
tools Auto merge of #138464 - compiler-errors:less-type-ir, r=lcnr 2025-03-15 08:36:38 +00:00
README.md
stage0 bump stage0 2025-02-18 08:51:01 -08:00
version Bump to version 1.87.0 2025-02-14 09:55:45 -08: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.