Skip to content

Conversation

@ChayimFriedman2
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 commented Nov 30, 2025

We don't need it anymore; ParamEnv is enough.

A lot of code relied on getting the crate from the TraitEnvironment. Some had it readily available from other sources, some changed to take a new struct ParamEnvAndCrate.

I believe some of the code that used to take a TraitEnvironment, now taking ParamEnvAndCrate, e.g. layout and mir eval, only needs the crate - but I'm not entirely sure and this is not for this PR.

We don't need it anymore; `ParamEnv` is enough.

A lot of code relied on getting the crate from the `TraitEnvironment`. Some had it readily available from other sources, some changed to take a new struct `ParamEnvAndCrate`.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 30, 2025
@flodiebold
Copy link
Member

I believe some of the code that used to take a TraitEnvironment, now taking ParamEnvAndCrate, e.g. layout and mir eval, only needs the crate - but I'm not entirely sure and this is not for this PR.

It has seemed weird to me that layout takes an env, yeah. OTOH rustc's layout query also takes one 🤔

@flodiebold
Copy link
Member

It looks to me like layout mostly gets called with an empty env after monomorphization in rustc, but there might be some places that call it before monorphization to e.g. see whether something is a ZST 🤔

@flodiebold
Copy link
Member

flodiebold commented Dec 1, 2025

Looking at our MIR evaluation, I don't think it ever actually gets called with a not-None environment 🤔

  • the only place that passes Some env to interpret_mir is const_eval_query
  • the only place that calls const_eval with a not-None env is in turn MIR eval.

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Dec 2, 2025
Merged via the queue into rust-lang:master with commit b35437d Dec 2, 2025
15 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the param-env branch December 2, 2025 03:03
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants