rust/compiler/rustc_builtin_macros/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
..
assert Fix docs in compiler/rustc_builtin_macros/src/assert/context.rs 2022-09-29 16:49:20 +09:00
deriving Mark derived StructuralEq as automatically derived. 2022-10-15 15:16:32 +00:00
format Update doc comments. 2022-09-27 13:31:52 +02:00
format_foreign update tests 2021-12-31 12:51:27 -05:00
alloc_error_handler.rs Rewrite implementation of #[alloc_error_handler] 2022-10-31 16:32:57 +00:00
asm.rs Use AttrVec in more places. 2022-08-22 07:35:33 +10:00
assert.rs Box the MacCall in various types. 2022-08-17 08:10:56 +10:00
cfg_accessible.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
cfg_eval.rs Workaround unstable stmt_expr_attributes for method receiver expressions. 2022-10-23 09:27:12 +00:00
cfg.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
cmdline_attrs.rs make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
compile_error.rs check_doc_keyword: don't alloc string for emptiness check 2022-04-08 11:45:57 +03:00
concat_bytes.rs Remove the symbol from ast::LitKind::Err. 2022-08-23 16:56:24 +10:00
concat_idents.rs Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
concat.rs Remove the symbol from ast::LitKind::Err. 2022-08-23 16:56:24 +10:00
derive.rs make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
edition_panic.rs Box the MacCall in various types. 2022-08-17 08:10:56 +10:00
env.rs check_doc_keyword: don't alloc string for emptiness check 2022-04-08 11:45:57 +03:00
format_foreign.rs [rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape 2021-12-31 12:42:15 -05:00
format.rs Fix format_args capture for macro expanded format strings 2022-09-30 17:40:14 +01:00
global_allocator.rs Replace rustc_data_structures::thin_vec::ThinVec with thin_vec::ThinVec. 2022-08-29 15:42:13 +10:00
lib.rs Rewrite implementation of #[alloc_error_handler] 2022-10-31 16:32:57 +00:00
log_syntax.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
proc_macro_harness.rs Use AttrVec in more places. 2022-08-22 07:35:33 +10:00
source_util.rs Make ExtCtxt::expr_lit non-pub. 2022-08-16 11:17:15 +10:00
standard_library_imports.rs Replace rustc_data_structures::thin_vec::ThinVec with thin_vec::ThinVec. 2022-08-29 15:42:13 +10:00
test_harness.rs Rollup merge of #99939 - saethlin:pre-sort-tests, r=thomcc,jackh726 2022-10-24 19:32:25 +09:00
test.rs Rollup merge of #99939 - saethlin:pre-sort-tests, r=thomcc,jackh726 2022-10-24 19:32:25 +09:00
trace_macros.rs Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
util.rs Add a lint for duplicated attributes. 2021-12-15 23:43:13 +01:00