2020-01-01 01:24:05 +00:00
|
|
|
use crate::session::Session;
|
|
|
|
use rustc_data_structures::profiling::VerboseTimingGuard;
|
2019-11-12 13:30:40 +00:00
|
|
|
|
2020-01-01 01:24:05 +00:00
|
|
|
impl Session {
|
2020-01-07 20:34:08 +00:00
|
|
|
pub fn timer<'a>(&'a self, what: &'static str) -> VerboseTimingGuard<'a> {
|
|
|
|
self.prof.verbose_generic_activity(what)
|
2020-01-01 01:24:05 +00:00
|
|
|
}
|
2020-01-07 20:34:08 +00:00
|
|
|
pub fn time<R>(&self, what: &'static str, f: impl FnOnce() -> R) -> R {
|
|
|
|
self.prof.verbose_generic_activity(what).run(f)
|
2020-01-01 01:24:05 +00:00
|
|
|
}
|
2019-11-12 13:30:40 +00:00
|
|
|
}
|
2019-11-14 17:16:24 +00:00
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
|
2020-05-17 21:18:50 +00:00
|
|
|
pub enum NativeLibKind {
|
|
|
|
/// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC) included
|
|
|
|
/// when linking a final binary, but not when archiving an rlib.
|
|
|
|
StaticNoBundle,
|
|
|
|
/// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC) included
|
|
|
|
/// when linking a final binary, but also included when archiving an rlib.
|
|
|
|
StaticBundle,
|
|
|
|
/// Windows dynamic library (`foo.dll`) without a corresponding import library.
|
|
|
|
RawDylib,
|
|
|
|
/// A macOS-specific kind of dynamic libraries.
|
|
|
|
Framework,
|
|
|
|
/// The library kind wasn't specified, dynamic linking is currently preferred.
|
|
|
|
Unspecified,
|
2019-11-14 17:16:24 +00:00
|
|
|
}
|
|
|
|
|
2020-05-17 21:18:50 +00:00
|
|
|
rustc_data_structures::impl_stable_hash_via_hash!(NativeLibKind);
|