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.
7 //! This API is completely unstable and subject to change.
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(bool_to_option)]
14 #![feature(control_flow_enum)]
15 #![feature(core_intrinsics)]
16 #![feature(extend_one)]
18 #![feature(hash_raw_entry)]
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)]
27 #![feature(thread_id_value)]
28 #![feature(vec_into_raw_parts)]
29 #![allow(rustc::default_hash_types)]
30 #![deny(unaligned_references)]
31 #![allow(rustc::potential_query_instability)]
38 extern crate rustc_macros;
40 pub use rustc_index::static_assert_size;
44 pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
52 #[allow(unused_unsafe)]
53 e => unsafe { std::intrinsics::likely(e) },
59 macro_rules! unlikely {
62 #[allow(unused_unsafe)]
63 e => unsafe { std::intrinsics::unlikely(e) },
69 pub mod binary_search_util;
79 pub mod obligation_forest;
87 pub use ena::snapshot_vec;
92 pub mod stable_hasher;
101 pub mod transitive_relation;
102 pub mod vec_linked_list;
105 pub use atomic_ref::AtomicRef;
113 pub use ena::undo_log;
116 pub struct OnDrop<F: Fn()>(pub F);
118 impl<F: Fn()> OnDrop<F> {
119 /// Forgets the function which prevents it from running.
120 /// Ensure that the function owns no memory, otherwise it will be leaked.
122 pub fn disable(self) {
123 std::mem::forget(self);
127 impl<F: Fn()> Drop for OnDrop<F> {
134 // See comments in src/librustc_middle/lib.rs
136 pub fn __noop_fix_for_27438() {}