Skip to content

Commit b6f0bf7

Browse files
authored
Rollup merge of rust-lang#149183 - tiif:typing_env_fix, r=BoxyUwU
Use `TypingMode::PostAnalysis` in `try_evaluate_const` As mentioned in rust-lang#148698 (comment), 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
2 parents 62c8df1 + af66b68 commit b6f0bf7

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+2
-2
lines changed

compiler/rustc_trait_selection/src/traits/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ pub fn try_evaluate_const<'tcx>(
681681

682682
(args, typing_env)
683683
}
684-
_ => {
684+
Some(ty::AnonConstKind::MCG) | Some(ty::AnonConstKind::NonTypeSystem) | None => {
685685
// We are only dealing with "truly" generic/uninferred constants here:
686686
// - GCEConsts have been handled separately
687687
// - Repeat expr count back compat consts have also been handled separately
@@ -700,7 +700,7 @@ pub fn try_evaluate_const<'tcx>(
700700

701701
// Since there is no generic parameter, we can just drop the environment
702702
// to prevent query cycle.
703-
let typing_env = infcx.typing_env(ty::ParamEnv::empty());
703+
let typing_env = ty::TypingEnv::fully_monomorphized();
704704

705705
(uv.args, typing_env)
706706
}

0 commit comments

Comments
 (0)