diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-09-25 11:58:12 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-09-28 07:06:52 -0700 |
| commit | 1a14d17c4d7f8a5cc6a068355230c811f0fef19b (patch) | |
| tree | 89e4be2da82a5d37f06819a6f93c571dbf441ea9 | |
| parent | dcecefcb712c0fd714013fcdf8499f4d65f220b8 (diff) | |
| download | rust-1a14d17c4d7f8a5cc6a068355230c811f0fef19b.tar.gz rust-1a14d17c4d7f8a5cc6a068355230c811f0fef19b.zip | |
Require `fmt::Debug` to implement `NonConstOp`
| -rw-r--r-- | src/librustc_mir/transform/check_consts/ops.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/transform/qualify_consts.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index 31e981d2b5a..a05a13dc123 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -10,7 +10,7 @@ use super::Item; 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; diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index fef918b3298..5add7a64aab 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -750,7 +750,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { // 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 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { } } - 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))); } |
