rustc_data_structures/
lib.rs1#![allow(internal_features)]
11#![allow(rustc::default_hash_types)]
12#![allow(rustc::potential_query_instability)]
13#![deny(unsafe_op_in_unsafe_fn)]
14#![feature(allocator_api)]
15#![feature(ascii_char)]
16#![feature(ascii_char_variants)]
17#![feature(assert_matches)]
18#![feature(auto_traits)]
19#![feature(cfg_select)]
20#![feature(const_default)]
21#![feature(const_trait_impl)]
22#![feature(core_intrinsics)]
23#![feature(dropck_eyepatch)]
24#![feature(extend_one)]
25#![feature(file_buffered)]
26#![feature(map_try_insert)]
27#![feature(min_specialization)]
28#![feature(negative_impls)]
29#![feature(never_type)]
30#![feature(ptr_alignment_type)]
31#![feature(rustc_attrs)]
32#![feature(sized_hierarchy)]
33#![feature(test)]
34#![feature(thread_id_value)]
35#![feature(trusted_len)]
36#![feature(type_alias_impl_trait)]
37#![feature(unwrap_infallible)]
38#[cfg(bootstrap)]
45pub use std::assert_matches::{assert_matches, debug_assert_matches};
46use std::fmt;
47#[cfg(not(bootstrap))]
48pub use std::{assert_matches, debug_assert_matches};
49
50pub use atomic_ref::AtomicRef;
51pub use ena::{snapshot_vec, undo_log, unify};
52pub use hashbrown::hash_table;
56pub use rustc_index::static_assert_size;
57pub use {either, indexmap, smallvec, thin_vec};
59
60pub mod aligned;
61pub mod base_n;
62pub mod binary_search_util;
63pub mod fingerprint;
64pub mod flat_map_in_place;
65pub mod flock;
66pub mod frozen;
67pub mod fx;
68pub mod graph;
69pub mod intern;
70pub mod jobserver;
71pub mod marker;
72pub mod memmap;
73pub mod obligation_forest;
74pub mod owned_slice;
75pub mod packed;
76pub mod profiling;
77pub mod sharded;
78pub mod small_c_str;
79pub mod snapshot_map;
80pub mod sorted_map;
81pub mod sso;
82pub mod stable_hasher;
83pub mod stack;
84pub mod steal;
85pub mod svh;
86pub mod sync;
87pub mod tagged_ptr;
88pub mod temp_dir;
89pub mod thinvec;
90pub mod thousands;
91pub mod transitive_relation;
92pub mod unhash;
93pub mod union_find;
94pub mod unord;
95pub mod vec_cache;
96pub mod work_queue;
97
98mod atomic_ref;
99
100#[inline(never)]
102#[cold]
103pub fn outline<F: FnOnce() -> R, R>(f: F) -> R {
104 f()
105}
106
107pub fn defer<F: FnOnce()>(f: F) -> OnDrop<F> {
109 OnDrop(Some(f))
110}
111
112pub struct OnDrop<F: FnOnce()>(Option<F>);
113
114impl<F: FnOnce()> OnDrop<F> {
115 #[inline]
117 pub fn disable(mut self) {
118 self.0.take();
119 }
120}
121
122impl<F: FnOnce()> Drop for OnDrop<F> {
123 #[inline]
124 fn drop(&mut self) {
125 if let Some(f) = self.0.take() {
126 f();
127 }
128 }
129}
130
131pub struct FatalErrorMarker;
133
134pub fn make_display(f: impl Fn(&mut fmt::Formatter<'_>) -> fmt::Result) -> impl fmt::Display {
136 struct Printer<F> {
137 f: F,
138 }
139 impl<F> fmt::Display for Printer<F>
140 where
141 F: Fn(&mut fmt::Formatter<'_>) -> fmt::Result,
142 {
143 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
144 (self.f)(fmt)
145 }
146 }
147
148 Printer { f }
149}
150
151#[doc(hidden)]
153pub fn __noop_fix_for_windows_dllimport_issue() {}
154
155#[macro_export]
156macro_rules! external_bitflags_debug {
157 ($Name:ident) => {
158 impl ::std::fmt::Debug for $Name {
159 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
160 ::bitflags::parser::to_writer(self, f)
161 }
162 }
163 };
164}