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(control_flow_enum)]
12 #![feature(in_band_lifetimes)]
13 #![feature(generator_trait)]
14 #![feature(min_specialization)]
15 #![feature(auto_traits)]
17 #![feature(allow_internal_unstable)]
18 #![feature(hash_raw_entry)]
19 #![feature(core_intrinsics)]
21 #![feature(associated_type_bounds)]
22 #![feature(thread_id_value)]
23 #![feature(extend_one)]
24 #![feature(const_panic)]
25 #![feature(new_uninit)]
26 #![feature(once_cell)]
27 #![feature(maybe_uninit_uninit_array)]
28 #![allow(rustc::default_hash_types)]
29 #![deny(unaligned_references)]
36 extern crate rustc_macros;
40 pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
48 #[allow(unused_unsafe)]
49 e => unsafe { std::intrinsics::likely(e) },
55 macro_rules! unlikely {
58 #[allow(unused_unsafe)]
59 e => unsafe { std::intrinsics::unlikely(e) },
65 pub mod binary_search_util;
75 pub mod obligation_forest;
83 pub use ena::snapshot_vec;
88 pub mod stable_hasher;
97 pub mod transitive_relation;
98 pub mod vec_linked_list;
100 pub use atomic_ref::AtomicRef;
108 pub use ena::undo_log;
111 pub struct OnDrop<F: Fn()>(pub F);
113 impl<F: Fn()> OnDrop<F> {
114 /// Forgets the function which prevents it from running.
115 /// Ensure that the function owns no memory, otherwise it will be leaked.
117 pub fn disable(self) {
118 std::mem::forget(self);
122 impl<F: Fn()> Drop for OnDrop<F> {
129 // See comments in src/librustc_middle/lib.rs
131 pub fn __noop_fix_for_27438() {}