]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_data_structures/src/lib.rs
Auto merge of #103975 - oli-obk:tracing, r=jackh726
[rust.git] / compiler / rustc_data_structures / src / 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/nightly-rustc/")]
10 #![feature(array_windows)]
11 #![feature(associated_type_bounds)]
12 #![feature(auto_traits)]
13 #![feature(cell_leak)]
14 #![feature(control_flow_enum)]
15 #![feature(extend_one)]
16 #![feature(hash_raw_entry)]
17 #![feature(hasher_prefixfree_extras)]
18 #![feature(maybe_uninit_uninit_array)]
19 #![feature(min_specialization)]
20 #![feature(never_type)]
21 #![feature(type_alias_impl_trait)]
22 #![feature(new_uninit)]
23 #![feature(once_cell)]
24 #![feature(rustc_attrs)]
25 #![feature(negative_impls)]
26 #![feature(test)]
27 #![feature(thread_id_value)]
28 #![feature(vec_into_raw_parts)]
29 #![allow(rustc::default_hash_types)]
30 #![allow(rustc::potential_query_instability)]
31 #![deny(rustc::untranslatable_diagnostic)]
32 #![deny(rustc::diagnostic_outside_of_impl)]
33
34 #[macro_use]
35 extern crate tracing;
36 #[macro_use]
37 extern crate cfg_if;
38 #[macro_use]
39 extern crate rustc_macros;
40
41 pub use rustc_index::static_assert_size;
42
43 #[inline(never)]
44 #[cold]
45 pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
46     f()
47 }
48
49 pub mod base_n;
50 pub mod binary_search_util;
51 pub mod captures;
52 pub mod flock;
53 pub mod functor;
54 pub mod fx;
55 pub mod graph;
56 pub mod intern;
57 pub mod jobserver;
58 pub mod macros;
59 pub mod map_in_place;
60 pub mod obligation_forest;
61 pub mod owning_ref;
62 pub mod sip128;
63 pub mod small_c_str;
64 pub mod small_str;
65 pub mod snapshot_map;
66 pub mod svh;
67 pub use ena::snapshot_vec;
68 pub mod memmap;
69 pub mod sorted_map;
70 #[macro_use]
71 pub mod stable_hasher;
72 mod atomic_ref;
73 pub mod fingerprint;
74 pub mod profiling;
75 pub mod sharded;
76 pub mod stack;
77 pub mod sync;
78 pub mod tiny_list;
79 pub mod transitive_relation;
80 pub mod vec_linked_list;
81 pub mod vec_map;
82 pub mod work_queue;
83 pub use atomic_ref::AtomicRef;
84 pub mod frozen;
85 pub mod sso;
86 pub mod steal;
87 pub mod tagged_ptr;
88 pub mod temp_dir;
89 pub mod unhash;
90 pub mod unord;
91
92 pub use ena::undo_log;
93 pub use ena::unify;
94
95 pub struct OnDrop<F: Fn()>(pub F);
96
97 impl<F: Fn()> OnDrop<F> {
98     /// Forgets the function which prevents it from running.
99     /// Ensure that the function owns no memory, otherwise it will be leaked.
100     #[inline]
101     pub fn disable(self) {
102         std::mem::forget(self);
103     }
104 }
105
106 impl<F: Fn()> Drop for OnDrop<F> {
107     #[inline]
108     fn drop(&mut self) {
109         (self.0)();
110     }
111 }
112
113 // See comments in src/librustc_middle/lib.rs
114 #[doc(hidden)]
115 pub fn __noop_fix_for_27438() {}