rust/compiler/rustc_passes/src
Amanieu d'Antras 56074b5231 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).
2022-10-31 16:32:57 +00:00
..
liveness Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
check_attr.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
check_const.rs Remove code that was removed in master, and the corresponding diagnostic 2022-10-07 13:19:28 -06:00
dead.rs Rewrite implementation of #[alloc_error_handler] 2022-10-31 16:32:57 +00:00
debugger_visualizer.rs migrate debugger_visualizer.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
diagnostic_items.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
entry.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
errors.rs Rewrite implementation of #[alloc_error_handler] 2022-10-31 16:32:57 +00:00
hir_id_validator.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
hir_stats.rs Rename AssocItemKind::TyAlias to AssocItemKind::Type 2022-10-10 02:31:37 +00:00
lang_items.rs Simplify lang item groups 2022-10-29 16:04:10 -05:00
layout_test.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
lib_features.rs migrate lib_features.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
lib.rs Add lint for diagnostic migration 2022-10-07 13:19:26 -06:00
liveness.rs Refactor rustc lint API 2022-10-01 10:03:06 +00:00
loops.rs migrate loops.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
naked_functions.rs migrate naked_functions.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
reachable.rs Improve LanguageItems api 2022-10-29 16:04:04 -05:00
stability.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
upvars.rs Rename local_did to def_id 2022-07-29 18:26:10 -04:00
weak_lang_items.rs Rewrite implementation of #[alloc_error_handler] 2022-10-31 16:32:57 +00:00