1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Various data structures used by the Rust compiler. The intention
12 //! is that code in here should be not be *specific* to rustc, so that
13 //! it can be easily unit tested and so forth.
17 //! This API is completely unstable and subject to change.
19 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
20 html_favicon_url = "https://www.rust-lang.org/favicon.ico",
21 html_root_url = "https://doc.rust-lang.org/nightly/")]
23 #![feature(in_band_lifetimes)]
24 #![cfg_attr(stage0, feature(impl_header_lifetime_elision))]
25 #![feature(unboxed_closures)]
26 #![feature(fn_traits)]
28 #![feature(specialization)]
29 #![feature(optin_builtin_traits)]
31 #![feature(allow_internal_unstable)]
32 #![feature(vec_resize_with)]
34 #![cfg_attr(unix, feature(libc))]
35 #![cfg_attr(test, feature(test))]
41 extern crate serialize as rustc_serialize; // used by deriving
44 extern crate parking_lot;
47 extern crate stable_deref_trait;
48 extern crate rustc_rayon as rayon;
49 extern crate rustc_rayon_core as rayon_core;
50 extern crate rustc_hash;
51 extern crate serialize;
52 extern crate graphviz;
53 extern crate smallvec;
55 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
56 #[allow(unused_extern_crates)]
57 extern crate rustc_cratesio_shim;
59 pub use rustc_serialize::hex::ToHex;
69 pub mod obligation_forest;
75 pub use ena::snapshot_vec;
77 #[macro_use] pub mod stable_hasher;
81 pub mod transitive_relation;
84 pub mod vec_linked_list;
88 pub struct OnDrop<F: Fn()>(pub F);
90 impl<F: Fn()> OnDrop<F> {
91 /// Forgets the function which prevents it from running.
92 /// Ensure that the function owns no memory, otherwise it will be leaked.
93 pub fn disable(self) {
94 std::mem::forget(self);
98 impl<F: Fn()> Drop for OnDrop<F> {
104 // See comments in src/librustc/lib.rs
106 pub fn __noop_fix_for_27438() {}