Rollup merge of #149183 - tiif:typing_env_fix, r=BoxyUwU

Use `TypingMode::PostAnalysis` in `try_evaluate_const`

As mentioned in https://github.com/rust-lang/rust/pull/148698#discussion_r2541882341, we should use ``TypingMode::PostAnalysis`` for that path.

````@BoxyUwU```` prefer the match in ``try_evaluate_const`` to be exhaustive, so I also included that in this PR :3
This commit is contained in:
Matthias Krüger 2025-12-04 08:46:19 +01:00 committed by GitHub
commit bea2f89de6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -681,7 +681,7 @@ pub fn try_evaluate_const<'tcx>(
(args, typing_env)
}
_ => {
Some(ty::AnonConstKind::MCG) | Some(ty::AnonConstKind::NonTypeSystem) | None => {
// We are only dealing with "truly" generic/uninferred constants here:
// - GCEConsts have been handled separately
// - Repeat expr count back compat consts have also been handled separately
@ -700,7 +700,7 @@ pub fn try_evaluate_const<'tcx>(
// Since there is no generic parameter, we can just drop the environment
// to prevent query cycle.
let typing_env = infcx.typing_env(ty::ParamEnv::empty());
let typing_env = ty::TypingEnv::fully_monomorphized();
(uv.args, typing_env)
}