diff --git a/src/tools/rust-analyzer/crates/base-db/src/change.rs b/src/tools/rust-analyzer/crates/base-db/src/change.rs index 927b2108a6ce8..0fd54e1211cd9 100644 --- a/src/tools/rust-analyzer/crates/base-db/src/change.rs +++ b/src/tools/rust-analyzer/crates/base-db/src/change.rs @@ -51,7 +51,7 @@ impl FileChange { } pub fn apply(self, db: &mut dyn SourceDatabaseExt) { - let _p = tracing::span!(tracing::Level::INFO, "FileChange::apply").entered(); + let _p = tracing::info_span!("FileChange::apply").entered(); if let Some(roots) = self.roots { for (idx, root) in roots.into_iter().enumerate() { let root_id = SourceRootId(idx as u32); diff --git a/src/tools/rust-analyzer/crates/base-db/src/input.rs b/src/tools/rust-analyzer/crates/base-db/src/input.rs index b2c3f38ab4f8a..1d172ab9e40e3 100644 --- a/src/tools/rust-analyzer/crates/base-db/src/input.rs +++ b/src/tools/rust-analyzer/crates/base-db/src/input.rs @@ -412,7 +412,7 @@ impl CrateGraph { from: CrateId, dep: Dependency, ) -> Result<(), CyclicDependenciesError> { - let _p = tracing::span!(tracing::Level::INFO, "add_dep").entered(); + let _p = tracing::info_span!("add_dep").entered(); self.check_cycle_after_dependency(from, dep.crate_id)?; diff --git a/src/tools/rust-analyzer/crates/base-db/src/lib.rs b/src/tools/rust-analyzer/crates/base-db/src/lib.rs index 2c13eed56c3e1..f5165ea8a7bb8 100644 --- a/src/tools/rust-analyzer/crates/base-db/src/lib.rs +++ b/src/tools/rust-analyzer/crates/base-db/src/lib.rs @@ -85,7 +85,7 @@ fn toolchain_channel(db: &dyn SourceDatabase, krate: CrateId) -> Option Parse { - let _p = tracing::span!(tracing::Level::INFO, "parse", ?file_id).entered(); + let _p = tracing::info_span!("parse", ?file_id).entered(); let text = db.file_text(file_id); // FIXME: Edition based parsing SourceFile::parse(&text, span::Edition::CURRENT) @@ -187,7 +187,7 @@ impl FileLoader for FileLoaderDelegate<&'_ T> { } fn relevant_crates(&self, file_id: FileId) -> Arc<[CrateId]> { - let _p = tracing::span!(tracing::Level::INFO, "relevant_crates").entered(); + let _p = tracing::info_span!("relevant_crates").entered(); let source_root = self.0.file_source_root(file_id); self.0.source_root_crates(source_root) } diff --git a/src/tools/rust-analyzer/crates/hir-def/src/attr.rs b/src/tools/rust-analyzer/crates/hir-def/src/attr.rs index 369277633e954..184dab8367c16 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/attr.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/attr.rs @@ -70,7 +70,7 @@ impl Attrs { db: &dyn DefDatabase, v: VariantId, ) -> Arc> { - let _p = tracing::span!(tracing::Level::INFO, "fields_attrs_query").entered(); + let _p = tracing::info_span!("fields_attrs_query").entered(); // FIXME: There should be some proper form of mapping between item tree field ids and hir field ids let mut res = ArenaMap::default(); @@ -321,7 +321,7 @@ impl AttrsWithOwner { } pub(crate) fn attrs_query(db: &dyn DefDatabase, def: AttrDefId) -> Attrs { - let _p = tracing::span!(tracing::Level::INFO, "attrs_query").entered(); + let _p = tracing::info_span!("attrs_query").entered(); // FIXME: this should use `Trace` to avoid duplication in `source_map` below let raw_attrs = match def { AttrDefId::ModuleId(module) => { diff --git a/src/tools/rust-analyzer/crates/hir-def/src/body.rs b/src/tools/rust-analyzer/crates/hir-def/src/body.rs index a796ef33c60bf..ca4a3f5217cf3 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/body.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/body.rs @@ -124,7 +124,7 @@ impl Body { db: &dyn DefDatabase, def: DefWithBodyId, ) -> (Arc, Arc) { - let _p = tracing::span!(tracing::Level::INFO, "body_with_source_map_query").entered(); + let _p = tracing::info_span!("body_with_source_map_query").entered(); let mut params = None; let mut is_async_fn = false; diff --git a/src/tools/rust-analyzer/crates/hir-def/src/data.rs b/src/tools/rust-analyzer/crates/hir-def/src/data.rs index 0a7ca19910946..077ded3d40326 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/data.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/data.rs @@ -340,7 +340,7 @@ impl ImplData { db: &dyn DefDatabase, id: ImplId, ) -> (Arc, DefDiagnostics) { - let _p = tracing::span!(tracing::Level::INFO, "impl_data_with_diagnostics_query").entered(); + let _p = tracing::info_span!("impl_data_with_diagnostics_query").entered(); let ItemLoc { container: module_id, id: tree_id } = id.lookup(db); let item_tree = tree_id.item_tree(db); diff --git a/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs b/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs index 365003acef00f..58a1872ef2510 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/find_path.rs @@ -27,7 +27,7 @@ pub fn find_path( ignore_local_imports: bool, mut cfg: ImportPathConfig, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "find_path").entered(); + let _p = tracing::info_span!("find_path").entered(); // - if the item is a builtin, it's in scope if let ItemInNs::Types(ModuleDefId::BuiltinType(builtin)) = item { @@ -474,7 +474,7 @@ fn find_local_import_locations( def_map: &DefMap, mut cb: impl FnMut(&Name, ModuleId), ) { - let _p = tracing::span!(tracing::Level::INFO, "find_local_import_locations").entered(); + let _p = tracing::info_span!("find_local_import_locations").entered(); // `from` can import anything below `from` with visibility of at least `from`, and anything // above `from` with any visibility. That means we do not need to descend into private siblings diff --git a/src/tools/rust-analyzer/crates/hir-def/src/generics.rs b/src/tools/rust-analyzer/crates/hir-def/src/generics.rs index 10a1d65bb9337..a23df7fa2de73 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/generics.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/generics.rs @@ -467,7 +467,7 @@ impl GenericParams { db: &dyn DefDatabase, def: GenericDefId, ) -> Interned { - let _p = tracing::span!(tracing::Level::INFO, "generic_params_query").entered(); + let _p = tracing::info_span!("generic_params_query").entered(); let krate = def.module(db).krate; let cfg_options = db.crate_graph(); diff --git a/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs b/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs index 6e40293dbf8e6..2b2db21a9f41f 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/import_map.rs @@ -73,7 +73,7 @@ impl ImportMap { } pub(crate) fn import_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc { - let _p = tracing::span!(tracing::Level::INFO, "import_map_query").entered(); + let _p = tracing::info_span!("import_map_query").entered(); let map = Self::collect_import_map(db, krate); @@ -124,7 +124,7 @@ impl ImportMap { } fn collect_import_map(db: &dyn DefDatabase, krate: CrateId) -> ImportMapIndex { - let _p = tracing::span!(tracing::Level::INFO, "collect_import_map").entered(); + let _p = tracing::info_span!("collect_import_map").entered(); let def_map = db.crate_def_map(krate); let mut map = FxIndexMap::default(); @@ -214,7 +214,7 @@ impl ImportMap { is_type_in_ns: bool, trait_import_info: &ImportInfo, ) { - let _p = tracing::span!(tracing::Level::INFO, "collect_trait_assoc_items").entered(); + let _p = tracing::info_span!("collect_trait_assoc_items").entered(); for &(ref assoc_item_name, item) in &db.trait_data(tr).items { let module_def_id = match item { AssocItemId::FunctionId(f) => ModuleDefId::from(f), @@ -396,7 +396,7 @@ pub fn search_dependencies( krate: CrateId, query: &Query, ) -> FxHashSet { - let _p = tracing::span!(tracing::Level::INFO, "search_dependencies", ?query).entered(); + let _p = tracing::info_span!("search_dependencies", ?query).entered(); let graph = db.crate_graph(); diff --git a/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs b/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs index 52147e4a54165..c3b7a78301d27 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs @@ -99,7 +99,7 @@ pub struct ItemTree { impl ItemTree { pub(crate) fn file_item_tree_query(db: &dyn DefDatabase, file_id: HirFileId) -> Arc { - let _p = tracing::span!(tracing::Level::INFO, "file_item_tree_query", ?file_id).entered(); + let _p = tracing::info_span!("file_item_tree_query", ?file_id).entered(); let syntax = db.parse_or_expand(file_id); diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs index 3a07c678428e4..6d7836d5ae899 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs @@ -91,7 +91,7 @@ impl LangItems { db: &dyn DefDatabase, krate: CrateId, ) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "crate_lang_items_query").entered(); + let _p = tracing::info_span!("crate_lang_items_query").entered(); let mut lang_items = LangItems::default(); @@ -163,7 +163,7 @@ impl LangItems { start_crate: CrateId, item: LangItem, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "lang_item_query").entered(); + let _p = tracing::info_span!("lang_item_query").entered(); if let Some(target) = db.crate_lang_items(start_crate).and_then(|it| it.items.get(&item).copied()) { @@ -183,7 +183,7 @@ impl LangItems { ) where T: Into + Copy, { - let _p = tracing::span!(tracing::Level::INFO, "collect_lang_item").entered(); + let _p = tracing::info_span!("collect_lang_item").entered(); if let Some(lang_item) = lang_attr(db, item.into()) { self.items.entry(lang_item).or_insert_with(|| constructor(item)); } @@ -199,7 +199,7 @@ pub(crate) fn notable_traits_in_deps( db: &dyn DefDatabase, krate: CrateId, ) -> Arc<[Arc<[TraitId]>]> { - let _p = tracing::span!(tracing::Level::INFO, "notable_traits_in_deps", ?krate).entered(); + let _p = tracing::info_span!("notable_traits_in_deps", ?krate).entered(); let crate_graph = db.crate_graph(); Arc::from_iter( @@ -208,7 +208,7 @@ pub(crate) fn notable_traits_in_deps( } pub(crate) fn crate_notable_traits(db: &dyn DefDatabase, krate: CrateId) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "crate_notable_traits", ?krate).entered(); + let _p = tracing::info_span!("crate_notable_traits", ?krate).entered(); let mut traits = Vec::new(); diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs index a3eab22fc49c4..256a37f6ec857 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres.rs @@ -333,7 +333,7 @@ impl DefMap { let crate_graph = db.crate_graph(); let krate = &crate_graph[crate_id]; let name = krate.display_name.as_deref().unwrap_or_default(); - let _p = tracing::span!(tracing::Level::INFO, "crate_def_map_query", ?name).entered(); + let _p = tracing::info_span!("crate_def_map_query", ?name).entered(); let module_data = ModuleData::new( ModuleOrigin::CrateRoot { definition: krate.root_file_id }, diff --git a/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs b/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs index ba8c6ba645ec7..cf5e0c22ce475 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/nameres/collector.rs @@ -276,7 +276,7 @@ struct DefCollector<'a> { impl DefCollector<'_> { fn seed_with_top_level(&mut self) { - let _p = tracing::span!(tracing::Level::INFO, "seed_with_top_level").entered(); + let _p = tracing::info_span!("seed_with_top_level").entered(); let crate_graph = self.db.crate_graph(); let file_id = crate_graph[self.def_map.krate].root_file_id; @@ -411,17 +411,17 @@ impl DefCollector<'_> { } fn resolution_loop(&mut self) { - let _p = tracing::span!(tracing::Level::INFO, "DefCollector::resolution_loop").entered(); + let _p = tracing::info_span!("DefCollector::resolution_loop").entered(); // main name resolution fixed-point loop. let mut i = 0; 'resolve_attr: loop { - let _p = tracing::span!(tracing::Level::INFO, "resolve_macros loop").entered(); + let _p = tracing::info_span!("resolve_macros loop").entered(); 'resolve_macros: loop { self.db.unwind_if_cancelled(); { - let _p = tracing::span!(tracing::Level::INFO, "resolve_imports loop").entered(); + let _p = tracing::info_span!("resolve_imports loop").entered(); 'resolve_imports: loop { if self.resolve_imports() == ReachedFixedPoint::Yes { @@ -447,7 +447,7 @@ impl DefCollector<'_> { } fn collect(&mut self) { - let _p = tracing::span!(tracing::Level::INFO, "DefCollector::collect").entered(); + let _p = tracing::info_span!("DefCollector::collect").entered(); self.resolution_loop(); @@ -795,7 +795,7 @@ impl DefCollector<'_> { } fn resolve_import(&self, module_id: LocalModuleId, import: &Import) -> PartialResolvedImport { - let _p = tracing::span!(tracing::Level::INFO, "resolve_import", import_path = %import.path.display(self.db.upcast())) + let _p = tracing::info_span!("resolve_import", import_path = %import.path.display(self.db.upcast())) .entered(); tracing::debug!("resolving import: {:?} ({:?})", import, self.def_map.data.edition); match import.source { @@ -857,7 +857,7 @@ impl DefCollector<'_> { } fn record_resolved_import(&mut self, directive: &ImportDirective) { - let _p = tracing::span!(tracing::Level::INFO, "record_resolved_import").entered(); + let _p = tracing::info_span!("record_resolved_import").entered(); let module_id = directive.module_id; let import = &directive.import; @@ -1422,7 +1422,7 @@ impl DefCollector<'_> { fn finish(mut self) -> DefMap { // Emit diagnostics for all remaining unexpanded macros. - let _p = tracing::span!(tracing::Level::INFO, "DefCollector::finish").entered(); + let _p = tracing::info_span!("DefCollector::finish").entered(); for directive in &self.unresolved_macros { match &directive.kind { diff --git a/src/tools/rust-analyzer/crates/hir-def/src/per_ns.rs b/src/tools/rust-analyzer/crates/hir-def/src/per_ns.rs index 36ab62d0f7f1b..19485c476f72d 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/per_ns.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/per_ns.rs @@ -86,7 +86,7 @@ impl PerNs { } pub fn filter_visibility(self, mut f: impl FnMut(Visibility) -> bool) -> PerNs { - let _p = tracing::span!(tracing::Level::INFO, "PerNs::filter_visibility").entered(); + let _p = tracing::info_span!("PerNs::filter_visibility").entered(); PerNs { types: self.types.filter(|&(_, v, _)| f(v)), values: self.values.filter(|&(_, v, _)| f(v)), @@ -119,7 +119,7 @@ impl PerNs { } pub fn iter_items(self) -> impl Iterator)> { - let _p = tracing::span!(tracing::Level::INFO, "PerNs::iter_items").entered(); + let _p = tracing::info_span!("PerNs::iter_items").entered(); self.types .map(|it| (ItemInNs::Types(it.0), it.2)) .into_iter() diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/db.rs b/src/tools/rust-analyzer/crates/hir-expand/src/db.rs index 8b49a6877a275..30042ca78a7d1 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/db.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/db.rs @@ -334,7 +334,7 @@ fn parse_macro_expansion( db: &dyn ExpandDatabase, macro_file: MacroFileId, ) -> ExpandResult<(Parse, Arc)> { - let _p = tracing::span!(tracing::Level::INFO, "parse_macro_expansion").entered(); + let _p = tracing::info_span!("parse_macro_expansion").entered(); let loc = db.lookup_intern_macro_call(macro_file.macro_call_id); let edition = loc.def.edition; let expand_to = loc.expand_to(); @@ -588,7 +588,7 @@ fn macro_expand( macro_call_id: MacroCallId, loc: MacroCallLoc, ) -> ExpandResult<(CowArc, MatchedArmIndex)> { - let _p = tracing::span!(tracing::Level::INFO, "macro_expand").entered(); + let _p = tracing::info_span!("macro_expand").entered(); let (ExpandResult { value: (tt, matched_arm), err }, span) = match loc.def.kind { MacroDefKind::ProcMacro(..) => { diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs b/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs index a586b543c845e..8859b47e4c3c2 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/lib.rs @@ -809,7 +809,7 @@ impl ExpansionInfo { } pub fn new(db: &dyn ExpandDatabase, macro_file: MacroFileId) -> ExpansionInfo { - let _p = tracing::span!(tracing::Level::INFO, "ExpansionInfo::new").entered(); + let _p = tracing::info_span!("ExpansionInfo::new").entered(); let loc = db.lookup_intern_macro_call(macro_file.macro_call_id); let arg_tt = loc.kind.arg(db); diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs b/src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs index e2446c34254a4..b706cef0b3a28 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/autoderef.rs @@ -143,7 +143,7 @@ pub(crate) fn deref_by_trait( table @ &mut InferenceTable { db, .. }: &mut InferenceTable<'_>, ty: Ty, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "deref_by_trait").entered(); + let _p = tracing::info_span!("deref_by_trait").entered(); if table.resolve_ty_shallow(&ty).inference_var(Interner).is_some() { // don't try to deref unknown variables return None; diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs b/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs index 84ac8740ecd54..149e4dbaa518a 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs @@ -806,7 +806,7 @@ pub(crate) fn impl_datum_query( krate: CrateId, impl_id: ImplId, ) -> Arc { - let _p = tracing::span!(tracing::Level::INFO, "impl_datum_query").entered(); + let _p = tracing::info_span!("impl_datum_query").entered(); debug!("impl_datum {:?}", impl_id); let impl_: hir_def::ImplId = from_chalk(db, impl_id); impl_def_datum(db, krate, impl_id, impl_) diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs index ecbb1d4c60e5f..15ecf9aafcfc9 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/decl_check.rs @@ -43,7 +43,7 @@ mod allow { } pub fn incorrect_case(db: &dyn HirDatabase, owner: ModuleDefId) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "incorrect_case").entered(); + let _p = tracing::info_span!("incorrect_case").entered(); let mut validator = DeclValidator::new(db); validator.validate_item(owner); validator.sink diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs index a5a42c52af04a..ce3fa53f7ad62 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/expr.rs @@ -65,8 +65,7 @@ impl BodyValidationDiagnostic { owner: DefWithBodyId, validate_lints: bool, ) -> Vec { - let _p = - tracing::span!(tracing::Level::INFO, "BodyValidationDiagnostic::collect").entered(); + let _p = tracing::info_span!("BodyValidationDiagnostic::collect").entered(); let infer = db.infer(owner); let body = db.body(owner); let mut validator = diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs index 081b4d83a86fd..22aa5c69bb03d 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/unsafe_check.rs @@ -13,7 +13,7 @@ use crate::{ }; pub fn missing_unsafe(db: &dyn HirDatabase, def: DefWithBodyId) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "missing_unsafe").entered(); + let _p = tracing::info_span!("missing_unsafe").entered(); let mut res = Vec::new(); let is_unsafe = match def { diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs index 6f2f70dd40a78..25bce0b31a478 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer.rs @@ -79,7 +79,7 @@ pub(crate) use closure::{CaptureKind, CapturedItem, CapturedItemWithoutTy}; /// The entry point of type inference. pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc { - let _p = tracing::span!(tracing::Level::INFO, "infer_query").entered(); + let _p = tracing::info_span!("infer_query").entered(); let resolver = def.resolver(db.upcast()); let body = db.body(def); let mut ctx = InferenceContext::new(db, def, &body, resolver); diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs index 36e3a458898da..ed4d55d203773 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs @@ -613,8 +613,7 @@ impl<'a> InferenceTable<'a> { } pub(crate) fn resolve_obligations_as_possible(&mut self) { - let _span = - tracing::span!(tracing::Level::INFO, "resolve_obligations_as_possible").entered(); + let _span = tracing::info_span!("resolve_obligations_as_possible").entered(); let mut changed = true; let mut obligations = mem::take(&mut self.resolve_obligations_buffer); while mem::take(&mut changed) { diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs b/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs index 7546369d8d47a..f5fb2ffd78175 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/inhabitedness.rs @@ -15,7 +15,7 @@ use crate::{ // FIXME: Turn this into a query, it can be quite slow /// Checks whether a type is visibly uninhabited from a particular module. pub(crate) fn is_ty_uninhabited_from(db: &dyn HirDatabase, ty: &Ty, target_mod: ModuleId) -> bool { - let _p = tracing::span!(tracing::Level::INFO, "is_ty_uninhabited_from", ?ty).entered(); + let _p = tracing::info_span!("is_ty_uninhabited_from", ?ty).entered(); let mut uninhabited_from = UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() }; let inhabitedness = ty.visit_with(&mut uninhabited_from, DebruijnIndex::INNERMOST); @@ -30,7 +30,7 @@ pub(crate) fn is_enum_variant_uninhabited_from( subst: &Substitution, target_mod: ModuleId, ) -> bool { - let _p = tracing::span!(tracing::Level::INFO, "is_enum_variant_uninhabited_from").entered(); + let _p = tracing::info_span!("is_enum_variant_uninhabited_from").entered(); let mut uninhabited_from = UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() }; diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs index cb56a6f0bfe7d..5ce124d6d27fa 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/method_resolution.rs @@ -144,8 +144,7 @@ pub struct TraitImpls { impl TraitImpls { pub(crate) fn trait_impls_in_crate_query(db: &dyn HirDatabase, krate: CrateId) -> Arc { - let _p = - tracing::span!(tracing::Level::INFO, "trait_impls_in_crate_query", ?krate).entered(); + let _p = tracing::info_span!("trait_impls_in_crate_query", ?krate).entered(); let mut impls = FxHashMap::default(); Self::collect_def_map(db, &mut impls, &db.crate_def_map(krate)); @@ -157,7 +156,7 @@ impl TraitImpls { db: &dyn HirDatabase, block: BlockId, ) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "trait_impls_in_block_query").entered(); + let _p = tracing::info_span!("trait_impls_in_block_query").entered(); let mut impls = FxHashMap::default(); Self::collect_def_map(db, &mut impls, &db.block_def_map(block)); @@ -173,8 +172,7 @@ impl TraitImpls { db: &dyn HirDatabase, krate: CrateId, ) -> Arc<[Arc]> { - let _p = - tracing::span!(tracing::Level::INFO, "trait_impls_in_deps_query", ?krate).entered(); + let _p = tracing::info_span!("trait_impls_in_deps_query", ?krate).entered(); let crate_graph = db.crate_graph(); Arc::from_iter( @@ -280,8 +278,7 @@ pub struct InherentImpls { impl InherentImpls { pub(crate) fn inherent_impls_in_crate_query(db: &dyn HirDatabase, krate: CrateId) -> Arc { - let _p = - tracing::span!(tracing::Level::INFO, "inherent_impls_in_crate_query", ?krate).entered(); + let _p = tracing::info_span!("inherent_impls_in_crate_query", ?krate).entered(); let mut impls = Self { map: FxHashMap::default(), invalid_impls: Vec::default() }; let crate_def_map = db.crate_def_map(krate); @@ -295,7 +292,7 @@ impl InherentImpls { db: &dyn HirDatabase, block: BlockId, ) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "inherent_impls_in_block_query").entered(); + let _p = tracing::info_span!("inherent_impls_in_block_query").entered(); let mut impls = Self { map: FxHashMap::default(), invalid_impls: Vec::default() }; let block_def_map = db.block_def_map(block); @@ -368,7 +365,7 @@ pub(crate) fn incoherent_inherent_impl_crates( krate: CrateId, fp: TyFingerprint, ) -> SmallVec<[CrateId; 2]> { - let _p = tracing::span!(tracing::Level::INFO, "incoherent_inherent_impl_crates").entered(); + let _p = tracing::info_span!("incoherent_inherent_impl_crates").entered(); let mut res = SmallVec::new(); let crate_graph = db.crate_graph(); @@ -937,8 +934,7 @@ pub fn iterate_method_candidates_dyn( mode: LookupMode, callback: &mut dyn FnMut(ReceiverAdjustments, AssocItemId, bool) -> ControlFlow<()>, ) -> ControlFlow<()> { - let _p = tracing::span!( - tracing::Level::INFO, + let _p = tracing::info_span!( "iterate_method_candidates_dyn", ?mode, ?name, @@ -1504,7 +1500,7 @@ fn is_valid_impl_fn_candidate( } } table.run_in_snapshot(|table| { - let _p = tracing::span!(tracing::Level::INFO, "subst_for_def").entered(); + let _p = tracing::info_span!("subst_for_def").entered(); let impl_subst = TyBuilder::subst_for_def(db, impl_id, None).fill_with_inference_vars(table).build(); let expect_self_ty = db.impl_self_ty(impl_id).substitute(Interner, &impl_subst); @@ -1512,7 +1508,7 @@ fn is_valid_impl_fn_candidate( check_that!(table.unify(&expect_self_ty, self_ty)); if let Some(receiver_ty) = receiver_ty { - let _p = tracing::span!(tracing::Level::INFO, "check_receiver_ty").entered(); + let _p = tracing::info_span!("check_receiver_ty").entered(); check_that!(data.has_self_param()); let fn_subst = TyBuilder::subst_for_def(db, fn_id, Some(impl_subst.clone())) diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs index 8b6936f8bc0fc..878d584a4efa0 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/borrowck.rs @@ -91,7 +91,7 @@ pub fn borrowck_query( db: &dyn HirDatabase, def: DefWithBodyId, ) -> Result, MirLowerError> { - let _p = tracing::span!(tracing::Level::INFO, "borrowck_query").entered(); + let _p = tracing::info_span!("borrowck_query").entered(); let mut res = vec![]; all_mir_bodies(db, def, |body| { res.push(BorrowckResult { diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs index 95b16ca8bc637..6d662959f19c0 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/mir/lower.rs @@ -2133,7 +2133,7 @@ pub fn mir_body_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Result format!("in type const {it:?}"), }; - let _p = tracing::span!(tracing::Level::INFO, "mir_body_query", ?detail).entered(); + let _p = tracing::info_span!("mir_body_query", ?detail).entered(); let body = db.body(def); let infer = db.infer(def); let mut result = lower_to_mir(db, def, &body, &infer, body.body_expr)?; diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs b/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs index 02f2cd761599a..4283a94657b9f 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/traits.rs @@ -108,7 +108,7 @@ pub(crate) fn trait_solve_query( GoalData::DomainGoal(DomainGoal::Holds(WhereClause::AliasEq(_))) => "alias_eq".to_owned(), _ => "??".to_owned(), }; - let _p = tracing::span!(tracing::Level::INFO, "trait_solve_query", ?detail).entered(); + let _p = tracing::info_span!("trait_solve_query", ?detail).entered(); tracing::info!("trait_solve_query({:?})", goal.value.goal); if let GoalData::DomainGoal(DomainGoal::Holds(WhereClause::AliasEq(AliasEq { @@ -140,7 +140,7 @@ fn solve( block: Option, goal: &chalk_ir::UCanonical>>, ) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "solve", ?krate, ?block).entered(); + let _p = tracing::info_span!("solve", ?krate, ?block).entered(); let context = ChalkContext { db, krate, block }; tracing::debug!("solve goal: {:?}", goal); let mut solver = create_chalk_solver(); diff --git a/src/tools/rust-analyzer/crates/hir/src/lib.rs b/src/tools/rust-analyzer/crates/hir/src/lib.rs index 64d08c7364ea5..c69336407ef64 100644 --- a/src/tools/rust-analyzer/crates/hir/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir/src/lib.rs @@ -243,7 +243,7 @@ impl Crate { db: &dyn DefDatabase, query: import_map::Query, ) -> impl Iterator> { - let _p = tracing::span!(tracing::Level::INFO, "query_external_importables").entered(); + let _p = tracing::info_span!("query_external_importables").entered(); import_map::search_dependencies(db, self.into(), &query).into_iter().map(|item| { match ItemInNs::from(item) { ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id), @@ -552,8 +552,7 @@ impl Module { acc: &mut Vec, style_lints: bool, ) { - let _p = tracing::span!(tracing::Level::INFO, "Module::diagnostics", name = ?self.name(db)) - .entered(); + let _p = tracing::info_span!("Module::diagnostics", name = ?self.name(db)).entered(); let def_map = self.id.def_map(db.upcast()); for diag in def_map.diagnostics() { if diag.in_module != self.id.local_id { @@ -4631,8 +4630,7 @@ impl Type { name: Option<&Name>, mut callback: impl FnMut(Function) -> Option, ) -> Option { - let _p = - tracing::span!(tracing::Level::INFO, "iterate_method_candidates_with_traits").entered(); + let _p = tracing::info_span!("iterate_method_candidates_with_traits").entered(); let mut slot = None; self.iterate_method_candidates_dyn( @@ -4681,8 +4679,7 @@ impl Type { name: Option<&Name>, callback: &mut dyn FnMut(AssocItemId) -> ControlFlow<()>, ) { - let _p = tracing::span!( - tracing::Level::INFO, + let _p = tracing::info_span!( "iterate_method_candidates_dyn", with_local_impls = traits_in_scope.len(), traits_in_scope = traits_in_scope.len(), @@ -4720,7 +4717,7 @@ impl Type { name: Option<&Name>, mut callback: impl FnMut(AssocItem) -> Option, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "iterate_path_candidates").entered(); + let _p = tracing::info_span!("iterate_path_candidates").entered(); let mut slot = None; self.iterate_path_candidates_dyn( db, @@ -4787,7 +4784,7 @@ impl Type { &'a self, db: &'a dyn HirDatabase, ) -> impl Iterator + 'a { - let _p = tracing::span!(tracing::Level::INFO, "applicable_inherent_traits").entered(); + let _p = tracing::info_span!("applicable_inherent_traits").entered(); self.autoderef_(db) .filter_map(|ty| ty.dyn_trait()) .flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id)) @@ -4795,7 +4792,7 @@ impl Type { } pub fn env_traits<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator + 'a { - let _p = tracing::span!(tracing::Level::INFO, "env_traits").entered(); + let _p = tracing::info_span!("env_traits").entered(); self.autoderef_(db) .filter(|ty| matches!(ty.kind(Interner), TyKind::Placeholder(_))) .flat_map(|ty| { diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics.rs b/src/tools/rust-analyzer/crates/hir/src/semantics.rs index c8f61a34cb529..964401d48d9b0 100644 --- a/src/tools/rust-analyzer/crates/hir/src/semantics.rs +++ b/src/tools/rust-analyzer/crates/hir/src/semantics.rs @@ -780,7 +780,7 @@ impl<'db> SemanticsImpl<'db> { mut token: SyntaxToken, f: &mut dyn FnMut(InFile) -> ControlFlow<()>, ) { - let _p = tracing::span!(tracing::Level::INFO, "descend_into_macros_impl").entered(); + let _p = tracing::info_span!("descend_into_macros_impl").entered(); let (sa, span, file_id) = match token.parent().and_then(|parent| self.analyze_no_infer(&parent)) { Some(sa) => match sa.file_id.file_id() { @@ -1462,7 +1462,7 @@ impl<'db> SemanticsImpl<'db> { offset: Option, infer_body: bool, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "SemanticsImpl::analyze_impl").entered(); + let _p = tracing::info_span!("SemanticsImpl::analyze_impl").entered(); let node = self.find_file(node); let container = self.with_ctx(|ctx| ctx.find_container(node))?; diff --git a/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs b/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs index 85e7c31ddf9b2..13dba8805ac71 100644 --- a/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs +++ b/src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs @@ -126,7 +126,7 @@ pub(super) struct SourceToDefCtx<'db, 'cache> { impl SourceToDefCtx<'_, '_> { pub(super) fn file_to_def(&mut self, file: FileId) -> &SmallVec<[ModuleId; 1]> { - let _p = tracing::span!(tracing::Level::INFO, "SourceToDefCtx::file_to_def").entered(); + let _p = tracing::info_span!("SourceToDefCtx::file_to_def").entered(); self.cache.file_to_def_cache.entry(file).or_insert_with(|| { let mut mods = SmallVec::new(); for &crate_id in self.db.relevant_crates(file).iter() { @@ -146,7 +146,7 @@ impl SourceToDefCtx<'_, '_> { } pub(super) fn module_to_def(&mut self, src: InFile<&ast::Module>) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "module_to_def").entered(); + let _p = tracing::info_span!("module_to_def").entered(); let parent_declaration = self .ancestors_with_macros(src.syntax_ref(), |_, ancestor| { ancestor.map(Either::::cast).transpose() @@ -173,7 +173,7 @@ impl SourceToDefCtx<'_, '_> { } pub(super) fn source_file_to_def(&mut self, src: InFile<&ast::SourceFile>) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "source_file_to_def").entered(); + let _p = tracing::info_span!("source_file_to_def").entered(); let file_id = src.file_id.original_file(self.db.upcast()); self.file_to_def(file_id).first().copied() } @@ -405,7 +405,7 @@ impl SourceToDefCtx<'_, '_> { } pub(super) fn find_container(&mut self, src: InFile<&SyntaxNode>) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "find_container").entered(); + let _p = tracing::info_span!("find_container").entered(); let def = self.ancestors_with_macros(src, |this, container| this.container_to_def(container)); if let Some(def) = def { @@ -564,7 +564,7 @@ impl_from! { impl ChildContainer { fn child_by_source(self, db: &dyn HirDatabase, file_id: HirFileId) -> DynMap { - let _p = tracing::span!(tracing::Level::INFO, "ChildContainer::child_by_source").entered(); + let _p = tracing::info_span!("ChildContainer::child_by_source").entered(); let db = db.upcast(); match self { ChildContainer::DefWithBodyId(it) => it.child_by_source(db, file_id), diff --git a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs index 24a32086f3daa..ebfbb83bb9183 100644 --- a/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs +++ b/src/tools/rust-analyzer/crates/ide-assists/src/handlers/add_missing_impl_members.rs @@ -105,7 +105,7 @@ fn add_missing_impl_members_inner( assist_id: &'static str, label: &'static str, ) -> Option<()> { - let _p = tracing::span!(tracing::Level::INFO, "add_missing_impl_members_inner").entered(); + let _p = tracing::info_span!("add_missing_impl_members_inner").entered(); let impl_def = ctx.find_node_at_offset::()?; let impl_ = ctx.sema.to_def(&impl_def)?; diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs index ddb1aeb3711d8..7281c607da434 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs @@ -15,7 +15,7 @@ pub(crate) fn complete_expr_path( path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx, expr_ctx: &PathExprCtx, ) { - let _p = tracing::span!(tracing::Level::INFO, "complete_expr_path").entered(); + let _p = tracing::info_span!("complete_expr_path").entered(); if !ctx.qualifier_ctx.none() { return; } @@ -334,7 +334,7 @@ pub(crate) fn complete_expr_path( } pub(crate) fn complete_expr(acc: &mut Completions, ctx: &CompletionContext<'_>) { - let _p = tracing::span!(tracing::Level::INFO, "complete_expr").entered(); + let _p = tracing::info_span!("complete_expr").entered(); if !ctx.config.enable_term_search { return; diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/flyimport.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/flyimport.rs index d5a4e9ecdcc13..71d44a57cb932 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/flyimport.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/flyimport.rs @@ -207,8 +207,7 @@ fn import_on_the_fly( position: SyntaxNode, potential_import_name: String, ) -> Option<()> { - let _p = - tracing::span!(tracing::Level::INFO, "import_on_the_fly", ?potential_import_name).entered(); + let _p = tracing::info_span!("import_on_the_fly", ?potential_import_name).entered(); ImportScope::find_insert_use_container(&position, &ctx.sema)?; @@ -296,8 +295,7 @@ fn import_on_the_fly_pat_( position: SyntaxNode, potential_import_name: String, ) -> Option<()> { - let _p = tracing::span!(tracing::Level::INFO, "import_on_the_fly_pat_", ?potential_import_name) - .entered(); + let _p = tracing::info_span!("import_on_the_fly_pat_", ?potential_import_name).entered(); ImportScope::find_insert_use_container(&position, &ctx.sema)?; @@ -347,9 +345,7 @@ fn import_on_the_fly_method( position: SyntaxNode, potential_import_name: String, ) -> Option<()> { - let _p = - tracing::span!(tracing::Level::INFO, "import_on_the_fly_method", ?potential_import_name) - .entered(); + let _p = tracing::info_span!("import_on_the_fly_method", ?potential_import_name).entered(); ImportScope::find_insert_use_container(&position, &ctx.sema)?; @@ -397,13 +393,8 @@ fn import_assets_for_path( potential_import_name: &str, qualifier: Option, ) -> Option { - let _p = tracing::span!( - tracing::Level::INFO, - "import_assets_for_path", - ?potential_import_name, - ?qualifier - ) - .entered(); + let _p = + tracing::info_span!("import_assets_for_path", ?potential_import_name, ?qualifier).entered(); let fuzzy_name_length = potential_import_name.len(); let mut assets_for_path = ImportAssets::for_fuzzy_path( diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs index 0a6a8633a2c12..ce366813269c0 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list.rs @@ -28,7 +28,7 @@ pub(crate) fn complete_item_list( path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx, kind: &ItemListKind, ) { - let _p = tracing::span!(tracing::Level::INFO, "complete_item_list").entered(); + let _p = tracing::info_span!("complete_item_list").entered(); if path_ctx.is_trivial_path() { add_keywords(acc, ctx, Some(kind)); } diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/mod_.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/mod_.rs index c2faa2d939d87..f307ba9eb33c3 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/mod_.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/mod_.rs @@ -21,7 +21,7 @@ pub(crate) fn complete_mod( return None; } - let _p = tracing::span!(tracing::Level::INFO, "completion::complete_mod").entered(); + let _p = tracing::info_span!("completion::complete_mod").entered(); let mut current_module = ctx.module; // For `mod $0`, `ctx.module` is its parent, but for `mod f$0`, it's `mod f` itself, but we're diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs index 2361d14aae7f7..b07148809323f 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/completions/type.rs @@ -15,7 +15,7 @@ pub(crate) fn complete_type_path( path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx, location: &TypeLocation, ) { - let _p = tracing::span!(tracing::Level::INFO, "complete_type_path").entered(); + let _p = tracing::info_span!("complete_type_path").entered(); let scope_def_applicable = |def| { use hir::{GenericParam::*, ModuleDef::*}; diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/context.rs b/src/tools/rust-analyzer/crates/ide-completion/src/context.rs index db34beadc0fa5..8283497d9ad06 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/context.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/context.rs @@ -585,8 +585,7 @@ impl CompletionContext<'_> { /// A version of [`SemanticsScope::process_all_names`] that filters out `#[doc(hidden)]` items and /// passes all doc-aliases along, to funnel it into [`Completions::add_path_resolution`]. pub(crate) fn process_all_names(&self, f: &mut dyn FnMut(Name, ScopeDef, Vec)) { - let _p = - tracing::span!(tracing::Level::INFO, "CompletionContext::process_all_names").entered(); + let _p = tracing::info_span!("CompletionContext::process_all_names").entered(); self.scope.process_all_names(&mut |name, def| { if self.is_scope_def_hidden(def) { return; @@ -597,8 +596,7 @@ impl CompletionContext<'_> { } pub(crate) fn process_all_names_raw(&self, f: &mut dyn FnMut(Name, ScopeDef)) { - let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::process_all_names_raw") - .entered(); + let _p = tracing::info_span!("CompletionContext::process_all_names_raw").entered(); self.scope.process_all_names(f); } @@ -656,7 +654,7 @@ impl<'a> CompletionContext<'a> { position @ FilePosition { file_id, offset }: FilePosition, config: &'a CompletionConfig, ) -> Option<(CompletionContext<'a>, CompletionAnalysis)> { - let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::new").entered(); + let _p = tracing::info_span!("CompletionContext::new").entered(); let sema = Semantics::new(db); let original_file = sema.parse(file_id); diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs b/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs index f0c6e7a63b008..80ce5bd4cf284 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs @@ -74,7 +74,7 @@ fn expand( mut fake_ident_token: SyntaxToken, relative_offset: TextSize, ) -> ExpansionResult { - let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::expand").entered(); + let _p = tracing::info_span!("CompletionContext::expand").entered(); let mut derive_ctx = None; 'expansion: loop { @@ -278,7 +278,7 @@ fn analyze( original_token: &SyntaxToken, self_token: &SyntaxToken, ) -> Option<(CompletionAnalysis, (Option, Option), QualifierCtx)> { - let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::analyze").entered(); + let _p = tracing::info_span!("CompletionContext::analyze").entered(); let ExpansionResult { original_file, speculative_file, offset, fake_ident_token, derive_ctx } = expansion_result; diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/item.rs b/src/tools/rust-analyzer/crates/ide-completion/src/item.rs index b9a2c383bdd1b..debfefc4801ca 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/item.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/item.rs @@ -483,7 +483,7 @@ impl Builder { } pub(crate) fn build(self, db: &RootDatabase) -> CompletionItem { - let _p = tracing::span!(tracing::Level::INFO, "item::Builder::build").entered(); + let _p = tracing::info_span!("item::Builder::build").entered(); let label = self.label; let mut label_detail = None; diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/lib.rs b/src/tools/rust-analyzer/crates/ide-completion/src/lib.rs index a83fa28b8758e..8323b8f9331dd 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/lib.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/lib.rs @@ -238,7 +238,7 @@ pub fn resolve_completion_edits( FilePosition { file_id, offset }: FilePosition, imports: impl IntoIterator, ) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "resolve_completion_edits").entered(); + let _p = tracing::info_span!("resolve_completion_edits").entered(); let sema = hir::Semantics::new(db); let original_file = sema.parse(file_id); diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render.rs index 8f563790737e5..905c7eebfab75 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render.rs @@ -353,7 +353,7 @@ fn render_resolution_pat( import_to_add: Option, resolution: ScopeDef, ) -> Builder { - let _p = tracing::span!(tracing::Level::INFO, "render_resolution_pat").entered(); + let _p = tracing::info_span!("render_resolution_pat").entered(); use hir::ModuleDef::*; if let ScopeDef::ModuleDef(Macro(mac)) = resolution { @@ -371,7 +371,7 @@ fn render_resolution_path( import_to_add: Option, resolution: ScopeDef, ) -> Builder { - let _p = tracing::span!(tracing::Level::INFO, "render_resolution_path").entered(); + let _p = tracing::info_span!("render_resolution_path").entered(); use hir::ModuleDef::*; match resolution { @@ -479,7 +479,7 @@ fn render_resolution_simple_( import_to_add: Option, resolution: ScopeDef, ) -> Builder { - let _p = tracing::span!(tracing::Level::INFO, "render_resolution_simple_").entered(); + let _p = tracing::info_span!("render_resolution_simple_").entered(); let db = ctx.db(); let ctx = ctx.import_to_add(import_to_add); diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/const_.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/const_.rs index 0d24882156d3c..a6a1c79e6687c 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render/const_.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/const_.rs @@ -6,7 +6,7 @@ use ide_db::SymbolKind; use crate::{item::CompletionItem, render::RenderContext}; pub(crate) fn render_const(ctx: RenderContext<'_>, const_: hir::Const) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "render_const").entered(); + let _p = tracing::info_span!("render_const").entered(); render(ctx, const_) } diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs index 1634b0a920611..48c9d624f63ac 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/function.rs @@ -30,7 +30,7 @@ pub(crate) fn render_fn( local_name: Option, func: hir::Function, ) -> Builder { - let _p = tracing::span!(tracing::Level::INFO, "render_fn").entered(); + let _p = tracing::info_span!("render_fn").entered(); render(ctx, local_name, func, FuncKind::Function(path_ctx)) } @@ -41,7 +41,7 @@ pub(crate) fn render_method( local_name: Option, func: hir::Function, ) -> Builder { - let _p = tracing::span!(tracing::Level::INFO, "render_method").entered(); + let _p = tracing::info_span!("render_method").entered(); render(ctx, local_name, func, FuncKind::Method(dot_access, receiver)) } diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs index 9c5cb1e37d967..27435307d5086 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/literal.rs @@ -27,7 +27,7 @@ pub(crate) fn render_variant_lit( variant: hir::Variant, path: Option, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "render_variant_lit").entered(); + let _p = tracing::info_span!("render_variant_lit").entered(); let db = ctx.db(); let name = local_name.unwrap_or_else(|| variant.name(db)); @@ -41,7 +41,7 @@ pub(crate) fn render_struct_literal( path: Option, local_name: Option, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "render_struct_literal").entered(); + let _p = tracing::info_span!("render_struct_literal").entered(); let db = ctx.db(); let name = local_name.unwrap_or_else(|| strukt.name(db)); diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/macro_.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/macro_.rs index 8b81a95abbeef..a6c8c0e853c9f 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render/macro_.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/macro_.rs @@ -17,7 +17,7 @@ pub(crate) fn render_macro( name: hir::Name, macro_: hir::Macro, ) -> Builder { - let _p = tracing::span!(tracing::Level::INFO, "render_macro").entered(); + let _p = tracing::info_span!("render_macro").entered(); render(ctx, *kind == PathKind::Use, *has_macro_bang, *has_call_parens, name, macro_) } @@ -27,7 +27,7 @@ pub(crate) fn render_macro_pat( name: hir::Name, macro_: hir::Macro, ) -> Builder { - let _p = tracing::span!(tracing::Level::INFO, "render_macro_pat").entered(); + let _p = tracing::info_span!("render_macro_pat").entered(); render(ctx, false, false, false, name, macro_) } diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs index c07966f7a7a82..942670be2a30f 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs @@ -20,7 +20,7 @@ pub(crate) fn render_struct_pat( strukt: hir::Struct, local_name: Option, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "render_struct_pat").entered(); + let _p = tracing::info_span!("render_struct_pat").entered(); let fields = strukt.fields(ctx.db()); let (visible_fields, fields_omitted) = visible_fields(ctx.completion, &fields, strukt)?; @@ -50,7 +50,7 @@ pub(crate) fn render_variant_pat( local_name: Option, path: Option<&hir::ModPath>, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "render_variant_pat").entered(); + let _p = tracing::info_span!("render_variant_pat").entered(); let fields = variant.fields(ctx.db()); let (visible_fields, fields_omitted) = visible_fields(ctx.completion, &fields, variant)?; diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/type_alias.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/type_alias.rs index 8f80793dd72d1..47254e6a18473 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render/type_alias.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/type_alias.rs @@ -10,7 +10,7 @@ pub(crate) fn render_type_alias( ctx: RenderContext<'_>, type_alias: hir::TypeAlias, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "render_type_alias").entered(); + let _p = tracing::info_span!("render_type_alias").entered(); render(ctx, type_alias, false) } @@ -18,7 +18,7 @@ pub(crate) fn render_type_alias_with_eq( ctx: RenderContext<'_>, type_alias: hir::TypeAlias, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "render_type_alias_with_eq").entered(); + let _p = tracing::info_span!("render_type_alias_with_eq").entered(); render(ctx, type_alias, true) } diff --git a/src/tools/rust-analyzer/crates/ide-db/src/apply_change.rs b/src/tools/rust-analyzer/crates/ide-db/src/apply_change.rs index ce9a5f0dd29f7..74c8fc96d4ac4 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/apply_change.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/apply_change.rs @@ -15,13 +15,12 @@ use crate::{symbol_index::SymbolsDatabase, ChangeWithProcMacros, RootDatabase}; impl RootDatabase { pub fn request_cancellation(&mut self) { - let _p = - tracing::span!(tracing::Level::INFO, "RootDatabase::request_cancellation").entered(); + let _p = tracing::info_span!("RootDatabase::request_cancellation").entered(); self.synthetic_write(Durability::LOW); } pub fn apply_change(&mut self, change: ChangeWithProcMacros) { - let _p = tracing::span!(tracing::Level::INFO, "RootDatabase::apply_change").entered(); + let _p = tracing::info_span!("RootDatabase::apply_change").entered(); self.request_cancellation(); tracing::trace!("apply_change {:?}", change); if let Some(roots) = &change.source_change.roots { diff --git a/src/tools/rust-analyzer/crates/ide-db/src/defs.rs b/src/tools/rust-analyzer/crates/ide-db/src/defs.rs index 634277e869868..a75a708d95692 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/defs.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/defs.rs @@ -413,7 +413,7 @@ impl NameClass { } pub fn classify(sema: &Semantics<'_, RootDatabase>, name: &ast::Name) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "NameClass::classify").entered(); + let _p = tracing::info_span!("NameClass::classify").entered(); let parent = name.syntax().parent()?; @@ -505,8 +505,7 @@ impl NameClass { sema: &Semantics<'_, RootDatabase>, lifetime: &ast::Lifetime, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "NameClass::classify_lifetime", ?lifetime) - .entered(); + let _p = tracing::info_span!("NameClass::classify_lifetime", ?lifetime).entered(); let parent = lifetime.syntax().parent()?; if let Some(it) = ast::LifetimeParam::cast(parent.clone()) { @@ -597,8 +596,7 @@ impl NameRefClass { sema: &Semantics<'_, RootDatabase>, name_ref: &ast::NameRef, ) -> Option { - let _p = - tracing::span!(tracing::Level::INFO, "NameRefClass::classify", ?name_ref).entered(); + let _p = tracing::info_span!("NameRefClass::classify", ?name_ref).entered(); let parent = name_ref.syntax().parent()?; @@ -697,8 +695,7 @@ impl NameRefClass { sema: &Semantics<'_, RootDatabase>, lifetime: &ast::Lifetime, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "NameRefClass::classify_lifetime", ?lifetime) - .entered(); + let _p = tracing::info_span!("NameRefClass::classify_lifetime", ?lifetime).entered(); if lifetime.text() == "'static" { return Some(NameRefClass::Definition(Definition::BuiltinLifetime(StaticLifetime))); } diff --git a/src/tools/rust-analyzer/crates/ide-db/src/helpers.rs b/src/tools/rust-analyzer/crates/ide-db/src/helpers.rs index 063e366d4bf7a..c069e1c25b61e 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/helpers.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/helpers.rs @@ -35,7 +35,7 @@ pub fn pick_token(mut tokens: TokenAtOffset) -> Option /// Converts the mod path struct into its ast representation. pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path { - let _p = tracing::span!(tracing::Level::INFO, "mod_path_to_ast").entered(); + let _p = tracing::info_span!("mod_path_to_ast").entered(); let mut segments = Vec::new(); let mut is_abs = false; diff --git a/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs b/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs index 4caecb3f2fe10..088717a66e590 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs @@ -208,7 +208,7 @@ impl ImportAssets { cfg: ImportPathConfig, prefix_kind: PrefixKind, ) -> impl Iterator { - let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::search_for_imports").entered(); + let _p = tracing::info_span!("ImportAssets::search_for_imports").entered(); self.search_for(sema, Some(prefix_kind), cfg) } @@ -218,8 +218,7 @@ impl ImportAssets { sema: &Semantics<'_, RootDatabase>, cfg: ImportPathConfig, ) -> impl Iterator { - let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::search_for_relative_paths") - .entered(); + let _p = tracing::info_span!("ImportAssets::search_for_relative_paths").entered(); self.search_for(sema, None, cfg) } @@ -259,7 +258,7 @@ impl ImportAssets { prefixed: Option, cfg: ImportPathConfig, ) -> impl Iterator { - let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::search_for").entered(); + let _p = tracing::info_span!("ImportAssets::search_for").entered(); let scope = match sema.scope(&self.candidate_node) { Some(it) => it, @@ -303,7 +302,7 @@ impl ImportAssets { } fn scope_definitions(&self, sema: &Semantics<'_, RootDatabase>) -> FxHashSet { - let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::scope_definitions").entered(); + let _p = tracing::info_span!("ImportAssets::scope_definitions").entered(); let mut scope_definitions = FxHashSet::default(); if let Some(scope) = sema.scope(&self.candidate_node) { scope.process_all_names(&mut |_, scope_def| { @@ -321,8 +320,7 @@ fn path_applicable_imports( mod_path: impl Fn(ItemInNs) -> Option + Copy, scope_filter: impl Fn(ItemInNs) -> bool + Copy, ) -> FxHashSet { - let _p = - tracing::span!(tracing::Level::INFO, "ImportAssets::path_applicable_imports").entered(); + let _p = tracing::info_span!("ImportAssets::path_applicable_imports").entered(); match &path_candidate.qualifier { None => { @@ -369,7 +367,7 @@ fn import_for_item( original_item: ItemInNs, scope_filter: impl Fn(ItemInNs) -> bool, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::import_for_item").entered(); + let _p = tracing::info_span!("ImportAssets::import_for_item").entered(); let [first_segment, ..] = unresolved_qualifier else { return None }; let item_as_assoc = item_as_assoc(db, original_item); @@ -503,7 +501,7 @@ fn trait_applicable_items( mod_path: impl Fn(ItemInNs) -> Option, scope_filter: impl Fn(hir::Trait) -> bool, ) -> FxHashSet { - let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::trait_applicable_items").entered(); + let _p = tracing::info_span!("ImportAssets::trait_applicable_items").entered(); let db = sema.db; diff --git a/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs b/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs index 026d4e36f97bd..9102980677c18 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use.rs @@ -194,7 +194,7 @@ fn insert_use_with_alias_option( cfg: &InsertUseConfig, alias: Option, ) { - let _p = tracing::span!(tracing::Level::INFO, "insert_use_with_alias_option").entered(); + let _p = tracing::info_span!("insert_use_with_alias_option").entered(); let mut mb = match cfg.granularity { ImportGranularity::Crate => Some(MergeBehavior::Crate), ImportGranularity::Module => Some(MergeBehavior::Module), diff --git a/src/tools/rust-analyzer/crates/ide-db/src/items_locator.rs b/src/tools/rust-analyzer/crates/ide-db/src/items_locator.rs index 1b6f650768b9e..47549a1d0089a 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/items_locator.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/items_locator.rs @@ -21,7 +21,7 @@ pub fn items_with_name<'a>( assoc_item_search: AssocSearchMode, ) -> impl Iterator + 'a { let krate_name = krate.display_name(sema.db).map(|name| name.to_string()); - let _p = tracing::span!(tracing::Level::INFO, "items_with_name", name = name.text(), assoc_item_search = ?assoc_item_search, crate = ?krate_name) + let _p = tracing::info_span!("items_with_name", name = name.text(), assoc_item_search = ?assoc_item_search, crate = ?krate_name) .entered(); let prefix = matches!(name, NameToImport::Prefix(..)); @@ -72,7 +72,7 @@ fn find_items<'a>( local_query: symbol_index::Query, external_query: import_map::Query, ) -> impl Iterator + 'a { - let _p = tracing::span!(tracing::Level::INFO, "find_items").entered(); + let _p = tracing::info_span!("find_items").entered(); let db = sema.db; // NOTE: `external_query` includes `assoc_item_search`, so we don't need to diff --git a/src/tools/rust-analyzer/crates/ide-db/src/prime_caches.rs b/src/tools/rust-analyzer/crates/ide-db/src/prime_caches.rs index 58077f636b61c..1ca52060118ad 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/prime_caches.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/prime_caches.rs @@ -32,7 +32,7 @@ pub fn parallel_prime_caches( num_worker_threads: u8, cb: &(dyn Fn(ParallelPrimeCachesProgress) + Sync), ) { - let _p = tracing::span!(tracing::Level::INFO, "parallel_prime_caches").entered(); + let _p = tracing::info_span!("parallel_prime_caches").entered(); let graph = db.crate_graph(); let mut crates_to_prime = { diff --git a/src/tools/rust-analyzer/crates/ide-db/src/search.rs b/src/tools/rust-analyzer/crates/ide-db/src/search.rs index 8f633065f3cf7..b62f34f4157d4 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/search.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/search.rs @@ -266,7 +266,7 @@ impl IntoIterator for SearchScope { impl Definition { fn search_scope(&self, db: &RootDatabase) -> SearchScope { - let _p = tracing::span!(tracing::Level::INFO, "search_scope").entered(); + let _p = tracing::info_span!("search_scope").entered(); if let Definition::BuiltinType(_) = self { return SearchScope::crate_graph(db); @@ -434,7 +434,7 @@ impl<'a> FindUsages<'a> { } pub fn search(&self, sink: &mut dyn FnMut(FileId, FileReference) -> bool) { - let _p = tracing::span!(tracing::Level::INFO, "FindUsages:search").entered(); + let _p = tracing::info_span!("FindUsages:search").entered(); let sema = self.sema; let search_scope = { diff --git a/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs b/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs index 3539c7fbf8f99..c70aed4c43bb8 100644 --- a/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs +++ b/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs @@ -124,7 +124,7 @@ pub trait SymbolsDatabase: HirDatabase + SourceDatabaseExt + Upcast Arc { - let _p = tracing::span!(tracing::Level::INFO, "library_symbols").entered(); + let _p = tracing::info_span!("library_symbols").entered(); let mut symbol_collector = SymbolCollector::new(db.upcast()); @@ -142,14 +142,14 @@ fn library_symbols(db: &dyn SymbolsDatabase, source_root_id: SourceRootId) -> Ar } fn module_symbols(db: &dyn SymbolsDatabase, module: Module) -> Arc { - let _p = tracing::span!(tracing::Level::INFO, "module_symbols").entered(); + let _p = tracing::info_span!("module_symbols").entered(); let symbols = SymbolCollector::collect_module(db.upcast(), module); Arc::new(SymbolIndex::new(symbols)) } pub fn crate_symbols(db: &dyn SymbolsDatabase, krate: Crate) -> Box<[Arc]> { - let _p = tracing::span!(tracing::Level::INFO, "crate_symbols").entered(); + let _p = tracing::info_span!("crate_symbols").entered(); krate.modules(db.upcast()).into_iter().map(|module| db.module_symbols(module)).collect() } @@ -201,7 +201,7 @@ impl std::ops::Deref for Snap { // | VS Code | kbd:[Ctrl+T] // |=== pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "world_symbols", query = ?query.query).entered(); + let _p = tracing::info_span!("world_symbols", query = ?query.query).entered(); let indices: Vec<_> = if query.libs { db.library_roots() @@ -321,7 +321,7 @@ impl Query { indices: &'sym [Arc], cb: impl FnMut(&'sym FileSymbol), ) { - let _p = tracing::span!(tracing::Level::INFO, "symbol_index::Query::search").entered(); + let _p = tracing::info_span!("symbol_index::Query::search").entered(); let mut op = fst::map::OpBuilder::new(); match self.mode { SearchMode::Exact => { diff --git a/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs b/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs index 15543a5d65538..85918254dc58e 100644 --- a/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs +++ b/src/tools/rust-analyzer/crates/ide-diagnostics/src/lib.rs @@ -297,7 +297,7 @@ pub fn diagnostics( resolve: &AssistResolveStrategy, file_id: FileId, ) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "diagnostics").entered(); + let _p = tracing::info_span!("diagnostics").entered(); let sema = Semantics::new(db); let mut res = Vec::new(); @@ -482,7 +482,7 @@ fn handle_lint_attributes( clippy_stack: &mut FxHashMap>, diagnostics_of_range: &mut FxHashMap, &mut Diagnostic>, ) { - let _g = tracing::span!(tracing::Level::INFO, "handle_lint_attributes").entered(); + let _g = tracing::info_span!("handle_lint_attributes").entered(); let file_id = sema.hir_file_for(root); let preorder = root.preorder(); for ev in preorder { diff --git a/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs b/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs index 6f32ce76b22cd..a5689403ee14b 100644 --- a/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs +++ b/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs @@ -55,7 +55,7 @@ pub(crate) fn highlight_related( config: HighlightRelatedConfig, pos @ FilePosition { offset, file_id }: FilePosition, ) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "highlight_related").entered(); + let _p = tracing::info_span!("highlight_related").entered(); let syntax = sema.parse(file_id).syntax().clone(); let token = pick_best_token(syntax.token_at_offset(offset), |kind| match kind { diff --git a/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs b/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs index dda5a005a7230..e9c48ab1e76b4 100644 --- a/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs +++ b/src/tools/rust-analyzer/crates/ide/src/inlay_hints.rs @@ -462,7 +462,7 @@ pub(crate) fn inlay_hints( range_limit: Option, config: &InlayHintsConfig, ) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "inlay_hints").entered(); + let _p = tracing::info_span!("inlay_hints").entered(); let sema = Semantics::new(db); let file = sema.parse(file_id); let file = file.syntax(); @@ -496,7 +496,7 @@ pub(crate) fn inlay_hints_resolve( config: &InlayHintsConfig, hasher: impl Fn(&InlayHint) -> u64, ) -> Option { - let _p = tracing::span!(tracing::Level::INFO, "inlay_hints_resolve").entered(); + let _p = tracing::info_span!("inlay_hints_resolve").entered(); let sema = Semantics::new(db); let file = sema.parse(file_id); let file = file.syntax(); diff --git a/src/tools/rust-analyzer/crates/ide/src/references.rs b/src/tools/rust-analyzer/crates/ide/src/references.rs index 01af864cdf57d..6f9e1b3740c0e 100644 --- a/src/tools/rust-analyzer/crates/ide/src/references.rs +++ b/src/tools/rust-analyzer/crates/ide/src/references.rs @@ -55,7 +55,7 @@ pub(crate) fn find_all_refs( position: FilePosition, search_scope: Option, ) -> Option> { - let _p = tracing::span!(tracing::Level::INFO, "find_all_refs").entered(); + let _p = tracing::info_span!("find_all_refs").entered(); let syntax = sema.parse(position.file_id).syntax().clone(); let make_searcher = |literal_search: bool| { move |def: Definition| { diff --git a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting.rs b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting.rs index 6aaf8f8e77957..fd8e6f4046582 100644 --- a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting.rs +++ b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting.rs @@ -186,7 +186,7 @@ pub(crate) fn highlight( file_id: FileId, range_to_highlight: Option, ) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "highlight").entered(); + let _p = tracing::info_span!("highlight").entered(); let sema = Semantics::new(db); // Determine the root based on the given range. diff --git a/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs b/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs index 76940ab57ab79..8adadddde611a 100644 --- a/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs +++ b/src/tools/rust-analyzer/crates/load-cargo/src/lib.rs @@ -17,7 +17,7 @@ use itertools::Itertools; use proc_macro_api::{MacroDylib, ProcMacroServer}; use project_model::{CargoConfig, PackageRoot, ProjectManifest, ProjectWorkspace}; use span::Span; -use tracing::{instrument, Level}; +use tracing::instrument; use vfs::{file_set::FileSetConfig, loader::Handle, AbsPath, AbsPathBuf, VfsPath}; pub struct LoadCargoConfig { @@ -352,8 +352,8 @@ fn load_crate_graph( } } vfs::loader::Message::Loaded { files } | vfs::loader::Message::Changed { files } => { - let _p = tracing::span!(Level::INFO, "load_cargo::load_crate_craph/LoadedChanged") - .entered(); + let _p = + tracing::info_span!("load_cargo::load_crate_craph/LoadedChanged").entered(); for (path, contents) in files { vfs.set_file_contents(path.into(), contents); } diff --git a/src/tools/rust-analyzer/crates/parser/src/lexed_str.rs b/src/tools/rust-analyzer/crates/parser/src/lexed_str.rs index e5fec67de7060..52b24b7372578 100644 --- a/src/tools/rust-analyzer/crates/parser/src/lexed_str.rs +++ b/src/tools/rust-analyzer/crates/parser/src/lexed_str.rs @@ -31,7 +31,7 @@ struct LexError { impl<'a> LexedStr<'a> { pub fn new(text: &'a str) -> LexedStr<'a> { - let _p = tracing::span!(tracing::Level::INFO, "LexedStr::new").entered(); + let _p = tracing::info_span!("LexedStr::new").entered(); let mut conv = Converter::new(text); if let Some(shebang_len) = rustc_lexer::strip_shebang(text) { conv.res.push(SHEBANG, conv.offset); diff --git a/src/tools/rust-analyzer/crates/parser/src/lib.rs b/src/tools/rust-analyzer/crates/parser/src/lib.rs index c7ad025f6b099..c2f9ea4772865 100644 --- a/src/tools/rust-analyzer/crates/parser/src/lib.rs +++ b/src/tools/rust-analyzer/crates/parser/src/lib.rs @@ -89,7 +89,7 @@ pub enum TopEntryPoint { impl TopEntryPoint { pub fn parse(&self, input: &Input, edition: Edition) -> Output { - let _p = tracing::span!(tracing::Level::INFO, "TopEntryPoint::parse", ?self).entered(); + let _p = tracing::info_span!("TopEntryPoint::parse", ?self).entered(); let entry_point: fn(&'_ mut parser::Parser<'_>) = match self { TopEntryPoint::SourceFile => grammar::entry::top::source_file, TopEntryPoint::MacroStmts => grammar::entry::top::macro_stmts, diff --git a/src/tools/rust-analyzer/crates/parser/src/shortcuts.rs b/src/tools/rust-analyzer/crates/parser/src/shortcuts.rs index cc2b63d1e66a9..7f49cc087aecf 100644 --- a/src/tools/rust-analyzer/crates/parser/src/shortcuts.rs +++ b/src/tools/rust-analyzer/crates/parser/src/shortcuts.rs @@ -26,7 +26,7 @@ pub enum StrStep<'a> { impl LexedStr<'_> { pub fn to_input(&self) -> crate::Input { - let _p = tracing::span!(tracing::Level::INFO, "LexedStr::to_input").entered(); + let _p = tracing::info_span!("LexedStr::to_input").entered(); let mut res = crate::Input::default(); let mut was_joint = false; for i in 0..self.len() { diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs index 87494172907e9..8970bdd012143 100644 --- a/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs +++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs @@ -129,7 +129,7 @@ impl ProcMacroServer { } pub fn load_dylib(&self, dylib: MacroDylib) -> Result, ServerError> { - let _p = tracing::span!(tracing::Level::INFO, "ProcMacroServer::load_dylib").entered(); + let _p = tracing::info_span!("ProcMacroServer::load_dylib").entered(); let macros = self.process.lock().unwrap_or_else(|e| e.into_inner()).find_proc_macros(&dylib.path)?; diff --git a/src/tools/rust-analyzer/crates/project-model/src/rustc_cfg.rs b/src/tools/rust-analyzer/crates/project-model/src/rustc_cfg.rs index 26499308ce96c..599897f84a082 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/rustc_cfg.rs +++ b/src/tools/rust-analyzer/crates/project-model/src/rustc_cfg.rs @@ -21,7 +21,7 @@ pub(crate) fn get( extra_env: &FxHashMap, config: RustcCfgConfig<'_>, ) -> Vec { - let _p = tracing::span!(tracing::Level::INFO, "rustc_cfg::get").entered(); + let _p = tracing::info_span!("rustc_cfg::get").entered(); let mut res = Vec::with_capacity(6 * 2 + 1); // Some nightly-only cfgs, which are required for stdlib diff --git a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs index 0d2174073a2a9..6b18b768cd8ee 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs +++ b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs @@ -705,7 +705,7 @@ impl ProjectWorkspace { load: FileLoader<'_>, extra_env: &FxHashMap, ) -> (CrateGraph, ProcMacroPaths) { - let _p = tracing::span!(tracing::Level::INFO, "ProjectWorkspace::to_crate_graph").entered(); + let _p = tracing::info_span!("ProjectWorkspace::to_crate_graph").entered(); let Self { kind, sysroot, cfg_overrides, rustc_cfg, .. } = self; let ((mut crate_graph, proc_macros), sysroot) = match kind { @@ -949,7 +949,7 @@ fn cargo_to_crate_graph( override_cfg: &CfgOverrides, build_scripts: &WorkspaceBuildScripts, ) -> (CrateGraph, ProcMacroPaths) { - let _p = tracing::span!(tracing::Level::INFO, "cargo_to_crate_graph").entered(); + let _p = tracing::info_span!("cargo_to_crate_graph").entered(); let mut res = (CrateGraph::default(), ProcMacroPaths::default()); let crate_graph = &mut res.0; let proc_macros = &mut res.1; @@ -1134,7 +1134,7 @@ fn detached_file_to_crate_graph( sysroot: &Sysroot, override_cfg: &CfgOverrides, ) -> (CrateGraph, ProcMacroPaths) { - let _p = tracing::span!(tracing::Level::INFO, "detached_file_to_crate_graph").entered(); + let _p = tracing::info_span!("detached_file_to_crate_graph").entered(); let mut crate_graph = CrateGraph::default(); let (public_deps, _libproc_macro) = sysroot_to_crate_graph(&mut crate_graph, sysroot, rustc_cfg.clone(), load); @@ -1365,7 +1365,7 @@ fn sysroot_to_crate_graph( rustc_cfg: Vec, load: FileLoader<'_>, ) -> (SysrootPublicDeps, Option) { - let _p = tracing::span!(tracing::Level::INFO, "sysroot_to_crate_graph").entered(); + let _p = tracing::info_span!("sysroot_to_crate_graph").entered(); match sysroot.mode() { SysrootMode::Workspace(cargo) => { let (mut cg, mut pm) = cargo_to_crate_graph( diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/parse.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/parse.rs index ed048aa635ba0..85ec95409ae73 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/parse.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/parse.rs @@ -6,7 +6,7 @@ use crate::cli::{flags, read_stdin}; impl flags::Parse { pub fn run(self) -> anyhow::Result<()> { - let _p = tracing::span!(tracing::Level::INFO, "flags::Parse::run").entered(); + let _p = tracing::info_span!("flags::Parse::run").entered(); let text = read_stdin()?; let file = SourceFile::parse(&text, Edition::CURRENT).tree(); if !self.no_dump { diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/diagnostics.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/diagnostics.rs index 65a9a4914934d..9f1893ff0eba2 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/diagnostics.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/diagnostics.rs @@ -128,7 +128,7 @@ pub(crate) fn fetch_native_diagnostics( snapshot: GlobalStateSnapshot, subscriptions: Vec, ) -> Vec<(FileId, Vec)> { - let _p = tracing::span!(tracing::Level::INFO, "fetch_native_diagnostics").entered(); + let _p = tracing::info_span!("fetch_native_diagnostics").entered(); let _ctx = stdx::panic_context::enter("fetch_native_diagnostics".to_owned()); let convert_diagnostic = diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/dispatch.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/dispatch.rs index cf3b8d331dea8..ebdc196a658e4 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/dispatch.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/dispatch.rs @@ -52,7 +52,8 @@ impl RequestDispatcher<'_> { Some(it) => it, None => return self, }; - let _guard = tracing::span!(tracing::Level::INFO, "request", method = ?req.method, "request_id" = ?req.id).entered(); + let _guard = + tracing::info_span!("request", method = ?req.method, "request_id" = ?req.id).entered(); tracing::debug!(?params); let result = { let _pctx = stdx::panic_context::enter(panic_context); @@ -79,7 +80,8 @@ impl RequestDispatcher<'_> { Some(it) => it, None => return self, }; - let _guard = tracing::span!(tracing::Level::INFO, "request", method = ?req.method, "request_id" = ?req.id).entered(); + let _guard = + tracing::info_span!("request", method = ?req.method, "request_id" = ?req.id).entered(); tracing::debug!(?params); let global_state_snapshot = self.global_state.snapshot(); @@ -162,7 +164,8 @@ impl RequestDispatcher<'_> { Some(it) => it, None => return self, }; - let _guard = tracing::span!(tracing::Level::INFO, "request", method = ?req.method, "request_id" = ?req.id).entered(); + let _guard = + tracing::info_span!("request", method = ?req.method, "request_id" = ?req.id).entered(); tracing::debug!(?params); let world = self.global_state.snapshot(); @@ -297,8 +300,7 @@ impl NotificationDispatcher<'_> { None => return Ok(self), }; - let _guard = - tracing::span!(tracing::Level::INFO, "notification", method = ?not.method).entered(); + let _guard = tracing::info_span!("notification", method = ?not.method).entered(); let params = match not.extract::(N::METHOD) { Ok(it) => it, diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs index 9d30063ccc8a1..2d5fc9bfacc90 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/notification.rs @@ -54,7 +54,7 @@ pub(crate) fn handle_did_open_text_document( state: &mut GlobalState, params: DidOpenTextDocumentParams, ) -> anyhow::Result<()> { - let _p = tracing::span!(tracing::Level::INFO, "handle_did_open_text_document").entered(); + let _p = tracing::info_span!("handle_did_open_text_document").entered(); if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) { let already_exists = state @@ -87,7 +87,7 @@ pub(crate) fn handle_did_change_text_document( state: &mut GlobalState, params: DidChangeTextDocumentParams, ) -> anyhow::Result<()> { - let _p = tracing::span!(tracing::Level::INFO, "handle_did_change_text_document").entered(); + let _p = tracing::info_span!("handle_did_change_text_document").entered(); if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) { let Some(DocumentData { version, data }) = state.mem_docs.get_mut(&path) else { @@ -116,7 +116,7 @@ pub(crate) fn handle_did_close_text_document( state: &mut GlobalState, params: DidCloseTextDocumentParams, ) -> anyhow::Result<()> { - let _p = tracing::span!(tracing::Level::INFO, "handle_did_close_text_document").entered(); + let _p = tracing::info_span!("handle_did_close_text_document").entered(); if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) { if state.mem_docs.remove(&path).is_err() { @@ -254,7 +254,7 @@ pub(crate) fn handle_did_change_watched_files( } fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool { - let _p = tracing::span!(tracing::Level::INFO, "run_flycheck").entered(); + let _p = tracing::info_span!("run_flycheck").entered(); let file_id = state.vfs.read().0.file_id(&vfs_path); if let Some(file_id) = file_id { @@ -349,13 +349,13 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool { } pub(crate) fn handle_cancel_flycheck(state: &mut GlobalState, _: ()) -> anyhow::Result<()> { - let _p = tracing::span!(tracing::Level::INFO, "handle_cancel_flycheck").entered(); + let _p = tracing::info_span!("handle_cancel_flycheck").entered(); state.flycheck.iter().for_each(|flycheck| flycheck.cancel()); Ok(()) } pub(crate) fn handle_clear_flycheck(state: &mut GlobalState, _: ()) -> anyhow::Result<()> { - let _p = tracing::span!(tracing::Level::INFO, "handle_clear_flycheck").entered(); + let _p = tracing::info_span!("handle_clear_flycheck").entered(); state.diagnostics.clear_check_all(); Ok(()) } @@ -364,7 +364,7 @@ pub(crate) fn handle_run_flycheck( state: &mut GlobalState, params: RunFlycheckParams, ) -> anyhow::Result<()> { - let _p = tracing::span!(tracing::Level::INFO, "handle_run_flycheck").entered(); + let _p = tracing::info_span!("handle_run_flycheck").entered(); if let Some(text_document) = params.text_document { if let Ok(vfs_path) = from_proto::vfs_path(&text_document.uri) { if run_flycheck(state, vfs_path) { diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs index 1e24bf3aae3b0..50d405c9521ce 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs @@ -72,7 +72,7 @@ pub(crate) fn handle_analyzer_status( snap: GlobalStateSnapshot, params: lsp_ext::AnalyzerStatusParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_analyzer_status").entered(); + let _p = tracing::info_span!("handle_analyzer_status").entered(); let mut buf = String::new(); @@ -113,7 +113,7 @@ pub(crate) fn handle_analyzer_status( } pub(crate) fn handle_memory_usage(state: &mut GlobalState, _: ()) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_memory_usage").entered(); + let _p = tracing::info_span!("handle_memory_usage").entered(); let mem = state.analysis_host.per_query_memory_usage(); let mut out = String::new(); @@ -134,7 +134,7 @@ pub(crate) fn handle_syntax_tree( snap: GlobalStateSnapshot, params: lsp_ext::SyntaxTreeParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_syntax_tree").entered(); + let _p = tracing::info_span!("handle_syntax_tree").entered(); let id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let line_index = snap.file_line_index(id)?; let text_range = params.range.and_then(|r| from_proto::text_range(&line_index, r).ok()); @@ -146,7 +146,7 @@ pub(crate) fn handle_view_hir( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_view_hir").entered(); + let _p = tracing::info_span!("handle_view_hir").entered(); let position = from_proto::file_position(&snap, params)?; let res = snap.analysis.view_hir(position)?; Ok(res) @@ -156,7 +156,7 @@ pub(crate) fn handle_view_mir( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_view_mir").entered(); + let _p = tracing::info_span!("handle_view_mir").entered(); let position = from_proto::file_position(&snap, params)?; let res = snap.analysis.view_mir(position)?; Ok(res) @@ -166,7 +166,7 @@ pub(crate) fn handle_interpret_function( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_interpret_function").entered(); + let _p = tracing::info_span!("handle_interpret_function").entered(); let position = from_proto::file_position(&snap, params)?; let res = snap.analysis.interpret_function(position)?; Ok(res) @@ -184,7 +184,7 @@ pub(crate) fn handle_view_item_tree( snap: GlobalStateSnapshot, params: lsp_ext::ViewItemTreeParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_view_item_tree").entered(); + let _p = tracing::info_span!("handle_view_item_tree").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let res = snap.analysis.view_item_tree(file_id)?; Ok(res) @@ -245,7 +245,7 @@ pub(crate) fn handle_discover_test( snap: GlobalStateSnapshot, params: lsp_ext::DiscoverTestParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_discover_test").entered(); + let _p = tracing::info_span!("handle_discover_test").entered(); let (tests, scope) = match params.test_id { Some(id) => { let crate_id = id.split_once("::").map(|it| it.0).unwrap_or(&id); @@ -276,7 +276,7 @@ pub(crate) fn handle_view_crate_graph( snap: GlobalStateSnapshot, params: ViewCrateGraphParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_view_crate_graph").entered(); + let _p = tracing::info_span!("handle_view_crate_graph").entered(); let dot = snap.analysis.view_crate_graph(params.full)?.map_err(anyhow::Error::msg)?; Ok(dot) } @@ -285,7 +285,7 @@ pub(crate) fn handle_expand_macro( snap: GlobalStateSnapshot, params: lsp_ext::ExpandMacroParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_expand_macro").entered(); + let _p = tracing::info_span!("handle_expand_macro").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let line_index = snap.file_line_index(file_id)?; let offset = from_proto::offset(&line_index, params.position)?; @@ -298,7 +298,7 @@ pub(crate) fn handle_selection_range( snap: GlobalStateSnapshot, params: lsp_types::SelectionRangeParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_selection_range").entered(); + let _p = tracing::info_span!("handle_selection_range").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let line_index = snap.file_line_index(file_id)?; let res: anyhow::Result> = params @@ -341,7 +341,7 @@ pub(crate) fn handle_matching_brace( snap: GlobalStateSnapshot, params: lsp_ext::MatchingBraceParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_matching_brace").entered(); + let _p = tracing::info_span!("handle_matching_brace").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let line_index = snap.file_line_index(file_id)?; params @@ -364,7 +364,7 @@ pub(crate) fn handle_join_lines( snap: GlobalStateSnapshot, params: lsp_ext::JoinLinesParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_join_lines").entered(); + let _p = tracing::info_span!("handle_join_lines").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let source_root = snap.analysis.source_root(file_id)?; @@ -390,7 +390,7 @@ pub(crate) fn handle_on_enter( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_on_enter").entered(); + let _p = tracing::info_span!("handle_on_enter").entered(); let position = from_proto::file_position(&snap, params)?; let edit = match snap.analysis.on_enter(position)? { None => return Ok(None), @@ -405,7 +405,7 @@ pub(crate) fn handle_on_type_formatting( snap: GlobalStateSnapshot, params: lsp_types::DocumentOnTypeFormattingParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_on_type_formatting").entered(); + let _p = tracing::info_span!("handle_on_type_formatting").entered(); let mut position = from_proto::file_position(&snap, params.text_document_position)?; let line_index = snap.file_line_index(position.file_id)?; @@ -446,7 +446,7 @@ pub(crate) fn handle_document_symbol( snap: GlobalStateSnapshot, params: lsp_types::DocumentSymbolParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_document_symbol").entered(); + let _p = tracing::info_span!("handle_document_symbol").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let line_index = snap.file_line_index(file_id)?; @@ -535,7 +535,7 @@ pub(crate) fn handle_workspace_symbol( snap: GlobalStateSnapshot, params: WorkspaceSymbolParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_workspace_symbol").entered(); + let _p = tracing::info_span!("handle_workspace_symbol").entered(); let config = snap.config.workspace_symbol(); let (all_symbols, libs) = decide_search_scope_and_kind(¶ms, &config); @@ -627,7 +627,7 @@ pub(crate) fn handle_will_rename_files( snap: GlobalStateSnapshot, params: lsp_types::RenameFilesParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_will_rename_files").entered(); + let _p = tracing::info_span!("handle_will_rename_files").entered(); let source_changes: Vec = params .files @@ -689,7 +689,7 @@ pub(crate) fn handle_goto_definition( snap: GlobalStateSnapshot, params: lsp_types::GotoDefinitionParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_goto_definition").entered(); + let _p = tracing::info_span!("handle_goto_definition").entered(); let position = from_proto::file_position(&snap, params.text_document_position_params)?; let nav_info = match snap.analysis.goto_definition(position)? { None => return Ok(None), @@ -704,7 +704,7 @@ pub(crate) fn handle_goto_declaration( snap: GlobalStateSnapshot, params: lsp_types::request::GotoDeclarationParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_goto_declaration").entered(); + let _p = tracing::info_span!("handle_goto_declaration").entered(); let position = from_proto::file_position(&snap, params.text_document_position_params.clone())?; let nav_info = match snap.analysis.goto_declaration(position)? { None => return handle_goto_definition(snap, params), @@ -719,7 +719,7 @@ pub(crate) fn handle_goto_implementation( snap: GlobalStateSnapshot, params: lsp_types::request::GotoImplementationParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_goto_implementation").entered(); + let _p = tracing::info_span!("handle_goto_implementation").entered(); let position = from_proto::file_position(&snap, params.text_document_position_params)?; let nav_info = match snap.analysis.goto_implementation(position)? { None => return Ok(None), @@ -734,7 +734,7 @@ pub(crate) fn handle_goto_type_definition( snap: GlobalStateSnapshot, params: lsp_types::request::GotoTypeDefinitionParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_goto_type_definition").entered(); + let _p = tracing::info_span!("handle_goto_type_definition").entered(); let position = from_proto::file_position(&snap, params.text_document_position_params)?; let nav_info = match snap.analysis.goto_type_definition(position)? { None => return Ok(None), @@ -749,7 +749,7 @@ pub(crate) fn handle_parent_module( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_parent_module").entered(); + let _p = tracing::info_span!("handle_parent_module").entered(); if let Ok(file_path) = ¶ms.text_document.uri.to_file_path() { if file_path.file_name().unwrap_or_default() == "Cargo.toml" { // search workspaces for parent packages or fallback to workspace root @@ -819,7 +819,7 @@ pub(crate) fn handle_runnables( snap: GlobalStateSnapshot, params: lsp_ext::RunnablesParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_runnables").entered(); + let _p = tracing::info_span!("handle_runnables").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let line_index = snap.file_line_index(file_id)?; let offset = params.position.and_then(|it| from_proto::offset(&line_index, it).ok()); @@ -925,7 +925,7 @@ pub(crate) fn handle_related_tests( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_related_tests").entered(); + let _p = tracing::info_span!("handle_related_tests").entered(); let position = from_proto::file_position(&snap, params)?; let tests = snap.analysis.related_tests(position, None)?; @@ -943,7 +943,7 @@ pub(crate) fn handle_completion( snap: GlobalStateSnapshot, lsp_types::CompletionParams { text_document_position, context,.. }: lsp_types::CompletionParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_completion").entered(); + let _p = tracing::info_span!("handle_completion").entered(); let mut position = from_proto::file_position(&snap, text_document_position.clone())?; let line_index = snap.file_line_index(position.file_id)?; let completion_trigger_character = @@ -978,7 +978,7 @@ pub(crate) fn handle_completion_resolve( snap: GlobalStateSnapshot, mut original_completion: CompletionItem, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_completion_resolve").entered(); + let _p = tracing::info_span!("handle_completion_resolve").entered(); if !all_edits_are_disjoint(&original_completion, &[]) { return Err(invalid_params_error( @@ -1035,7 +1035,7 @@ pub(crate) fn handle_folding_range( snap: GlobalStateSnapshot, params: FoldingRangeParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_folding_range").entered(); + let _p = tracing::info_span!("handle_folding_range").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let folds = snap.analysis.folding_ranges(file_id)?; let text = snap.analysis.file_text(file_id)?; @@ -1052,7 +1052,7 @@ pub(crate) fn handle_signature_help( snap: GlobalStateSnapshot, params: lsp_types::SignatureHelpParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_signature_help").entered(); + let _p = tracing::info_span!("handle_signature_help").entered(); let position = from_proto::file_position(&snap, params.text_document_position_params)?; let help = match snap.analysis.signature_help(position)? { Some(it) => it, @@ -1067,7 +1067,7 @@ pub(crate) fn handle_hover( snap: GlobalStateSnapshot, params: lsp_ext::HoverParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_hover").entered(); + let _p = tracing::info_span!("handle_hover").entered(); let range = match params.position { PositionOrRange::Position(position) => Range::new(position, position), PositionOrRange::Range(range) => range, @@ -1105,7 +1105,7 @@ pub(crate) fn handle_prepare_rename( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_prepare_rename").entered(); + let _p = tracing::info_span!("handle_prepare_rename").entered(); let position = from_proto::file_position(&snap, params)?; let change = snap.analysis.prepare_rename(position)?.map_err(to_proto::rename_error)?; @@ -1119,7 +1119,7 @@ pub(crate) fn handle_rename( snap: GlobalStateSnapshot, params: RenameParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_rename").entered(); + let _p = tracing::info_span!("handle_rename").entered(); let position = from_proto::file_position(&snap, params.text_document_position)?; let mut change = @@ -1154,7 +1154,7 @@ pub(crate) fn handle_references( snap: GlobalStateSnapshot, params: lsp_types::ReferenceParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_references").entered(); + let _p = tracing::info_span!("handle_references").entered(); let position = from_proto::file_position(&snap, params.text_document_position)?; let exclude_imports = snap.config.find_all_refs_exclude_imports(); @@ -1199,7 +1199,7 @@ pub(crate) fn handle_formatting( snap: GlobalStateSnapshot, params: lsp_types::DocumentFormattingParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_formatting").entered(); + let _p = tracing::info_span!("handle_formatting").entered(); run_rustfmt(&snap, params.text_document, None) } @@ -1208,7 +1208,7 @@ pub(crate) fn handle_range_formatting( snap: GlobalStateSnapshot, params: lsp_types::DocumentRangeFormattingParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_range_formatting").entered(); + let _p = tracing::info_span!("handle_range_formatting").entered(); run_rustfmt(&snap, params.text_document, Some(params.range)) } @@ -1217,7 +1217,7 @@ pub(crate) fn handle_code_action( snap: GlobalStateSnapshot, params: lsp_types::CodeActionParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_code_action").entered(); + let _p = tracing::info_span!("handle_code_action").entered(); if !snap.config.code_action_literals() { // We intentionally don't support command-based actions, as those either @@ -1295,7 +1295,7 @@ pub(crate) fn handle_code_action_resolve( snap: GlobalStateSnapshot, mut code_action: lsp_ext::CodeAction, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_code_action_resolve").entered(); + let _p = tracing::info_span!("handle_code_action_resolve").entered(); let Some(params) = code_action.data.take() else { return Err(invalid_params_error("code action without data".to_owned()).into()); }; @@ -1388,7 +1388,7 @@ pub(crate) fn handle_code_lens( snap: GlobalStateSnapshot, params: lsp_types::CodeLensParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_code_lens").entered(); + let _p = tracing::info_span!("handle_code_lens").entered(); let lens_config = snap.config.lens(); if lens_config.none() { @@ -1457,7 +1457,7 @@ pub(crate) fn handle_document_highlight( snap: GlobalStateSnapshot, params: lsp_types::DocumentHighlightParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_document_highlight").entered(); + let _p = tracing::info_span!("handle_document_highlight").entered(); let position = from_proto::file_position(&snap, params.text_document_position_params)?; let line_index = snap.file_line_index(position.file_id)?; let source_root = snap.analysis.source_root(position.file_id)?; @@ -1483,7 +1483,7 @@ pub(crate) fn handle_ssr( snap: GlobalStateSnapshot, params: lsp_ext::SsrParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_ssr").entered(); + let _p = tracing::info_span!("handle_ssr").entered(); let selections = params .selections .iter() @@ -1503,7 +1503,7 @@ pub(crate) fn handle_inlay_hints( snap: GlobalStateSnapshot, params: InlayHintParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_inlay_hints").entered(); + let _p = tracing::info_span!("handle_inlay_hints").entered(); let document_uri = ¶ms.text_document.uri; let FileRange { file_id, range } = from_proto::file_range( &snap, @@ -1539,7 +1539,7 @@ pub(crate) fn handle_inlay_hints_resolve( snap: GlobalStateSnapshot, mut original_hint: InlayHint, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_inlay_hints_resolve").entered(); + let _p = tracing::info_span!("handle_inlay_hints_resolve").entered(); let Some(data) = original_hint.data.take() else { return Ok(original_hint) }; let resolve_data: lsp_ext::InlayHintResolveData = serde_json::from_value(data)?; @@ -1590,7 +1590,7 @@ pub(crate) fn handle_call_hierarchy_prepare( snap: GlobalStateSnapshot, params: CallHierarchyPrepareParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_call_hierarchy_prepare").entered(); + let _p = tracing::info_span!("handle_call_hierarchy_prepare").entered(); let position = from_proto::file_position(&snap, params.text_document_position_params)?; let nav_info = match snap.analysis.call_hierarchy(position)? { @@ -1612,7 +1612,7 @@ pub(crate) fn handle_call_hierarchy_incoming( snap: GlobalStateSnapshot, params: CallHierarchyIncomingCallsParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_call_hierarchy_incoming").entered(); + let _p = tracing::info_span!("handle_call_hierarchy_incoming").entered(); let item = params.item; let doc = TextDocumentIdentifier::new(item.uri); @@ -1647,7 +1647,7 @@ pub(crate) fn handle_call_hierarchy_outgoing( snap: GlobalStateSnapshot, params: CallHierarchyOutgoingCallsParams, ) -> anyhow::Result>> { - let _p = tracing::span!(tracing::Level::INFO, "handle_call_hierarchy_outgoing").entered(); + let _p = tracing::info_span!("handle_call_hierarchy_outgoing").entered(); let item = params.item; let doc = TextDocumentIdentifier::new(item.uri); @@ -1682,7 +1682,7 @@ pub(crate) fn handle_semantic_tokens_full( snap: GlobalStateSnapshot, params: SemanticTokensParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_semantic_tokens_full").entered(); + let _p = tracing::info_span!("handle_semantic_tokens_full").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let text = snap.analysis.file_text(file_id)?; @@ -1713,7 +1713,7 @@ pub(crate) fn handle_semantic_tokens_full_delta( snap: GlobalStateSnapshot, params: SemanticTokensDeltaParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_semantic_tokens_full_delta").entered(); + let _p = tracing::info_span!("handle_semantic_tokens_full_delta").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let text = snap.analysis.file_text(file_id)?; @@ -1757,7 +1757,7 @@ pub(crate) fn handle_semantic_tokens_range( snap: GlobalStateSnapshot, params: SemanticTokensRangeParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_semantic_tokens_range").entered(); + let _p = tracing::info_span!("handle_semantic_tokens_range").entered(); let frange = from_proto::file_range(&snap, ¶ms.text_document, params.range)?; let text = snap.analysis.file_text(frange.file_id)?; @@ -1784,7 +1784,7 @@ pub(crate) fn handle_open_docs( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result { - let _p = tracing::span!(tracing::Level::INFO, "handle_open_docs").entered(); + let _p = tracing::info_span!("handle_open_docs").entered(); let position = from_proto::file_position(&snap, params)?; let ws_and_sysroot = snap.workspaces.iter().find_map(|ws| match &ws.kind { @@ -1826,7 +1826,7 @@ pub(crate) fn handle_open_cargo_toml( snap: GlobalStateSnapshot, params: lsp_ext::OpenCargoTomlParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_open_cargo_toml").entered(); + let _p = tracing::info_span!("handle_open_cargo_toml").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let cargo_spec = match CargoTargetSpec::for_file(&snap, file_id)? { @@ -1844,7 +1844,7 @@ pub(crate) fn handle_move_item( snap: GlobalStateSnapshot, params: lsp_ext::MoveItemParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_move_item").entered(); + let _p = tracing::info_span!("handle_move_item").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let range = from_proto::file_range(&snap, ¶ms.text_document, params.range)?; @@ -1866,7 +1866,7 @@ pub(crate) fn handle_view_recursive_memory_layout( snap: GlobalStateSnapshot, params: lsp_types::TextDocumentPositionParams, ) -> anyhow::Result> { - let _p = tracing::span!(tracing::Level::INFO, "handle_view_recursive_memory_layout").entered(); + let _p = tracing::info_span!("handle_view_recursive_memory_layout").entered(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; let line_index = snap.file_line_index(file_id)?; let offset = from_proto::offset(&line_index, params.position)?; diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/integrated_benchmarks.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/integrated_benchmarks.rs index 7a7661e431780..3b42e9ba36abc 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/integrated_benchmarks.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/integrated_benchmarks.rs @@ -175,7 +175,7 @@ fn integrated_completion_benchmark() { }; { - let _p = tracing::span!(tracing::Level::INFO, "unqualified path completion").entered(); + let _p = tracing::info_span!("unqualified path completion").entered(); let _span = profile::cpu_span(); let analysis = host.analysis(); let config = CompletionConfig { @@ -218,7 +218,7 @@ fn integrated_completion_benchmark() { }; { - let _p = tracing::span!(tracing::Level::INFO, "dot completion").entered(); + let _p = tracing::info_span!("dot completion").entered(); let _span = profile::cpu_span(); let analysis = host.analysis(); let config = CompletionConfig { @@ -316,7 +316,7 @@ fn integrated_diagnostics_benchmark() { }; { - let _p = tracing::span!(tracing::Level::INFO, "diagnostics").entered(); + let _p = tracing::info_span!("diagnostics").entered(); let _span = profile::cpu_span(); host.analysis() .diagnostics(&diagnostics_config, ide::AssistResolveStrategy::None, file_id) diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs index 193b3fdd4a8ee..864dc9623fd5b 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs @@ -230,7 +230,7 @@ impl GlobalState { fn handle_event(&mut self, event: Event) -> anyhow::Result<()> { let loop_start = Instant::now(); // NOTE: don't count blocking select! call as a loop-turn time - let _p = tracing::span!(Level::INFO, "GlobalState::handle_event", event = %event).entered(); + let _p = tracing::info_span!("GlobalState::handle_event", event = %event).entered(); let event_dbg_msg = format!("{event:?}"); tracing::debug!(?loop_start, ?event, "handle_event"); @@ -249,9 +249,7 @@ impl GlobalState { lsp_server::Message::Response(resp) => self.complete_request(resp), }, Event::QueuedTask(task) => { - let _p = - tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/queued_task") - .entered(); + let _p = tracing::info_span!("GlobalState::handle_event/queued_task").entered(); self.handle_queued_task(task); // Coalesce multiple task events into one loop turn while let Ok(task) = self.deferred_task_queue.receiver.try_recv() { @@ -259,8 +257,7 @@ impl GlobalState { } } Event::Task(task) => { - let _p = tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/task") - .entered(); + let _p = tracing::info_span!("GlobalState::handle_event/task").entered(); let mut prime_caches_progress = Vec::new(); self.handle_task(&mut prime_caches_progress, task); @@ -314,8 +311,7 @@ impl GlobalState { } } Event::Vfs(message) => { - let _p = - tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/vfs").entered(); + let _p = tracing::info_span!("GlobalState::handle_event/vfs").entered(); self.handle_vfs_msg(message); // Coalesce many VFS event into a single loop turn while let Ok(message) = self.loader.receiver.try_recv() { @@ -323,8 +319,7 @@ impl GlobalState { } } Event::Flycheck(message) => { - let _p = tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/flycheck") - .entered(); + let _p = tracing::info_span!("GlobalState::handle_event/flycheck").entered(); self.handle_flycheck_msg(message); // Coalesce many flycheck updates into a single loop turn while let Ok(message) = self.flycheck_receiver.try_recv() { @@ -332,9 +327,7 @@ impl GlobalState { } } Event::TestResult(message) => { - let _p = - tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/test_result") - .entered(); + let _p = tracing::info_span!("GlobalState::handle_event/test_result").entered(); self.handle_cargo_test_msg(message); // Coalesce many test result event into a single loop turn while let Ok(message) = self.test_run_receiver.try_recv() { @@ -669,12 +662,11 @@ impl GlobalState { } fn handle_vfs_msg(&mut self, message: vfs::loader::Message) { - let _p = tracing::span!(Level::INFO, "GlobalState::handle_vfs_msg").entered(); + let _p = tracing::info_span!("GlobalState::handle_vfs_msg").entered(); let is_changed = matches!(message, vfs::loader::Message::Changed { .. }); match message { vfs::loader::Message::Changed { files } | vfs::loader::Message::Loaded { files } => { - let _p = tracing::span!(Level::INFO, "GlobalState::handle_vfs_msg{changed/load}") - .entered(); + let _p = tracing::info_span!("GlobalState::handle_vfs_msg{changed/load}").entered(); let vfs = &mut self.vfs.write().0; for (path, contents) in files { let path = VfsPath::from(path); @@ -688,8 +680,7 @@ impl GlobalState { } } vfs::loader::Message::Progress { n_total, n_done, dir, config_version } => { - let _p = - tracing::span!(Level::INFO, "GlobalState::handle_vfs_mgs/progress").entered(); + let _p = tracing::info_span!("GlobalState::handle_vfs_mgs/progress").entered(); always!(config_version <= self.vfs_config_version); let state = match n_done { @@ -731,8 +722,7 @@ impl GlobalState { let snap = self.snapshot(); self.task_pool.handle.spawn_with_sender(ThreadIntent::Worker, move |sender| { - let _p = tracing::span!(tracing::Level::INFO, "GlobalState::check_if_indexed") - .entered(); + let _p = tracing::info_span!("GlobalState::check_if_indexed").entered(); tracing::debug!(?uri, "handling uri"); let id = from_proto::file_id(&snap, &uri).expect("unable to get FileId"); if let Ok(crates) = &snap.analysis.crates_for(id) { diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs index 627be7e951adc..c07adb3c5adc0 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs @@ -70,8 +70,7 @@ impl GlobalState { } pub(crate) fn update_configuration(&mut self, config: Config) { - let _p = - tracing::span!(tracing::Level::INFO, "GlobalState::update_configuration").entered(); + let _p = tracing::info_span!("GlobalState::update_configuration").entered(); let old_config = mem::replace(&mut self.config, Arc::new(config)); if self.config.lru_parse_query_capacity() != old_config.lru_parse_query_capacity() { self.analysis_host.update_lru_capacity(self.config.lru_parse_query_capacity()); @@ -372,7 +371,7 @@ impl GlobalState { } pub(crate) fn switch_workspaces(&mut self, cause: Cause) { - let _p = tracing::span!(tracing::Level::INFO, "GlobalState::switch_workspaces").entered(); + let _p = tracing::info_span!("GlobalState::switch_workspaces").entered(); tracing::info!(%cause, "will switch workspaces"); let Some((workspaces, force_reload_crate_graph)) = @@ -660,7 +659,7 @@ impl GlobalState { } fn reload_flycheck(&mut self) { - let _p = tracing::span!(tracing::Level::INFO, "GlobalState::reload_flycheck").entered(); + let _p = tracing::info_span!("GlobalState::reload_flycheck").entered(); let config = self.config.flycheck(); let sender = self.flycheck_sender.clone(); let invocation_strategy = match config { diff --git a/src/tools/rust-analyzer/crates/salsa/salsa-macros/src/query_group.rs b/src/tools/rust-analyzer/crates/salsa/salsa-macros/src/query_group.rs index c04b30691671d..4e70741239734 100644 --- a/src/tools/rust-analyzer/crates/salsa/salsa-macros/src/query_group.rs +++ b/src/tools/rust-analyzer/crates/salsa/salsa-macros/src/query_group.rs @@ -238,7 +238,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream let tracing = if let QueryStorage::Memoized = query.storage { let s = format!("{trait_name}::{fn_name}"); Some(quote! { - let _p = tracing::span!(tracing::Level::DEBUG, #s, #(#key_names = tracing::field::debug(&#key_names)),*).entered(); + let _p = tracing::debug_span!(#s, #(#key_names = tracing::field::debug(&#key_names)),*).entered(); }) } else { None diff --git a/src/tools/rust-analyzer/crates/syntax/src/algo.rs b/src/tools/rust-analyzer/crates/syntax/src/algo.rs index 0e62de5febb92..9b43da83418f0 100644 --- a/src/tools/rust-analyzer/crates/syntax/src/algo.rs +++ b/src/tools/rust-analyzer/crates/syntax/src/algo.rs @@ -120,7 +120,7 @@ pub struct TreeDiff { impl TreeDiff { pub fn into_text_edit(&self, builder: &mut TextEditBuilder) { - let _p = tracing::span!(tracing::Level::INFO, "into_text_edit").entered(); + let _p = tracing::info_span!("into_text_edit").entered(); for (anchor, to) in &self.insertions { let offset = match anchor { @@ -149,7 +149,7 @@ impl TreeDiff { /// /// This function tries to find a fine-grained diff. pub fn diff(from: &SyntaxNode, to: &SyntaxNode) -> TreeDiff { - let _p = tracing::span!(tracing::Level::INFO, "diff").entered(); + let _p = tracing::info_span!("diff").entered(); let mut diff = TreeDiff { replacements: FxHashMap::default(), diff --git a/src/tools/rust-analyzer/crates/syntax/src/lib.rs b/src/tools/rust-analyzer/crates/syntax/src/lib.rs index 58f59c384bcff..cb23755861b5e 100644 --- a/src/tools/rust-analyzer/crates/syntax/src/lib.rs +++ b/src/tools/rust-analyzer/crates/syntax/src/lib.rs @@ -185,7 +185,7 @@ impl ast::Expr { /// ast::Expr::parse("let fail = true;", Edition::CURRENT).tree(); /// ``` pub fn parse(text: &str, edition: Edition) -> Parse { - let _p = tracing::span!(tracing::Level::INFO, "Expr::parse").entered(); + let _p = tracing::info_span!("Expr::parse").entered(); let (green, errors) = parsing::parse_text_at(text, parser::TopEntryPoint::Expr, edition); let root = SyntaxNode::new_root(green.clone()); @@ -203,7 +203,7 @@ pub use crate::ast::SourceFile; impl SourceFile { pub fn parse(text: &str, edition: Edition) -> Parse { - let _p = tracing::span!(tracing::Level::INFO, "SourceFile::parse").entered(); + let _p = tracing::info_span!("SourceFile::parse").entered(); let (green, errors) = parsing::parse_text(text, edition); let root = SyntaxNode::new_root(green.clone()); diff --git a/src/tools/rust-analyzer/crates/syntax/src/parsing.rs b/src/tools/rust-analyzer/crates/syntax/src/parsing.rs index a1ca3b327991d..4bf2a0327912d 100644 --- a/src/tools/rust-analyzer/crates/syntax/src/parsing.rs +++ b/src/tools/rust-analyzer/crates/syntax/src/parsing.rs @@ -10,7 +10,7 @@ use crate::{syntax_node::GreenNode, SyntaxError, SyntaxTreeBuilder}; pub(crate) use crate::parsing::reparsing::incremental_reparse; pub(crate) fn parse_text(text: &str, edition: parser::Edition) -> (GreenNode, Vec) { - let _p = tracing::span!(tracing::Level::INFO, "parse_text").entered(); + let _p = tracing::info_span!("parse_text").entered(); let lexed = parser::LexedStr::new(text); let parser_input = lexed.to_input(); let parser_output = parser::TopEntryPoint::SourceFile.parse(&parser_input, edition); @@ -23,7 +23,7 @@ pub(crate) fn parse_text_at( entry: parser::TopEntryPoint, edition: parser::Edition, ) -> (GreenNode, Vec) { - let _p = tracing::span!(tracing::Level::INFO, "parse_text_at").entered(); + let _p = tracing::info_span!("parse_text_at").entered(); let lexed = parser::LexedStr::new(text); let parser_input = lexed.to_input(); let parser_output = entry.parse(&parser_input, edition); @@ -35,7 +35,7 @@ pub(crate) fn build_tree( lexed: parser::LexedStr<'_>, parser_output: parser::Output, ) -> (GreenNode, Vec, bool) { - let _p = tracing::span!(tracing::Level::INFO, "build_tree").entered(); + let _p = tracing::info_span!("build_tree").entered(); let mut builder = SyntaxTreeBuilder::default(); let is_eof = lexed.intersperse_trivia(&parser_output, &mut |step| match step { diff --git a/src/tools/rust-analyzer/crates/syntax/src/validation.rs b/src/tools/rust-analyzer/crates/syntax/src/validation.rs index dbfab537fe58b..13d352d3c691b 100644 --- a/src/tools/rust-analyzer/crates/syntax/src/validation.rs +++ b/src/tools/rust-analyzer/crates/syntax/src/validation.rs @@ -16,7 +16,7 @@ use crate::{ }; pub(crate) fn validate(root: &SyntaxNode, errors: &mut Vec) { - let _p = tracing::span!(tracing::Level::INFO, "parser::validate").entered(); + let _p = tracing::info_span!("parser::validate").entered(); // FIXME: // * Add unescape validation of raw string literals and raw byte string literals // * Add validation of doc comments are being attached to nodes