fix: handle OOM gracefully in check_validity_requirement_strict [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #160788
Conversation
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @chenyukang (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Hi there, This looks like an automated submission, which is not permitted. We are thus suspending you as per our policies [1], [2] and contribution standards [3]. You can contact the moderation team to discuss and possibly reconsider your suspension. Thanks for understanding. Jieyou in the name of the mod team |
Description
When
-Zstrict-init-checks=yesis enabled and the compiler encounters a type that is too large to allocate (e.g.[[[bool; 9999999]; 777777777]; 239]),check_validity_requirement_strictcallscx.allocate()which returnsErr(ResourceExhaustion(MemoryExhausted)). The.expect("OOM: failed to allocate for uninit check")then panics, producing an ICE.This fix replaces the
.expect()with alet Ok(allocated) = ... else { return false; }pattern, handling the OOM gracefully by conservatively returningfalse(the type does not permit raw initialization) instead of ICEing.Testing
-Zalways-encode-mir -Zstrict-init-checks=yeson a file containing:Closes #160769