]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_data_structures/src/lib.rs
Auto merge of #103096 - petrochenkov:indresdoc, r=cjgillot
[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(test)]
26 #![feature(thread_id_value)]
27 #![feature(vec_into_raw_parts)]
28 #![allow(rustc::default_hash_types)]
29 #![allow(rustc::potential_query_instability)]
30 #![deny(rustc::untranslatable_diagnostic)]
31 #![deny(rustc::diagnostic_outside_of_impl)]
32
33 #[macro_use]
34 extern crate tracing;
35 #[macro_use]
36 extern crate cfg_if;
37 #[macro_use]
38 extern crate rustc_macros;
39
40 pub use rustc_index::static_assert_size;
41
42 #[inline(never)]
43 #[cold]
44 pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
45     f()
46 }
47
48 pub mod base_n;
49 pub mod binary_search_util;
50 pub mod captures;
51 pub mod flock;
52 pub mod functor;
53 pub mod fx;
54 pub mod graph;
55 pub mod intern;
56 pub mod jobserver;
57 pub mod macros;
58 pub mod map_in_place;
59 pub mod obligation_forest;
60 pub mod owning_ref;
61 pub mod sip128;
62 pub mod small_c_str;
63 pub mod small_str;
64 pub mod snapshot_map;
65 pub mod svh;
66 pub use ena::snapshot_vec;
67 pub mod memmap;
68 pub mod sorted_map;
69 #[macro_use]
70 pub mod stable_hasher;
71 mod atomic_ref;
72 pub mod fingerprint;
73 pub mod profiling;
74 pub mod sharded;
75 pub mod stack;
76 pub mod sync;
77 pub mod tiny_list;
78 pub mod transitive_relation;
79 pub mod vec_linked_list;
80 pub mod vec_map;
81 pub mod work_queue;
82 pub use atomic_ref::AtomicRef;
83 pub mod frozen;
84 pub mod sso;
85 pub mod steal;
86 pub mod tagged_ptr;
87 pub mod temp_dir;
88 pub mod unhash;
89
90 pub use ena::undo_log;
91 pub use ena::unify;
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     #[inline]
99     pub fn disable(self) {
100         std::mem::forget(self);
101     }
102 }
103
104 impl<F: Fn()> Drop for OnDrop<F> {
105     #[inline]
106     fn drop(&mut self) {
107         (self.0)();
108     }
109 }
110
111 // See comments in src/librustc_middle/lib.rs
112 #[doc(hidden)]
113 pub fn __noop_fix_for_27438() {}