Implement #[alloc_error_handler]#52191
Merged
bors merged 3 commits intorust-lang:masterfrom Jul 10, 2018
Merged
Conversation
…h ABI of the declaration in liballoc This turned out to be important on Windows. Calling `handle_alloc_error(Layout::new::<[u8; 42]>())` caused: ``` Exception thrown at 0x00007FF7C70DC399 in a.exe: 0xC0000005: Access violation reading location 0x000000000000002A. ``` 0x2A equals 42, so it looks like the `Layout::size` field of type `usize` was interpreted as a pointer to read from.
This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the alloc crate without the std crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
Contributor
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
|
Kudos to @ollie27 for catching the ABI mismatch (fixed in the first commit) #52110 (comment). This turned out to be the reason why the new test (now second commit) failed on Windows at #52110 (comment). Calling 0x2A equals 42, so it looks like the |
Member
|
@bors: r+ |
Collaborator
|
📌 Commit 239ec7d has been approved by |
Collaborator
|
⌛ Testing commit 239ec7d with merge 08fe845e78253595c097779dfc5b8f20e007dc6d... |
Collaborator
|
💔 Test failed - status-appveyor |
Contributor
Author
@bors retry |
Collaborator
bors
added a commit
that referenced
this pull request
Jul 10, 2018
Implement #[alloc_error_handler] This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the `alloc` crate without the `std` crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
Collaborator
|
☀️ Test successful - status-appveyor, status-travis |
This was referenced Jul 10, 2018
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This to-be-stable attribute is equivalent to
#[lang = "oom"]. It is required when using thealloccrate without thestdcrate. It is called byhandle_alloc_error, which is in turned called by "infallible" allocations APIs such asVec::push.