]> git.lizzy.rs Git - rust.git/blob - src/librustc_session/utils.rs
rustc_codegen_llvm: use IndexSet in CoverageMapGenerator
[rust.git] / src / librustc_session / utils.rs
1 use crate::session::Session;
2 use rustc_data_structures::profiling::VerboseTimingGuard;
3
4 impl Session {
5     pub fn timer<'a>(&'a self, what: &'static str) -> VerboseTimingGuard<'a> {
6         self.prof.verbose_generic_activity(what)
7     }
8     pub fn time<R>(&self, what: &'static str, f: impl FnOnce() -> R) -> R {
9         self.prof.verbose_generic_activity(what).run(f)
10     }
11 }
12
13 #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
14 pub enum NativeLibKind {
15     /// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC) included
16     /// when linking a final binary, but not when archiving an rlib.
17     StaticNoBundle,
18     /// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC) included
19     /// when linking a final binary, but also included when archiving an rlib.
20     StaticBundle,
21     /// Dynamic library (e.g. `libfoo.so` on Linux)
22     /// or an import library corresponding to a dynamic library (e.g. `foo.lib` on Windows/MSVC).
23     Dylib,
24     /// Dynamic library (e.g. `foo.dll` on Windows) without a corresponding import library.
25     RawDylib,
26     /// A macOS-specific kind of dynamic libraries.
27     Framework,
28     /// The library kind wasn't specified, `Dylib` is currently used as a default.
29     Unspecified,
30 }
31
32 rustc_data_structures::impl_stable_hash_via_hash!(NativeLibKind);