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`.
This commit is contained in:
Simon Sapin 2018-07-06 15:49:52 +02:00
parent 872effa118
commit 239ec7d2dc
16 changed files with 224 additions and 7 deletions

View file

@ -481,6 +481,9 @@ declare_features! (
// Allows async and await syntax
(active, async_await, "1.28.0", Some(50547), None),
// #[alloc_error_handler]
(active, alloc_error_handler, "1.29.0", Some(51540), None),
);
declare_features! (
@ -1083,6 +1086,11 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
"#[panic_implementation] is an unstable feature",
cfg_fn!(panic_implementation))),
("alloc_error_handler", Normal, Gated(Stability::Unstable,
"alloc_error_handler",
"#[alloc_error_handler] is an unstable feature",
cfg_fn!(alloc_error_handler))),
// Crate level attributes
("crate_name", CrateLevel, Ungated),
("crate_type", CrateLevel, Ungated),