rust/compiler/rustc_codegen_cranelift/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
..
abi use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
debuginfo use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
driver Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into sync_cg_clif-2024-11-09 2024-11-09 13:48:06 +00:00
intrinsics Auto merge of #132460 - lcnr:questionable-uwu, r=compiler-errors 2024-11-18 21:07:05 +00:00
optimize Reformat use declarations. 2024-07-29 08:26:52 +10:00
allocator.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
analyze.rs rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
base.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
cast.rs Merge commit '93a5433f17ab5ed48cc88f1e69b0713b16183373' into sync_cg_clif-2023-10-24 2023-10-24 12:22:23 +00:00
codegen_i128.rs Merge commit '69b3f5a426a5c1c05236a45b36f6679d95fbe01b' into sync_cg_clif-2024-08-09 2024-08-09 17:18:46 +00:00
common.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
compiler_builtins.rs Merge commit '69b3f5a426a5c1c05236a45b36f6679d95fbe01b' into sync_cg_clif-2024-08-09 2024-08-09 17:18:46 +00:00
concurrency_limiter.rs Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
config.rs Merge commit '3270432f4b0583104c8b9b6f695bf97d6bbf3ac2' into sync_cg_clif-2024-05-13 2024-05-13 13:26:33 +00:00
constant.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
discriminant.rs cg_clif: rustc_abi::Abi => BackendRepr 2024-10-29 15:01:01 -07:00
global_asm.rs Rename target triple to target tuple in many places in the compiler 2024-11-02 21:29:59 +01:00
inline_asm.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
lib.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
linkage.rs
main_shim.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
num.rs Remove Rvalue::CheckedBinaryOp 2024-05-17 20:33:02 -07:00
pointer.rs Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into sync_cg_clif-2024-11-09 2024-11-09 13:48:06 +00:00
pretty_clif.rs Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into sync_cg_clif-2024-11-09 2024-11-09 13:48:06 +00:00
toolchain.rs Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24 2022-08-24 18:40:58 +02:00
trap.rs Merge commit '5b1246bb4bed72fd0bb8fa497d8e5ed2c7f3515c' into sync_cg_clif-2024-11-02 2024-11-02 14:53:30 +00:00
unsize.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
unwind_module.rs Merge commit '49cd5dd454d0115cfbe9e39102a8b3ba4616aa40' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
value_and_place.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
vtable.rs cg_clif: rustc_abi::Abi => BackendRepr 2024-10-29 15:01:01 -07:00