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/")]
10 #![feature(in_band_lifetimes)]
11 #![feature(unboxed_closures)]
12 #![feature(generators)]
13 #![feature(generator_trait)]
14 #![feature(fn_traits)]
15 #![feature(specialization)]
16 #![feature(optin_builtin_traits)]
18 #![feature(allow_internal_unstable)]
19 #![feature(hash_raw_entry)]
20 #![feature(stmt_expr_attributes)]
21 #![feature(core_intrinsics)]
23 #![feature(associated_type_bounds)]
24 #![feature(thread_id_value)]
25 #![allow(rustc::default_hash_types)]
32 pub use rustc_serialize
::hex
::ToHex
;
36 pub fn cold_path
<F
: FnOnce() -> R
, R
>(f
: F
) -> R
{
43 #[allow(unused_unsafe)]
45 unsafe { std::intrinsics::likely($e) }
51 macro_rules
! unlikely
{
53 #[allow(unused_unsafe)]
55 unsafe { std::intrinsics::unlikely($e) }
61 pub mod binary_search_util
;
71 pub mod obligation_forest
;
79 pub use ena
::snapshot_vec
;
83 pub mod stable_hasher
;
88 pub mod transitive_relation
;
93 pub mod vec_linked_list
;
95 pub use atomic_ref
::AtomicRef
;
98 pub struct OnDrop
<F
: Fn()>(pub F
);
100 impl<F
: Fn()> OnDrop
<F
> {
101 /// Forgets the function which prevents it from running.
102 /// Ensure that the function owns no memory, otherwise it will be leaked.
104 pub fn disable(self) {
105 std
::mem
::forget(self);
109 impl<F
: Fn()> Drop
for OnDrop
<F
> {
116 // See comments in src/librustc_middle/lib.rs
118 pub fn __noop_fix_for_27438() {}