The combination of alloc_error_handler and target_features_11 is unsound
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
The following code compiles:
#![feature(target_feature_11, alloc_error_handler)]
#[target_feature(enable = "avx")]
#[alloc_error_handler]
fn f(_: std::alloc::Layout) -> ! {
panic!()
}
However, this is unsound if the allocation error handler is invoked on a machine that does not support avx.
The alloc_error_handler feature is still unstable, tracking issue: https://github.com/rust-lang/rust/issues/51540
This issue emerged during the stabilization PR for target_features_11: https://github.com/rust-lang/rust/pull/134090
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example with the target_features_11 and alloc_error_handler features, then read tracking issue 51540 and stabilization PR 134090. Determine how the two features should interact so an allocation error handler cannot be invoked with unsupported AVX, and verify the resulting behavior on such a target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100