-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Support allocation failures when interpreting MIR #86255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
524e575
Support allocation failures when interperting MIR
syvb b40f3c1
Simplify const_prop logic
syvb dc1c6c3
Make memory exhaustion a hard error
syvb 43b55cf
Simplify allocation creation
syvb 3e735a5
Unwrap allocated Location at creation
syvb a59fafe
Test memory exhaustion in const evaluation
syvb ab66c3f
Add comment with reasoning for non-determinism
syvb c94bafb
fix sess error
syvb d04da11
Properly handle const prop failures
syvb 55379bb
simplify explanation comment
syvb ba542ee
Rename is_spurious -> is_volatile
syvb 9f22794
Simplify memory failure checking
syvb 4c934df
Properly evaluate non-consts in const prop
syvb 12a8d10
Note that even ConstProp follows the rules
syvb 3e20129
Delay ICE on evaluation fail
syvb e9d69d9
Allocation failure in constprop panics right away
syvb b201b2f
Make vtable_allocation always succeed
syvb d83c46f
add note about MAX_ALLOC_LIMIT
syvb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// only-64bit | ||
// on 32bit and 16bit platforms it is plausible that the maximum allocation size will succeed | ||
|
||
const FOO: () = { | ||
// 128 TiB, unlikely anyone has that much RAM | ||
let x = [0_u8; (1 << 47) - 1]; | ||
//~^ ERROR evaluation of constant value failed | ||
}; | ||
|
||
static FOO2: () = { | ||
let x = [0_u8; (1 << 47) - 1]; | ||
//~^ ERROR could not evaluate static initializer | ||
}; | ||
|
||
fn main() { | ||
let _ = FOO; | ||
let _ = FOO2; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0080]: evaluation of constant value failed | ||
--> $DIR/large_const_alloc.rs:6:13 | ||
| | ||
LL | let x = [0_u8; (1 << 47) - 1]; | ||
| ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler | ||
|
||
error[E0080]: could not evaluate static initializer | ||
--> $DIR/large_const_alloc.rs:11:13 | ||
| | ||
LL | let x = [0_u8; (1 << 47) - 1]; | ||
| ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0080`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.