diff options
| author | Ralf Jung <post@ralfj.de> | 2024-11-18 08:42:42 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-11-18 20:48:03 +0100 |
| commit | c6974344a5707c054ed808ea9c724dd93ec3c680 (patch) | |
| tree | 19a084178f1325d2e252df447af7bd3e3b7a163d /compiler/rustc_const_eval/src/interpret/eval_context.rs | |
| parent | 3fb7e441aecc3c054d71eb4d752d06e7776e8888 (diff) | |
| download | rust-c6974344a5707c054ed808ea9c724dd93ec3c680.tar.gz rust-c6974344a5707c054ed808ea9c724dd93ec3c680.zip | |
interpret: do not ICE when a promoted fails with OOM
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/eval_context.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/eval_context.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index ff6d5b28b3b..eb574bd5f77 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -596,6 +596,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // const-eval will return "tainted" errors if e.g. the layout cannot // be computed as the type references non-existing names. // See <https://github.com/rust-lang/rust/issues/124348>. + } else if reported.can_be_spurious() { + // These errors can just sometimes happen, even when the expression + // is nominally "infallible", e.g. when running out of memory. } else { // Looks like the const is not captured by `required_consts`, that's bad. span_bug!(span, "interpret const eval failure of {val:?} which is not in required_consts"); |
