Require fmt::Debug to implement NonConstOp

This commit is contained in:
Dylan MacKenzie 2019-09-25 11:58:12 -07:00
parent dcecefcb71
commit 1a14d17c4d
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@
use super::validation::Mode;
/// An operation that is not *always* allowed in a const context.
pub trait NonConstOp {
pub trait NonConstOp: std::fmt::Debug {
/// Whether this operation can be evaluated by miri.
const IS_SUPPORTED_IN_MIRI: bool = true;

View File

@ -750,7 +750,7 @@ fn new(tcx: TyCtxt<'tcx>, def_id: DefId, body: &'a Body<'tcx>, mode: Mode) -> Se
// FIXME(eddyb) we could split the errors into meaningful
// categories, but enabling full miri would make that
// slightly pointless (even with feature-gating).
fn not_const(&mut self, op: impl NonConstOp + fmt::Debug) {
fn not_const(&mut self, op: impl NonConstOp) {
unleash_miri!(self);
if self.mode.requires_const_checking() && !self.suppress_errors {
self.record_error(op);
@ -771,11 +771,11 @@ fn not_const(&mut self, op: impl NonConstOp + fmt::Debug) {
}
}
fn record_error(&mut self, op: impl NonConstOp + fmt::Debug) {
fn record_error(&mut self, op: impl NonConstOp) {
self.record_error_spanned(op, self.span);
}
fn record_error_spanned(&mut self, op: impl NonConstOp + fmt::Debug, span: Span) {
fn record_error_spanned(&mut self, op: impl NonConstOp, span: Span) {
self.errors.push((span, format!("{:?}", op)));
}