rust
rust copied to clipboard
Rewrite implementation of `#[alloc_error_handler]`
The new implementation doesn't use weak lang items and instead changes #[alloc_error_handler]
to an attribute macro just like #[global_allocator]
.
The attribute will generate the __rg_oom
function which is called by the compiler-generated __rust_alloc_error_handler
. If no __rg_oom
function is defined in any crate then the compiler shim will call __rdl_oom
in the alloc crate which will simply panic.
This also fixes link errors with -C link-dead-code
with default_alloc_error_handler
: __rg_oom
was previously defined in the alloc crate and would attempt to reference the oom
lang item, even if it didn't exist. This worked as long as __rg_oom
was excluded from linking since it was not called.
This is a prerequisite for the stabilization of default_alloc_error_handler
(#102318).
r? @lcnr
(rust-highfive has picked a reviewer for you, use r? to override)
Hey! It looks like you've submitted a new PR for the library teams!
If this PR contains changes to any rust-lang/rust
public library APIs then please comment with @rustbot label +T-libs-api -T-libs
to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.
Examples of T-libs-api
changes:
- Stabilizing library features
- Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
- Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
- Changing public documentation in ways that create new stability guarantees
- Changing observable runtime behavior of library APIs
rustc_error_messages
was changed
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki
Some changes occurred in compiler/rustc_codegen_gcc
cc @antoyo
Some changes occurred in compiler/rustc_codegen_cranelift
cc @bjorn3
r? compiler
:umbrella: The latest upstream changes (presumably #103310) made this pull request unmergeable. Please resolve the merge conflicts.
r? compiler not sure if I'm the best person to review this
r? @bjorn3 as you've been working on this recently
r=me with merge conflicts fixed.
Hi, I've seen you changed some diagnostic structs in your PR. After #103345, the way we refer to fluent messages changed. They are now in a flat namespace with the same identifier as in the fluent file. For example, parser::cool_thing
is now parser_cool_thing
and parser::suggestion
just suggestion
.
You should rebase to the latest master and change your fluent message references as described above. Thanks!
@bors r+
:pushpin: Commit d2352e11fa03ff32cddaf9f7bcad8907007f2539 has been approved by bjorn3
It is now in the queue for this repository.
:umbrella: The latest upstream changes (presumably #103797) made this pull request unmergeable. Please resolve the merge conflicts.
@bors r=bjorn3
:pushpin: Commit 56074b5231ceef266a1097ea355f62c951e1b468 has been approved by bjorn3
It is now in the queue for this repository.