]> git.proxmox.com Git - rustc.git/blob - tests/ui/allocator/hygiene.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / allocator / hygiene.rs
1 // run-pass
2 // no-prefer-dynamic
3 // aux-build:custom.rs
4 // aux-build:helper.rs
5
6 #![allow(nonstandard_style)]
7
8 extern crate custom;
9 extern crate helper;
10
11 use custom::A;
12 use std::sync::atomic::{AtomicUsize, Ordering};
13
14 #[allow(dead_code)]
15 struct u8;
16 #[allow(dead_code)]
17 struct usize;
18 #[allow(dead_code)]
19 static arg0: () = ();
20
21 #[global_allocator]
22 pub static GLOBAL: A = A(AtomicUsize::new(0));
23
24 fn main() {
25 let n = GLOBAL.0.load(Ordering::SeqCst);
26 let s = Box::new(0);
27 helper::work_with(&s);
28 assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1);
29 drop(s);
30 assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
31 }