rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.32k stars 12.58k forks source link

Remove `ParamEnv::reveal_all` from codegen #75327

Open davidtwco opened 4 years ago

davidtwco commented 4 years ago

Instead of using ParamEnv::reveal_all, the ParamEnv should be tracked in the mono item - this is necessary to enable more complex forms of polymorphization in future.

something simple like trying layout_of(ty) on various types in the MIR body and ignoring generics in ty if it succeeds, should work, but the lack of a correct ParamEnv would make it fail later (especially if e.g. it's something like &T which only has a constant layout if T: Sized)

(source: eddyb in Zulip)

RalfJung commented 4 years ago

Likely Miri would need similar changes? Or does it not matter because Miri doesn't actually monomorphize, we just run polymorphic MIR and track the current subst?

davidtwco commented 4 years ago

Likely Miri would need similar changes? Or does it not matter because Miri doesn't actually monomorphize, we just run polymorphic MIR and track the current subst?

It's possible - I'm not that sure.