]> git.proxmox.com Git - rustc.git/blame - src/librustc_session/utils.rs
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_session / utils.rs
CommitLineData
dfeec247
XL
1use crate::session::Session;
2use rustc_data_structures::profiling::VerboseTimingGuard;
60c5eb7d 3
dfeec247
XL
4impl 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 }
60c5eb7d
XL
11}
12
3dfed10e 13#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)]
f9f354fc
XL
14pub 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,
60c5eb7d
XL
30}
31
f9f354fc 32rustc_data_structures::impl_stable_hash_via_hash!(NativeLibKind);