diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /compiler/rustc_data_structures/src/lib.rs | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_data_structures/src/lib.rs')
-rw-r--r-- | compiler/rustc_data_structures/src/lib.rs | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs new file mode 100644 index 000000000..265f45b72 --- /dev/null +++ b/compiler/rustc_data_structures/src/lib.rs @@ -0,0 +1,113 @@ +//! Various data structures used by the Rust compiler. The intention +//! is that code in here should be not be *specific* to rustc, so that +//! it can be easily unit tested and so forth. +//! +//! # Note +//! +//! This API is completely unstable and subject to change. + +#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] +#![feature(array_windows)] +#![feature(associated_type_bounds)] +#![feature(auto_traits)] +#![feature(cell_leak)] +#![feature(control_flow_enum)] +#![feature(extend_one)] +#![feature(let_else)] +#![feature(hash_raw_entry)] +#![feature(hasher_prefixfree_extras)] +#![feature(maybe_uninit_uninit_array)] +#![feature(min_specialization)] +#![feature(never_type)] +#![feature(type_alias_impl_trait)] +#![feature(new_uninit)] +#![feature(once_cell)] +#![feature(rustc_attrs)] +#![feature(test)] +#![feature(thread_id_value)] +#![feature(vec_into_raw_parts)] +#![allow(rustc::default_hash_types)] +#![allow(rustc::potential_query_instability)] + +#[macro_use] +extern crate tracing; +#[macro_use] +extern crate cfg_if; +#[macro_use] +extern crate rustc_macros; + +pub use rustc_index::static_assert_size; + +#[inline(never)] +#[cold] +pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R { + f() +} + +pub mod base_n; +pub mod binary_search_util; +pub mod captures; +pub mod flock; +pub mod functor; +pub mod fx; +pub mod graph; +pub mod intern; +pub mod jobserver; +pub mod macros; +pub mod map_in_place; +pub mod obligation_forest; +pub mod owning_ref; +pub mod sip128; +pub mod small_c_str; +pub mod small_str; +pub mod snapshot_map; +pub mod svh; +pub use ena::snapshot_vec; +pub mod memmap; +pub mod sorted_map; +#[macro_use] +pub mod stable_hasher; +mod atomic_ref; +pub mod fingerprint; +pub mod profiling; +pub mod sharded; +pub mod stack; +pub mod sync; +pub mod thin_vec; +pub mod tiny_list; +pub mod transitive_relation; +pub mod vec_linked_list; +pub mod vec_map; +pub mod work_queue; +pub use atomic_ref::AtomicRef; +pub mod frozen; +pub mod sso; +pub mod steal; +pub mod tagged_ptr; +pub mod temp_dir; +pub mod unhash; + +pub use ena::undo_log; +pub use ena::unify; + +pub struct OnDrop<F: Fn()>(pub F); + +impl<F: Fn()> OnDrop<F> { + /// Forgets the function which prevents it from running. + /// Ensure that the function owns no memory, otherwise it will be leaked. + #[inline] + pub fn disable(self) { + std::mem::forget(self); + } +} + +impl<F: Fn()> Drop for OnDrop<F> { + #[inline] + fn drop(&mut self) { + (self.0)(); + } +} + +// See comments in src/librustc_middle/lib.rs +#[doc(hidden)] +pub fn __noop_fix_for_27438() {} |