]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_data_structures/src/lib.rs
Auto merge of #100845 - timvermeulen:iter_compare, r=scottmcm
[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 #![cfg_attr(bootstrap, feature(let_else))]
17 #![feature(hash_raw_entry)]
18 #![feature(hasher_prefixfree_extras)]
19 #![feature(maybe_uninit_uninit_array)]
20 #![feature(min_specialization)]
21 #![feature(never_type)]
22 #![feature(type_alias_impl_trait)]
23 #![feature(new_uninit)]
24 #![feature(once_cell)]
25 #![feature(rustc_attrs)]
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
91 pub use ena::undo_log;
92 pub use ena::unify;
93
94 pub struct OnDrop<F: Fn()>(pub F);
95
96 impl<F: Fn()> OnDrop<F> {
97     /// Forgets the function which prevents it from running.
98     /// Ensure that the function owns no memory, otherwise it will be leaked.
99     #[inline]
100     pub fn disable(self) {
101         std::mem::forget(self);
102     }
103 }
104
105 impl<F: Fn()> Drop for OnDrop<F> {
106     #[inline]
107     fn drop(&mut self) {
108         (self.0)();
109     }
110 }
111
112 // See comments in src/librustc_middle/lib.rs
113 #[doc(hidden)]
114 pub fn __noop_fix_for_27438() {}