Ensure param-env is const before calling `eval_to_valtree` by compiler-errors ·...
source link: https://github.com/rust-lang/rust/pull/105847
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Other queries call ParamEnv::with_const
inside of the query itself (e.g. const_eval_global_id_for_typeck
), so this could alternatively be moved into the provider of eval_to_valtree
instead. I don't have a particularly strong opinion, though theoretically caching is better if we make the query keys more constrained.
I'm not exactly sure how this is an effect of the -Zmir-opt-level=3
flag. Maybe something about the inliner causes us to inline an unevaluated const into a body where it can be evaluated, but where it has not yet been normalized.
This seems likely, since we're inlining from_fn_1::<{ N / 2 }, _>
in from_fn_2
, which means that we will need to evaluate that constant during the const prop pass after inlining.
Fixes #104396
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK