2015-04-07 06:10:53 -04:00
|
|
|
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
//! 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.
|
|
|
|
|
2015-08-09 14:15:05 -07:00
|
|
|
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
|
|
|
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
|
|
|
|
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
2015-04-07 06:10:53 -04:00
|
|
|
|
2016-05-08 00:52:45 +03:00
|
|
|
#![feature(unboxed_closures)]
|
|
|
|
#![feature(fn_traits)]
|
2016-10-24 18:22:59 -06:00
|
|
|
#![feature(unsize)]
|
2017-03-30 15:27:27 +02:00
|
|
|
#![feature(specialization)]
|
2017-12-03 13:49:01 +01:00
|
|
|
#![feature(optin_builtin_traits)]
|
|
|
|
#![feature(macro_vis_matcher)]
|
|
|
|
#![feature(allow_internal_unstable)]
|
2018-07-09 21:26:20 +01:00
|
|
|
#![feature(vec_resize_with)]
|
2015-08-18 17:56:55 -04:00
|
|
|
|
2016-08-22 13:01:46 -04:00
|
|
|
#![cfg_attr(unix, feature(libc))]
|
2015-04-08 18:53:56 -04:00
|
|
|
#![cfg_attr(test, feature(test))]
|
2015-04-07 06:10:53 -04:00
|
|
|
|
2015-11-18 14:44:24 -05:00
|
|
|
extern crate core;
|
2017-07-16 07:07:51 -04:00
|
|
|
extern crate ena;
|
2016-03-05 08:40:33 -05:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
2015-04-07 06:10:53 -04:00
|
|
|
extern crate serialize as rustc_serialize; // used by deriving
|
2016-08-12 18:22:02 -04:00
|
|
|
#[cfg(unix)]
|
|
|
|
extern crate libc;
|
2017-12-03 13:49:01 +01:00
|
|
|
extern crate parking_lot;
|
|
|
|
#[macro_use]
|
|
|
|
extern crate cfg_if;
|
|
|
|
extern crate stable_deref_trait;
|
2018-04-26 00:50:33 +02:00
|
|
|
extern crate rustc_rayon as rayon;
|
2018-05-11 16:28:28 +02:00
|
|
|
extern crate rustc_rayon_core as rayon_core;
|
2018-05-24 08:48:02 -04:00
|
|
|
extern crate rustc_hash;
|
2015-04-07 06:11:49 -04:00
|
|
|
|
2018-04-25 19:30:39 +03:00
|
|
|
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
|
|
|
|
#[allow(unused_extern_crates)]
|
|
|
|
extern crate rustc_cratesio_shim;
|
|
|
|
|
2016-12-14 01:45:03 +02:00
|
|
|
pub use rustc_serialize::hex::ToHex;
|
|
|
|
|
2016-10-24 18:22:59 -06:00
|
|
|
pub mod accumulate_vec;
|
2018-07-18 21:53:54 +03:00
|
|
|
pub mod array_vec;
|
2016-11-04 17:37:42 -04:00
|
|
|
pub mod base_n;
|
2016-10-05 22:43:27 -04:00
|
|
|
pub mod bitslice;
|
2015-04-07 06:12:13 -04:00
|
|
|
pub mod bitvec;
|
2018-07-18 21:53:54 +03:00
|
|
|
pub mod flock;
|
|
|
|
pub mod fx;
|
|
|
|
pub mod graph;
|
2016-10-05 22:43:27 -04:00
|
|
|
pub mod indexed_set;
|
2016-06-07 17:28:36 +03:00
|
|
|
pub mod indexed_vec;
|
2015-11-18 14:44:24 -05:00
|
|
|
pub mod obligation_forest;
|
2018-07-18 21:53:54 +03:00
|
|
|
pub mod owning_ref;
|
|
|
|
pub mod ptr_key;
|
2017-10-16 13:16:04 +02:00
|
|
|
pub mod sip128;
|
2018-07-18 21:53:54 +03:00
|
|
|
pub mod small_vec;
|
2016-05-21 08:18:09 -04:00
|
|
|
pub mod snapshot_map;
|
2017-07-16 07:07:51 -04:00
|
|
|
pub use ena::snapshot_vec;
|
2018-07-18 21:53:54 +03:00
|
|
|
pub mod sorted_map;
|
2016-12-14 01:45:03 +02:00
|
|
|
pub mod stable_hasher;
|
2017-12-03 13:49:01 +01:00
|
|
|
pub mod sync;
|
2018-05-28 17:43:53 +02:00
|
|
|
pub mod tiny_list;
|
2018-07-18 21:53:54 +03:00
|
|
|
pub mod transitive_relation;
|
|
|
|
pub mod tuple_slice;
|
|
|
|
pub use ena::unify;
|
2018-06-29 06:38:48 -04:00
|
|
|
pub mod work_queue;
|
2015-08-11 11:48:43 -07:00
|
|
|
|
2018-03-15 10:38:12 +01:00
|
|
|
pub struct OnDrop<F: Fn()>(pub F);
|
|
|
|
|
2018-05-27 07:47:44 +02:00
|
|
|
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.
|
|
|
|
pub fn disable(self) {
|
|
|
|
std::mem::forget(self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-15 10:38:12 +01:00
|
|
|
impl<F: Fn()> Drop for OnDrop<F> {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
(self.0)();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-11 11:48:43 -07:00
|
|
|
// See comments in src/librustc/lib.rs
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub fn __noop_fix_for_27438() {}
|