]>
Commit | Line | Data |
---|---|---|
d9579d0f AL |
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 | ||
1b1a35ee XL |
9 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] |
10 | #![feature(array_windows)] | |
136023e0 XL |
11 | #![feature(associated_type_bounds)] |
12 | #![feature(auto_traits)] | |
064997fb | 13 | #![feature(cell_leak)] |
1b1a35ee | 14 | #![feature(control_flow_enum)] |
136023e0 XL |
15 | #![feature(extend_one)] |
16 | #![feature(hash_raw_entry)] | |
04454e1e | 17 | #![feature(hasher_prefixfree_extras)] |
136023e0 | 18 | #![feature(maybe_uninit_uninit_array)] |
f9f354fc | 19 | #![feature(min_specialization)] |
c295e0f8 XL |
20 | #![feature(never_type)] |
21 | #![feature(type_alias_impl_trait)] | |
136023e0 | 22 | #![feature(new_uninit)] |
136023e0 | 23 | #![feature(once_cell)] |
5099ac24 | 24 | #![feature(rustc_attrs)] |
2b03887a | 25 | #![feature(negative_impls)] |
416331ca | 26 | #![feature(test)] |
dfeec247 | 27 | #![feature(thread_id_value)] |
a2a8927a | 28 | #![feature(vec_into_raw_parts)] |
e1599b0c | 29 | #![allow(rustc::default_hash_types)] |
5e7ed085 | 30 | #![allow(rustc::potential_query_instability)] |
f2b60f7d FG |
31 | #![deny(rustc::untranslatable_diagnostic)] |
32 | #![deny(rustc::diagnostic_outside_of_impl)] | |
9fa01778 | 33 | |
54a0048b | 34 | #[macro_use] |
3dfed10e | 35 | extern crate tracing; |
ff7c6d11 XL |
36 | #[macro_use] |
37 | extern crate cfg_if; | |
3dfed10e XL |
38 | #[macro_use] |
39 | extern crate rustc_macros; | |
d9579d0f | 40 | |
5e7ed085 FG |
41 | pub use rustc_index::static_assert_size; |
42 | ||
9fa01778 XL |
43 | #[inline(never)] |
44 | #[cold] | |
45 | pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R { | |
dfeec247 | 46 | f() |
9fa01778 XL |
47 | } |
48 | ||
476ff2be | 49 | pub mod base_n; |
dc9dc135 | 50 | pub mod binary_search_util; |
dfeec247 | 51 | pub mod captures; |
8faf50e0 | 52 | pub mod flock; |
fc512014 | 53 | pub mod functor; |
8faf50e0 | 54 | pub mod fx; |
e9174d1e | 55 | pub mod graph; |
5099ac24 | 56 | pub mod intern; |
532ac7d7 | 57 | pub mod jobserver; |
dfeec247 | 58 | pub mod macros; |
ba9703b0 | 59 | pub mod map_in_place; |
7453a54e | 60 | pub mod obligation_forest; |
8faf50e0 | 61 | pub mod owning_ref; |
abe05a73 | 62 | pub mod sip128; |
b7449926 | 63 | pub mod small_c_str; |
5e7ed085 | 64 | pub mod small_str; |
3157f602 | 65 | pub mod snapshot_map; |
dfeec247 | 66 | pub mod svh; |
0531ce1d | 67 | pub use ena::snapshot_vec; |
cdc7bbd5 | 68 | pub mod memmap; |
8faf50e0 | 69 | pub mod sorted_map; |
dfeec247 XL |
70 | #[macro_use] |
71 | pub mod stable_hasher; | |
6c58768f XL |
72 | mod atomic_ref; |
73 | pub mod fingerprint; | |
74 | pub mod profiling; | |
416331ca | 75 | pub mod sharded; |
f9f354fc | 76 | pub mod stack; |
dfeec247 | 77 | pub mod sync; |
dfeec247 | 78 | pub mod tiny_list; |
8faf50e0 | 79 | pub mod transitive_relation; |
dfeec247 | 80 | pub mod vec_linked_list; |
17df50a5 | 81 | pub mod vec_map; |
dfeec247 XL |
82 | pub mod work_queue; |
83 | pub use atomic_ref::AtomicRef; | |
ba9703b0 | 84 | pub mod frozen; |
29967ef6 | 85 | pub mod sso; |
fc512014 | 86 | pub mod steal; |
3dfed10e XL |
87 | pub mod tagged_ptr; |
88 | pub mod temp_dir; | |
1b1a35ee | 89 | pub mod unhash; |
2b03887a | 90 | pub mod unord; |
e9174d1e | 91 | |
6c58768f XL |
92 | pub use ena::undo_log; |
93 | pub use ena::unify; | |
94 | ||
0531ce1d XL |
95 | pub struct OnDrop<F: Fn()>(pub F); |
96 | ||
94b46f34 | 97 | impl<F: Fn()> OnDrop<F> { |
dfeec247 XL |
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 | } | |
94b46f34 XL |
104 | } |
105 | ||
0531ce1d | 106 | impl<F: Fn()> Drop for OnDrop<F> { |
dfeec247 XL |
107 | #[inline] |
108 | fn drop(&mut self) { | |
109 | (self.0)(); | |
110 | } | |
0531ce1d XL |
111 | } |
112 | ||
ba9703b0 | 113 | // See comments in src/librustc_middle/lib.rs |
e9174d1e SL |
114 | #[doc(hidden)] |
115 | pub fn __noop_fix_for_27438() {} |