Remove QUALIF_ERROR_BIT
checking
This commit is contained in:
parent
1bd30ce2aa
commit
1924cc8c7d
@ -582,30 +582,9 @@ impl<'tcx> Validator<'_, 'tcx> {
|
||||
Operand::Copy(place) |
|
||||
Operand::Move(place) => self.validate_place(place.as_ref()),
|
||||
|
||||
Operand::Constant(constant) => {
|
||||
if let ty::ConstKind::Unevaluated(def_id, _) = constant.literal.val {
|
||||
if self.tcx.trait_of_item(def_id).is_some() {
|
||||
// Don't peek inside trait associated constants.
|
||||
// (see below what we do for other consts, for now)
|
||||
} else {
|
||||
// HACK(eddyb) ensure that errors propagate correctly.
|
||||
// FIXME(eddyb) remove this once the old promotion logic
|
||||
// is gone - we can always promote constants even if they
|
||||
// fail to pass const-checking, as compilation would've
|
||||
// errored independently and promotion can't change that.
|
||||
let bits = self.tcx.at(constant.span).mir_const_qualif(def_id);
|
||||
if bits == super::qualify_consts::QUALIF_ERROR_BIT {
|
||||
self.tcx.sess.delay_span_bug(
|
||||
constant.span,
|
||||
"promote_consts: MIR had errors",
|
||||
);
|
||||
return Err(Unpromotable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
// The qualifs for a constant (e.g. `HasMutInterior`) are checked in
|
||||
// `validate_rvalue` upon access.
|
||||
Operand::Constant(_) => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> u8 {
|
||||
|
||||
if body.return_ty().references_error() {
|
||||
tcx.sess.delay_span_bug(body.span, "mir_const_qualif: MIR had errors");
|
||||
return QUALIF_ERROR_BIT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Checker::new(tcx, def_id, body, Mode::Const).check_const()
|
||||
|
Loading…
x
Reference in New Issue
Block a user