1 // run-pass
2 // no-prefer-dynamic
3 // aux-build:custom.rs
4 // aux-build:helper.rs
5 
6 extern crate custom;
7 extern crate helper;
8 
9 use custom::A;
10 use std::sync::atomic::{AtomicUsize, Ordering};
11 
12 mod submodule {
13     use super::*;
14 
15     #[global_allocator]
16     pub static GLOBAL: A = A(AtomicUsize::new(0));
17 }
18 
main()19 fn main() {
20     let n = submodule::GLOBAL.0.load(Ordering::SeqCst);
21     let s = Box::new(0);
22     helper::work_with(&s);
23     assert_eq!(submodule::GLOBAL.0.load(Ordering::SeqCst), n + 1);
24     drop(s);
25     assert_eq!(submodule::GLOBAL.0.load(Ordering::SeqCst), n + 2);
26 }
27