提交 c7c39ce6 编写于 作者: O Oli Scherer

We should never see unevaluated type-level constants after monomorphization unless errors occurred

上级 1d56b8a2
......@@ -648,7 +648,13 @@ fn visit_const(&mut self, constant: &&'tcx ty::Const<'tcx>, location: Location)
ty::ConstKind::Value(val) => collect_const_value(self.tcx, val, self.output),
ty::ConstKind::Unevaluated(unevaluated) => {
match self.tcx.const_eval_resolve(param_env, unevaluated, None) {
Ok(val) => collect_const_value(self.tcx, val, self.output),
// The `monomorphize` call should have evaluated that constant already.
Ok(val) => span_bug!(
self.body.source_info(location).span,
"collection encountered the unevaluated constant {} which evaluated to {:?}",
substituted_constant,
val
),
Err(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {}
Err(ErrorHandled::TooGeneric) => span_bug!(
self.body.source_info(location).span,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册