diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 6032bcacec6a4..3af90bde86e64 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -618,7 +618,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 @@ -637,7 +637,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) }