101 lines
2.7 KiB
Rust
Raw Normal View History

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.
#![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)]
#![feature(unsize)]
#![feature(specialization)]
#![feature(optin_builtin_traits)]
#![feature(macro_vis_matcher)]
#![feature(allow_internal_unstable)]
#![feature(vec_resize_with)]
#![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
extern crate core;
extern crate ena;
#[macro_use]
extern crate log;
2015-04-07 06:10:53 -04:00
extern crate serialize as rustc_serialize; // used by deriving
#[cfg(unix)]
extern crate libc;
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;
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
#[allow(unused_extern_crates)]
extern crate rustc_cratesio_shim;
pub use rustc_serialize::hex::ToHex;
pub mod accumulate_vec;
pub mod array_vec;
pub mod base_n;
pub mod bitslice;
pub mod bitvec;
pub mod flock;
pub mod fx;
pub mod graph;
pub mod indexed_set;
pub mod indexed_vec;
pub mod obligation_forest;
pub mod owning_ref;
pub mod ptr_key;
pub mod sip128;
pub mod small_vec;
2016-05-21 08:18:09 -04:00
pub mod snapshot_map;
pub use ena::snapshot_vec;
pub mod sorted_map;
pub mod stable_hasher;
pub mod sync;
2018-05-28 17:43:53 +02:00
pub mod tiny_list;
pub mod transitive_relation;
pub mod tuple_slice;
pub use ena::unify;
pub mod work_queue;
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)();
}
}
// See comments in src/librustc/lib.rs
#[doc(hidden)]
pub fn __noop_fix_for_27438() {}