Skip to content

Commit 10fa334

Browse files
committed
Drop environment when evaluating const without generic parameters
1 parent eef8a02 commit 10fa334

File tree

1 file changed

+4
-3
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+4
-3
lines changed

compiler/rustc_trait_selection/src/traits/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,10 @@ pub fn try_evaluate_const<'tcx>(
635635
return Err(EvaluateConstErr::HasGenericsOrInfers);
636636
}
637637

638-
let typing_env = infcx
639-
.typing_env(tcx.erase_and_anonymize_regions(param_env))
640-
.with_post_analysis_normalized(tcx);
638+
// Since there is no generic parameter, we can just drop the environment
639+
// to prevent query cycle.
640+
let typing_env = infcx.typing_env(ty::ParamEnv::empty());
641+
641642
(uv.args, typing_env)
642643
}
643644
};

0 commit comments

Comments
 (0)