From 695dee063bcd40f154bb27b7beafcb3d4dd775ac Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 3 Jun 2017 14:54:08 -0700 Subject: rustc: Implement the #[global_allocator] attribute This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389 --- src/test/compile-fail/allocator/function-allocator.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/test/compile-fail/allocator/function-allocator.rs (limited to 'src/test/compile-fail/allocator/function-allocator.rs') diff --git a/src/test/compile-fail/allocator/function-allocator.rs b/src/test/compile-fail/allocator/function-allocator.rs new file mode 100644 index 00000000000..50f82607b53 --- /dev/null +++ b/src/test/compile-fail/allocator/function-allocator.rs @@ -0,0 +1,16 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(global_allocator)] + +#[global_allocator] +fn foo() {} //~ ERROR: allocators must be statics + +fn main() {} -- cgit 1.4.1-3-g733a5