]> git.lizzy.rs Git - rust.git/blob - src/librustc_data_structures/lib.rs
Rollup merge of #55469 - pnkfelix:issue-54477-regression-tests, r=nikomatsakis
[rust.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(unboxed_closures)]
25 #![feature(fn_traits)]
26 #![feature(unsize)]
27 #![feature(specialization)]
28 #![feature(optin_builtin_traits)]
29 #![feature(nll)]
30 #![feature(allow_internal_unstable)]
31 #![feature(vec_resize_with)]
32
33 #![cfg_attr(unix, feature(libc))]
34 #![cfg_attr(test, feature(test))]
35
36 extern crate core;
37 extern crate ena;
38 #[macro_use]
39 extern crate log;
40 extern crate serialize as rustc_serialize; // used by deriving
41 #[cfg(unix)]
42 extern crate libc;
43 extern crate parking_lot;
44 #[macro_use]
45 extern crate cfg_if;
46 extern crate stable_deref_trait;
47 extern crate rustc_rayon as rayon;
48 extern crate rustc_rayon_core as rayon_core;
49 extern crate rustc_hash;
50 extern crate serialize;
51 extern crate graphviz;
52 extern crate smallvec;
53
54 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
55 #[allow(unused_extern_crates)]
56 extern crate rustc_cratesio_shim;
57
58 pub use rustc_serialize::hex::ToHex;
59
60 pub mod svh;
61 pub mod base_n;
62 pub mod bit_set;
63 pub mod const_cstr;
64 pub mod flock;
65 pub mod fx;
66 pub mod graph;
67 pub mod indexed_vec;
68 pub mod obligation_forest;
69 pub mod owning_ref;
70 pub mod ptr_key;
71 pub mod sip128;
72 pub mod small_c_str;
73 pub mod snapshot_map;
74 pub use ena::snapshot_vec;
75 pub mod sorted_map;
76 #[macro_use] pub mod stable_hasher;
77 pub mod sync;
78 pub mod tiny_list;
79 pub mod thin_vec;
80 pub mod transitive_relation;
81 pub mod tuple_slice;
82 pub use ena::unify;
83 pub mod vec_linked_list;
84 pub mod work_queue;
85 pub mod fingerprint;
86
87 pub struct OnDrop<F: Fn()>(pub F);
88
89 impl<F: Fn()> OnDrop<F> {
90       /// Forgets the function which prevents it from running.
91       /// Ensure that the function owns no memory, otherwise it will be leaked.
92       pub fn disable(self) {
93             std::mem::forget(self);
94       }
95 }
96
97 impl<F: Fn()> Drop for OnDrop<F> {
98       fn drop(&mut self) {
99             (self.0)();
100       }
101 }
102
103 // See comments in src/librustc/lib.rs
104 #[doc(hidden)]
105 pub fn __noop_fix_for_27438() {}