Skip to content

Commit 551d4ab

Browse files
committed
Fix after const eval API change
1 parent 1765afc commit 551d4ab

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/monomorphize_collector.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,14 +586,17 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
586586
fn visit_constant(&mut self, constant: &mir::ConstOperand<'tcx>, location: Location) {
587587
let const_ = self.monomorphize(constant.const_);
588588
let param_env = ty::ParamEnv::reveal_all();
589-
let val = match const_.eval(self.tcx, param_env, None) {
589+
let val = match const_.eval(self.tcx, param_env, constant.span) {
590590
Ok(v) => v,
591-
Err(ErrorHandled::Reported(..)) => return,
592591
Err(ErrorHandled::TooGeneric(..)) => span_bug!(
593592
self.body.source_info(location).span,
594593
"collection encountered polymorphic constant: {:?}",
595594
const_
596595
),
596+
Err(err @ ErrorHandled::Reported(..)) => {
597+
err.emit_note(self.tcx);
598+
return;
599+
}
597600
};
598601
collect_const_value(self.tcx, val, self.output);
599602
MirVisitor::visit_ty(self, const_.ty(), TyContext::Location(location));

src/preempt_count/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<'mir, 'tcx, 'cx> MirVisitor<'tcx> for MirNeighborVisitor<'mir, 'tcx, 'cx> {
357357

358358
let const_ = self.monomorphize(constant.const_);
359359
let param_env = ty::ParamEnv::reveal_all();
360-
let val = match const_.eval(self.cx.tcx, param_env, None) {
360+
let val = match const_.eval(self.cx.tcx, param_env, constant.span) {
361361
Ok(v) => v,
362362
Err(ErrorHandled::Reported(..)) => return,
363363
Err(ErrorHandled::TooGeneric(..)) => {

0 commit comments

Comments
 (0)