diff options
Diffstat (limited to 'tests/ui/allocator/auxiliary/custom-as-global.rs')
-rw-r--r-- | tests/ui/allocator/auxiliary/custom-as-global.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/allocator/auxiliary/custom-as-global.rs b/tests/ui/allocator/auxiliary/custom-as-global.rs new file mode 100644 index 000000000..a5e96e775 --- /dev/null +++ b/tests/ui/allocator/auxiliary/custom-as-global.rs @@ -0,0 +1,16 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +extern crate custom; + +use std::sync::atomic::{AtomicUsize, Ordering}; + +use custom::A; + +#[global_allocator] +static ALLOCATOR: A = A(AtomicUsize::new(0)); + +pub fn get() -> usize { + ALLOCATOR.0.load(Ordering::SeqCst) +} |