self.super_statement(statement, location);
}
StatementKind::FakeRead(FakeReadCause::ForMatchedPlace, _) => {
- self.check_op(ops::IfOrMatch);
+ // FIXME: make this the `emit_error` impl of `ops::IfOrMatch` once the const
+ // checker is no longer run in compatability mode.
+ if !self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
+ self.tcx.sess.delay_span_bug(
+ self.span,
+ "complex control flow is forbidden in a const context",
+ );
+ }
}
// FIXME(eddyb) should these really do nothing?
StatementKind::FakeRead(..) |
bb = target;
}
_ => {
- self.not_const(ops::Loop);
- validator.check_op(ops::Loop);
+ if !self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
+ self.tcx.sess.delay_span_bug(
+ self.span,
+ "complex control flow is forbidden in a const context",
+ );
+ }
break;
}
}
self.super_statement(statement, location);
}
StatementKind::FakeRead(FakeReadCause::ForMatchedPlace, _) => {
- self.not_const(ops::IfOrMatch);
+ if !self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
+ self.tcx.sess.delay_span_bug(
+ self.span,
+ "complex control flow is forbidden in a const context",
+ );
+ }
}
// FIXME(eddyb) should these really do nothing?
StatementKind::FakeRead(..) |
}
fn check_mod_const_bodies(tcx: TyCtxt<'_>, module_def_id: DefId) {
- if tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
- return;
- }
-
let mut vis = CheckConstVisitor::new(tcx);
tcx.hir().visit_item_likes_in_module(module_def_id, &mut vis.as_deep_visitor());
}
/// Emits an error when an unsupported expression is found in a const context.
fn const_check_violated(&self, bad_op: &str, span: Span) {
+ if self.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
+ self.sess.span_warn(span, "skipping const checks");
+ return;
+ }
+
let const_kind = self.const_kind
.expect("`const_check_violated` may only be called inside a const context");