diff options
| author | Ralf Jung <post@ralfj.de> | 2020-04-14 22:50:16 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-04-15 08:45:37 +0200 |
| commit | c0247c85d612581a3a58d4d9e1bcedd4a26c4bbc (patch) | |
| tree | d9dbeba069278153ddc26f2e75f74945e022ef6e | |
| parent | d28a46444eacf066ea0e7fdf6eda066e315aaa4a (diff) | |
| download | rust-c0247c85d612581a3a58d4d9e1bcedd4a26c4bbc.tar.gz rust-c0247c85d612581a3a58d4d9e1bcedd4a26c4bbc.zip | |
remove an impossible branch from check_consts
| -rw-r--r-- | src/librustc_mir/transform/check_consts/ops.rs | 10 | ||||
| -rw-r--r-- | src/librustc_mir/transform/check_consts/validation.rs | 11 |
2 files changed, 5 insertions, 16 deletions
diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index af7af7388bd..b3264a7a032 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -90,16 +90,6 @@ impl NonConstOp for FnCallNonConst { } } -/// A function call where the callee is not a function definition or function pointer, e.g. a -/// closure. -/// -/// This can be subdivided in the future to produce a better error message. -#[derive(Debug)] -pub struct FnCallOther; -impl NonConstOp for FnCallOther { - const IS_SUPPORTED_IN_MIRI: bool = false; -} - /// A call to a `#[unstable]` const fn or `#[rustc_const_unstable]` function. /// /// Contains the name of the feature that would allow the use of this function. diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index e4a0b9cdb48..16453dd289c 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -495,11 +495,11 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> { } } - fn visit_terminator_kind(&mut self, kind: &TerminatorKind<'tcx>, location: Location) { - trace!("visit_terminator_kind: kind={:?} location={:?}", kind, location); - self.super_terminator_kind(kind, location); + fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) { + trace!("visit_terminator: terminator={:?} location={:?}", terminator, location); + self.super_terminator(terminator, location); - match kind { + match &terminator.kind { TerminatorKind::Call { func, .. } => { let fn_ty = func.ty(*self.body, self.tcx); @@ -511,8 +511,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> { return; } _ => { - self.check_op(ops::FnCallOther); - return; + span_bug!(terminator.source_info.span, "invalid callee of type {:?}", fn_ty,) } }; |
