Skip to content

Commit 1a14d17

Browse files
Require fmt::Debug to implement NonConstOp
1 parent dcecefc commit 1a14d17

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc_mir/transform/check_consts/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::Item;
1010
use super::validation::Mode;
1111

1212
/// An operation that is not *always* allowed in a const context.
13-
pub trait NonConstOp {
13+
pub trait NonConstOp: std::fmt::Debug {
1414
/// Whether this operation can be evaluated by miri.
1515
const IS_SUPPORTED_IN_MIRI: bool = true;
1616

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
750750
// FIXME(eddyb) we could split the errors into meaningful
751751
// categories, but enabling full miri would make that
752752
// slightly pointless (even with feature-gating).
753-
fn not_const(&mut self, op: impl NonConstOp + fmt::Debug) {
753+
fn not_const(&mut self, op: impl NonConstOp) {
754754
unleash_miri!(self);
755755
if self.mode.requires_const_checking() && !self.suppress_errors {
756756
self.record_error(op);
@@ -771,11 +771,11 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
771771
}
772772
}
773773

774-
fn record_error(&mut self, op: impl NonConstOp + fmt::Debug) {
774+
fn record_error(&mut self, op: impl NonConstOp) {
775775
self.record_error_spanned(op, self.span);
776776
}
777777

778-
fn record_error_spanned(&mut self, op: impl NonConstOp + fmt::Debug, span: Span) {
778+
fn record_error_spanned(&mut self, op: impl NonConstOp, span: Span) {
779779
self.errors.push((span, format!("{:?}", op)));
780780
}
781781

0 commit comments

Comments
 (0)