From 0942803f502d164883294e29238e3ac4822867ed Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Fri, 13 Mar 2015 03:19:30 +0100 Subject: Add an "allocator" attribute to mark functions as allocators When this attribute is applied to a function, its return value gets the noalias attribute, which is how you tell LLVM that the function returns a "new" pointer that doesn't alias anything accessible to the caller, i.e. it acts like a memory allocator. Plain malloc doesn't need this attribute because LLVM already knows about malloc and adds the attribute itself. --- src/libsyntax/feature_gate.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c3bac0cf57c..0a9980c8925 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -83,6 +83,7 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ ("box_syntax", "1.0.0", Active), ("on_unimplemented", "1.0.0", Active), ("simd_ffi", "1.0.0", Active), + ("allocator", "1.0.0", Active), ("if_let", "1.0.0", Accepted), ("while_let", "1.0.0", Accepted), @@ -230,6 +231,8 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[ ("rustc_on_unimplemented", Gated("on_unimplemented", "the `#[rustc_on_unimplemented]` attribute \ is an experimental feature")), + ("allocator", Gated("allocator", + "the `#[allocator]` attribute is an experimental feature")), ("rustc_variance", Gated("rustc_attrs", "the `#[rustc_variance]` attribute \ is an experimental feature")), -- cgit 1.4.1-3-g733a5