]> git.proxmox.com Git - rustc.git/blob - src/librustc_data_structures/lib.rs
1fdcab5f7a21505c37d654fdec414ef1342fd1da
[rustc.git] / src / librustc_data_structures / lib.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Various data structures used by the Rust compiler. The intention
12 //! is that code in here should be not be *specific* to rustc, so that
13 //! it can be easily unit tested and so forth.
14 //!
15 //! # Note
16 //!
17 //! This API is completely unstable and subject to change.
18
19 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
20 html_favicon_url = "https://www.rust-lang.org/favicon.ico",
21 html_root_url = "https://doc.rust-lang.org/nightly/")]
22
23 #![feature(in_band_lifetimes)]
24 #![feature(impl_header_lifetime_elision)]
25 #![feature(unboxed_closures)]
26 #![feature(fn_traits)]
27 #![feature(unsize)]
28 #![feature(specialization)]
29 #![feature(optin_builtin_traits)]
30 #![cfg_attr(stage0, feature(macro_vis_matcher))]
31 #![cfg_attr(not(stage0), feature(nll))]
32 #![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
33 #![feature(allow_internal_unstable)]
34 #![feature(vec_resize_with)]
35
36 #![cfg_attr(unix, feature(libc))]
37 #![cfg_attr(test, feature(test))]
38
39 extern crate core;
40 extern crate ena;
41 #[macro_use]
42 extern crate log;
43 extern crate serialize as rustc_serialize; // used by deriving
44 #[cfg(unix)]
45 extern crate libc;
46 extern crate parking_lot;
47 #[macro_use]
48 extern crate cfg_if;
49 extern crate stable_deref_trait;
50 extern crate rustc_rayon as rayon;
51 extern crate rustc_rayon_core as rayon_core;
52 extern crate rustc_hash;
53 extern crate serialize;
54 #[cfg_attr(test, macro_use)]
55 extern crate smallvec;
56
57 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
58 #[allow(unused_extern_crates)]
59 extern crate rustc_cratesio_shim;
60
61 pub use rustc_serialize::hex::ToHex;
62
63 pub mod svh;
64 pub mod array_vec;
65 pub mod base_n;
66 pub mod bitvec;
67 pub mod const_cstr;
68 pub mod flock;
69 pub mod fx;
70 pub mod graph;
71 pub mod indexed_set;
72 pub mod indexed_vec;
73 pub mod obligation_forest;
74 pub mod owning_ref;
75 pub mod ptr_key;
76 pub mod sip128;
77 pub mod small_c_str;
78 pub mod small_vec;
79 pub mod snapshot_map;
80 pub use ena::snapshot_vec;
81 pub mod sorted_map;
82 #[macro_use] pub mod stable_hasher;
83 pub mod sync;
84 pub mod tiny_list;
85 pub mod thin_vec;
86 pub mod transitive_relation;
87 pub mod tuple_slice;
88 pub use ena::unify;
89 pub mod vec_linked_list;
90 pub mod work_queue;
91 pub mod fingerprint;
92
93 pub struct OnDrop<F: Fn()>(pub F);
94
95 impl<F: Fn()> OnDrop<F> {
96 /// Forgets the function which prevents it from running.
97 /// Ensure that the function owns no memory, otherwise it will be leaked.
98 pub fn disable(self) {
99 std::mem::forget(self);
100 }
101 }
102
103 impl<F: Fn()> Drop for OnDrop<F> {
104 fn drop(&mut self) {
105 (self.0)();
106 }
107 }
108
109 // See comments in src/librustc/lib.rs
110 #[doc(hidden)]
111 pub fn __noop_fix_for_27438() {}