Skip to content

Commit dd32d91

Browse files
Remove CheckOpResult
1 parent 5117407 commit dd32d91

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/librustc_mir/transform/check_consts/validation.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ use super::qualifs::{self, HasMutInterior, NeedsDrop};
2323
use super::resolver::FlowSensitiveAnalysis;
2424
use super::{ConstKind, Item, Qualif, is_lang_panic_fn};
2525

26-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
27-
pub enum CheckOpResult {
28-
Forbidden,
29-
Unleashed,
30-
Allowed,
31-
}
32-
3326
pub type IndirectlyMutableResults<'mir, 'tcx> =
3427
old_dataflow::DataflowResultsCursor<'mir, 'tcx, IndirectlyMutableLocals<'mir, 'tcx>>;
3528

@@ -246,15 +239,15 @@ impl Validator<'a, 'mir, 'tcx> {
246239
}
247240

248241
/// Emits an error at the given `span` if an expression cannot be evaluated in the current
249-
/// context. Returns `Forbidden` if an error was emitted.
250-
pub fn check_op_spanned<O>(&mut self, op: O, span: Span) -> CheckOpResult
242+
/// context.
243+
pub fn check_op_spanned<O>(&mut self, op: O, span: Span)
251244
where
252245
O: NonConstOp
253246
{
254247
trace!("check_op: op={:?}", op);
255248

256249
if op.is_allowed_in_item(self) {
257-
return CheckOpResult::Allowed;
250+
return;
258251
}
259252

260253
// If an operation is supported in miri (and is not already controlled by a feature gate) it
@@ -264,20 +257,19 @@ impl Validator<'a, 'mir, 'tcx> {
264257

265258
if is_unleashable && self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
266259
self.tcx.sess.span_warn(span, "skipping const checks");
267-
return CheckOpResult::Unleashed;
260+
return;
268261
}
269262

270263
op.emit_error(self, span);
271-
CheckOpResult::Forbidden
272264
}
273265

274266
/// Emits an error if an expression cannot be evaluated in the current context.
275-
pub fn check_op(&mut self, op: impl NonConstOp) -> CheckOpResult {
267+
pub fn check_op(&mut self, op: impl NonConstOp) {
276268
let span = self.span;
277269
self.check_op_spanned(op, span)
278270
}
279271

280-
fn check_static(&mut self, def_id: DefId, span: Span) -> CheckOpResult {
272+
fn check_static(&mut self, def_id: DefId, span: Span) {
281273
let is_thread_local = self.tcx.has_attr(def_id, sym::thread_local);
282274
if is_thread_local {
283275
self.check_op_spanned(ops::ThreadLocalAccess, span)

0 commit comments

Comments
 (0)