rust/src
bors b71fb5edc0 Auto merge of #132460 - lcnr:questionable-uwu, r=compiler-errors
Use `TypingMode` throughout the compiler instead of `ParamEnv`

Hopefully the biggest single PR as part of https://github.com/rust-lang/types-team/issues/128.

## `infcx.typing_env` while defining opaque types

I don't know how'll be able to correctly handle opaque types when using something taking a `TypingEnv` while defining opaque types. To correctly handle the opaques we need to be able to pass in the current `opaque_type_storage` and return constraints, i.e. we need to use a proper canonical query. We should migrate all the queries used during HIR typeck and borrowck where this matters to proper canonical queries. This is

## `layout_of` and `Reveal::All`

We convert the `ParamEnv` to `Reveal::All` right at the start of the `layout_of` query, so I've changed callers of `layout_of` to already use a post analysis `TypingEnv` when encountering it.

ca87b535a0/compiler/rustc_ty_utils/src/layout.rs (L51)

## `Ty::is_[unpin|sized|whatever]`

I haven't migrated `fn is_item_raw` to use `TypingEnv`, will do so in a followup PR, this should significantly reduce the amount of `typing_env.param_env`. At some point there will probably be zero such uses as using the type system while ignoring the `typing_mode` is incorrect.

## `MirPhase` and phase-transitions

When inside of a MIR-body, we can mostly use its `MirPhase` to figure out the right `typing_mode`. This does not work during phase transitions, most notably when transitioning from `Analysis` to `Runtime`:

dae7ac133b/compiler/rustc_mir_transform/src/lib.rs (L606-L625)

All these passes still run with `MirPhase::Analysis`, but we should only use `Reveal::All` once we're run the `RevealAll` pass. This required me to manually construct the right `TypingEnv` in all these passes. Given that it feels somewhat easy to accidentally miss this going forward, I would maybe like to change `Body::phase` to an `Option` and replace it at the start of phase transitions. This then makes it clear that the MIR is currently in a weird state.

r? `@ghost`
2024-11-18 21:07:05 +00:00
..
bootstrap fix clippy warns on windows (not checked by CI) 2024-11-13 15:08:49 +03:00
build_helper move src/tools/build_helper into src/build_helper 2024-11-11 11:19:11 +03:00
ci Auto merge of #132646 - jieyouxu:liberate-aarch64-gnu-debug, r=Kobzol 2024-11-17 20:51:52 +00:00
doc Rollup merge of #132793 - ehuss:update-mdbook, r=Mark-Simulacrum 2024-11-12 06:27:18 +01:00
etc Use a separate dir for r-a builds consistently in helix config 2024-11-09 01:27:29 +01:00
gcc@fd3498bff0
librustdoc use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
llvm-project@b35599be75 Update LLVM to 19.1.3 2024-10-30 22:34:45 +08:00
rustc-std-workspace update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustdoc-json-types Auto merge of #131980 - matthiaskrgr:rollup-iy5nw71, r=matthiaskrgr 2024-10-20 21:40:21 +00:00
tools Auto merge of #132460 - lcnr:questionable-uwu, r=compiler-errors 2024-11-18 21:07:05 +00:00
README.md
stage0 bump stage0 to 1.83.0-beta.1 2024-10-15 20:13:55 -07:00
version Bump to 1.84 2024-10-11 09:55:11 -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.