]> git.lizzy.rs Git - rust.git/blob - src/librustc_data_structures/lib.rs
Allow a dirty MirBuilt for make_extern and make_method_extern
[rust.git] / src / librustc_data_structures / lib.rs
1 //! Various data structures used by the Rust compiler. The intention
2 //! is that code in here should be not be *specific* to rustc, so that
3 //! it can be easily unit tested and so forth.
4 //!
5 //! # Note
6 //!
7 //! This API is completely unstable and subject to change.
8
9 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
10
11 #![feature(in_band_lifetimes)]
12 #![feature(unboxed_closures)]
13 #![feature(fn_traits)]
14 #![feature(unsize)]
15 #![feature(specialization)]
16 #![feature(optin_builtin_traits)]
17 #![feature(nll)]
18 #![feature(allow_internal_unstable)]
19 #![feature(hash_raw_entry)]
20 #![feature(stmt_expr_attributes)]
21 #![feature(core_intrinsics)]
22 #![feature(integer_atomics)]
23
24 #![cfg_attr(unix, feature(libc))]
25 #![cfg_attr(test, feature(test))]
26
27 extern crate core;
28 extern crate ena;
29 #[macro_use]
30 extern crate log;
31 extern crate serialize as rustc_serialize; // used by deriving
32 #[cfg(unix)]
33 extern crate libc;
34 extern crate parking_lot;
35 #[macro_use]
36 extern crate cfg_if;
37 extern crate stable_deref_trait;
38 extern crate rustc_rayon as rayon;
39 extern crate rustc_rayon_core as rayon_core;
40 extern crate rustc_hash;
41 extern crate serialize;
42 extern crate graphviz;
43 extern crate smallvec;
44
45 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
46 #[allow(unused_extern_crates)]
47 extern crate rustc_cratesio_shim;
48
49 pub use rustc_serialize::hex::ToHex;
50
51 #[macro_export]
52 macro_rules! likely {
53       ($e:expr) => {
54             #[allow(unused_unsafe)]
55             {
56                   unsafe { std::intrinsics::likely($e) }
57             }
58       }
59 }
60
61 #[macro_export]
62 macro_rules! unlikely {
63     ($e:expr) => {
64             #[allow(unused_unsafe)]
65             {
66                   unsafe { std::intrinsics::unlikely($e) }
67             }
68       }
69 }
70
71 pub mod macros;
72 pub mod svh;
73 pub mod base_n;
74 pub mod bit_set;
75 pub mod const_cstr;
76 pub mod flock;
77 pub mod fx;
78 pub mod graph;
79 pub mod indexed_vec;
80 pub mod interner;
81 pub mod obligation_forest;
82 pub mod owning_ref;
83 pub mod ptr_key;
84 pub mod sip128;
85 pub mod small_c_str;
86 pub mod snapshot_map;
87 pub use ena::snapshot_vec;
88 pub mod sorted_map;
89 #[macro_use] pub mod stable_hasher;
90 pub mod sync;
91 pub mod tiny_list;
92 pub mod thin_vec;
93 pub mod transitive_relation;
94 pub use ena::unify;
95 pub mod vec_linked_list;
96 pub mod work_queue;
97 pub mod fingerprint;
98
99 pub struct OnDrop<F: Fn()>(pub F);
100
101 impl<F: Fn()> OnDrop<F> {
102       /// Forgets the function which prevents it from running.
103       /// Ensure that the function owns no memory, otherwise it will be leaked.
104       #[inline]
105       pub fn disable(self) {
106             std::mem::forget(self);
107       }
108 }
109
110 impl<F: Fn()> Drop for OnDrop<F> {
111       #[inline]
112       fn drop(&mut self) {
113             (self.0)();
114       }
115 }
116
117 // See comments in src/librustc/lib.rs
118 #[doc(hidden)]
119 pub fn __noop_fix_for_27438() {}