mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 13:18:47 +00:00
Add profile call
This commit is contained in:
parent
fde4a860ae
commit
e13065b8ac
4 changed files with 6 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1231,6 +1231,7 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"paths",
|
"paths",
|
||||||
"proc_macro_api",
|
"proc_macro_api",
|
||||||
|
"profile",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
@ -25,3 +25,4 @@ toolchain = { path = "../toolchain", version = "0.0.0" }
|
||||||
proc_macro_api = { path = "../proc_macro_api", version = "0.0.0" }
|
proc_macro_api = { path = "../proc_macro_api", version = "0.0.0" }
|
||||||
paths = { path = "../paths", version = "0.0.0" }
|
paths = { path = "../paths", version = "0.0.0" }
|
||||||
stdx = { path = "../stdx", version = "0.0.0" }
|
stdx = { path = "../stdx", version = "0.0.0" }
|
||||||
|
profile = { path = "../profile", version = "0.0.0" }
|
||||||
|
|
|
@ -207,6 +207,7 @@ impl ProjectWorkspace {
|
||||||
proc_macro_client: Option<&ProcMacroClient>,
|
proc_macro_client: Option<&ProcMacroClient>,
|
||||||
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
|
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
|
||||||
) -> CrateGraph {
|
) -> CrateGraph {
|
||||||
|
let _p = profile::span("ProjectWorkspace::to_crate_graph");
|
||||||
let proc_macro_loader = |path: &Path| match proc_macro_client {
|
let proc_macro_loader = |path: &Path| match proc_macro_client {
|
||||||
Some(client) => client.by_dylib_path(path),
|
Some(client) => client.by_dylib_path(path),
|
||||||
None => Vec::new(),
|
None => Vec::new(),
|
||||||
|
@ -299,6 +300,7 @@ fn cargo_to_crate_graph(
|
||||||
sysroot: &Sysroot,
|
sysroot: &Sysroot,
|
||||||
rustc: &Option<CargoWorkspace>,
|
rustc: &Option<CargoWorkspace>,
|
||||||
) -> CrateGraph {
|
) -> CrateGraph {
|
||||||
|
let _p = profile::span("cargo_to_crate_graph");
|
||||||
let mut crate_graph = CrateGraph::default();
|
let mut crate_graph = CrateGraph::default();
|
||||||
let (public_deps, libproc_macro) =
|
let (public_deps, libproc_macro) =
|
||||||
sysroot_to_crate_graph(&mut crate_graph, sysroot, target, load);
|
sysroot_to_crate_graph(&mut crate_graph, sysroot, target, load);
|
||||||
|
@ -493,6 +495,7 @@ fn sysroot_to_crate_graph(
|
||||||
target: Option<&str>,
|
target: Option<&str>,
|
||||||
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
|
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
|
||||||
) -> (Vec<(CrateName, CrateId)>, Option<CrateId>) {
|
) -> (Vec<(CrateName, CrateId)>, Option<CrateId>) {
|
||||||
|
let _p = profile::span("sysroot_to_crate_graph");
|
||||||
let mut cfg_options = CfgOptions::default();
|
let mut cfg_options = CfgOptions::default();
|
||||||
cfg_options.extend(get_rustc_cfg_options(target));
|
cfg_options.extend(get_rustc_cfg_options(target));
|
||||||
let sysroot_crates: FxHashMap<SysrootCrate, CrateId> = sysroot
|
let sysroot_crates: FxHashMap<SysrootCrate, CrateId> = sysroot
|
||||||
|
|
|
@ -274,6 +274,7 @@ impl GlobalState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reload_flycheck(&mut self) {
|
fn reload_flycheck(&mut self) {
|
||||||
|
let _p = profile::span("GlobalState::reload_flycheck");
|
||||||
let config = match self.config.flycheck() {
|
let config = match self.config.flycheck() {
|
||||||
Some(it) => it,
|
Some(it) => it,
|
||||||
None => {
|
None => {
|
||||||
|
|
Loading…
Reference in a new issue