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(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(negative_impls)]
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)]
39 extern crate rustc_macros;
41 pub use rustc_index::static_assert_size;
45 pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
50 pub mod binary_search_util;
60 pub mod obligation_forest;
67 pub use ena::snapshot_vec;
71 pub mod stable_hasher;
79 pub mod transitive_relation;
80 pub mod vec_linked_list;
83 pub use atomic_ref::AtomicRef;
92 pub use ena::undo_log;
95 pub struct OnDrop<F: Fn()>(pub F);
97 impl<F: Fn()> OnDrop<F> {
98 /// Forgets the function which prevents it from running.
99 /// Ensure that the function owns no memory, otherwise it will be leaked.
101 pub fn disable(self) {
102 std::mem::forget(self);
106 impl<F: Fn()> Drop for OnDrop<F> {
113 // See comments in src/librustc_middle/lib.rs
115 pub fn __noop_fix_for_27438() {}