]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_data_structures/src/lib.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / compiler / rustc_data_structures / src / lib.rs
CommitLineData
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 35extern crate tracing;
ff7c6d11
XL
36#[macro_use]
37extern crate cfg_if;
3dfed10e
XL
38#[macro_use]
39extern crate rustc_macros;
d9579d0f 40
5e7ed085
FG
41pub use rustc_index::static_assert_size;
42
9fa01778
XL
43#[inline(never)]
44#[cold]
45pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
dfeec247 46 f()
9fa01778
XL
47}
48
476ff2be 49pub mod base_n;
dc9dc135 50pub mod binary_search_util;
dfeec247 51pub mod captures;
8faf50e0 52pub mod flock;
fc512014 53pub mod functor;
8faf50e0 54pub mod fx;
e9174d1e 55pub mod graph;
5099ac24 56pub mod intern;
532ac7d7 57pub mod jobserver;
dfeec247 58pub mod macros;
ba9703b0 59pub mod map_in_place;
7453a54e 60pub mod obligation_forest;
8faf50e0 61pub mod owning_ref;
abe05a73 62pub mod sip128;
b7449926 63pub mod small_c_str;
5e7ed085 64pub mod small_str;
3157f602 65pub mod snapshot_map;
dfeec247 66pub mod svh;
0531ce1d 67pub use ena::snapshot_vec;
cdc7bbd5 68pub mod memmap;
8faf50e0 69pub mod sorted_map;
dfeec247
XL
70#[macro_use]
71pub mod stable_hasher;
6c58768f
XL
72mod atomic_ref;
73pub mod fingerprint;
74pub mod profiling;
416331ca 75pub mod sharded;
f9f354fc 76pub mod stack;
dfeec247 77pub mod sync;
dfeec247 78pub mod tiny_list;
8faf50e0 79pub mod transitive_relation;
dfeec247 80pub mod vec_linked_list;
17df50a5 81pub mod vec_map;
dfeec247
XL
82pub mod work_queue;
83pub use atomic_ref::AtomicRef;
ba9703b0 84pub mod frozen;
29967ef6 85pub mod sso;
fc512014 86pub mod steal;
3dfed10e
XL
87pub mod tagged_ptr;
88pub mod temp_dir;
1b1a35ee 89pub mod unhash;
2b03887a 90pub mod unord;
e9174d1e 91
6c58768f
XL
92pub use ena::undo_log;
93pub use ena::unify;
94
0531ce1d
XL
95pub struct OnDrop<F: Fn()>(pub F);
96
94b46f34 97impl<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 106impl<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)]
115pub fn __noop_fix_for_27438() {}