diff options
| author | Ralf Jung <post@ralfj.de> | 2022-03-26 13:03:49 -0400 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-03-26 13:17:07 -0400 |
| commit | 78b680e14a287a98ec0501116607bb49b31c9f28 (patch) | |
| tree | 216fb12ae76a532f0577de66b25dad759e9d52d3 | |
| parent | 1fca19c8ca4ae5e71e8b17a82c3acfeb78c48891 (diff) | |
| download | rust-78b680e14a287a98ec0501116607bb49b31c9f28.tar.gz rust-78b680e14a287a98ec0501116607bb49b31c9f28.zip | |
interpret: mark a dead match arm as dead
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/eval_context.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index d78c7a9fad9..abd7094440e 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -444,6 +444,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { match scalar.try_to_int() { Ok(int) => int.is_null(), Err(_) => { + // Can only happen during CTFE. let ptr = self.scalar_to_ptr(scalar); match self.memory.ptr_try_get_alloc(ptr) { Ok((alloc_id, offset, _)) => { @@ -455,7 +456,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // Note that one-past-the-end (offset == size) is still inbounds, and never null. offset > size } - Err(offset) => offset == 0, + Err(_offset) => bug!("a non-int scalar is always a pointer"), } } } |
