Skip to content

Commit 46702ff

Browse files
committed
Auto merge of #17087 - davidbarsky:david/fix-some-tracing-spans, r=Veykril
chore: fix a few spans without `.entered()`
2 parents b256807 + 5ba37f3 commit 46702ff

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

crates/hir-ty/src/diagnostics/unsafe_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
};
1414

1515
pub fn missing_unsafe(db: &dyn HirDatabase, def: DefWithBodyId) -> Vec<ExprId> {
16-
let _p = tracing::span!(tracing::Level::INFO, "missing_unsafe",);
16+
let _p = tracing::span!(tracing::Level::INFO, "missing_unsafe").entered();
1717

1818
let mut res = Vec::new();
1919
let is_unsafe = match def {

crates/hir-ty/src/inhabitedness.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::{
1515
// FIXME: Turn this into a query, it can be quite slow
1616
/// Checks whether a type is visibly uninhabited from a particular module.
1717
pub(crate) fn is_ty_uninhabited_from(db: &dyn HirDatabase, ty: &Ty, target_mod: ModuleId) -> bool {
18-
let _p = tracing::span!(tracing::Level::INFO, "is_ty_uninhabited_from", ?ty);
18+
let _p = tracing::span!(tracing::Level::INFO, "is_ty_uninhabited_from", ?ty).entered();
1919
let mut uninhabited_from =
2020
UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() };
2121
let inhabitedness = ty.visit_with(&mut uninhabited_from, DebruijnIndex::INNERMOST);
@@ -30,7 +30,7 @@ pub(crate) fn is_enum_variant_uninhabited_from(
3030
subst: &Substitution,
3131
target_mod: ModuleId,
3232
) -> bool {
33-
let _p = tracing::span!(tracing::Level::INFO, "is_enum_variant_uninhabited_from",);
33+
let _p = tracing::span!(tracing::Level::INFO, "is_enum_variant_uninhabited_from").entered();
3434

3535
let mut uninhabited_from =
3636
UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() };

crates/hir/src/lib.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl Crate {
239239
db: &dyn DefDatabase,
240240
query: import_map::Query,
241241
) -> impl Iterator<Item = Either<ModuleDef, Macro>> {
242-
let _p = tracing::span!(tracing::Level::INFO, "query_external_importables");
242+
let _p = tracing::span!(tracing::Level::INFO, "query_external_importables").entered();
243243
import_map::search_dependencies(db, self.into(), &query).into_iter().map(|item| {
244244
match ItemInNs::from(item) {
245245
ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id),
@@ -548,7 +548,8 @@ impl Module {
548548
acc: &mut Vec<AnyDiagnostic>,
549549
style_lints: bool,
550550
) {
551-
let _p = tracing::span!(tracing::Level::INFO, "Module::diagnostics", name = ?self.name(db));
551+
let _p = tracing::span!(tracing::Level::INFO, "Module::diagnostics", name = ?self.name(db))
552+
.entered();
552553
let def_map = self.id.def_map(db.upcast());
553554
for diag in def_map.diagnostics() {
554555
if diag.in_module != self.id.local_id {
@@ -4494,7 +4495,7 @@ impl Type {
44944495
name: Option<&Name>,
44954496
mut callback: impl FnMut(Function) -> Option<T>,
44964497
) -> Option<T> {
4497-
let _p = tracing::span!(tracing::Level::INFO, "iterate_method_candidates");
4498+
let _p = tracing::span!(tracing::Level::INFO, "iterate_method_candidates").entered();
44984499
let mut slot = None;
44994500

45004501
self.iterate_method_candidates_dyn(
@@ -4582,7 +4583,7 @@ impl Type {
45824583
name: Option<&Name>,
45834584
mut callback: impl FnMut(AssocItem) -> Option<T>,
45844585
) -> Option<T> {
4585-
let _p = tracing::span!(tracing::Level::INFO, "iterate_path_candidates");
4586+
let _p = tracing::span!(tracing::Level::INFO, "iterate_path_candidates").entered();
45864587
let mut slot = None;
45874588
self.iterate_path_candidates_dyn(
45884589
db,
@@ -4649,15 +4650,15 @@ impl Type {
46494650
&'a self,
46504651
db: &'a dyn HirDatabase,
46514652
) -> impl Iterator<Item = Trait> + 'a {
4652-
let _p = tracing::span!(tracing::Level::INFO, "applicable_inherent_traits");
4653+
let _p = tracing::span!(tracing::Level::INFO, "applicable_inherent_traits").entered();
46534654
self.autoderef_(db)
46544655
.filter_map(|ty| ty.dyn_trait())
46554656
.flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id))
46564657
.map(Trait::from)
46574658
}
46584659

46594660
pub fn env_traits<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Trait> + 'a {
4660-
let _p = tracing::span!(tracing::Level::INFO, "env_traits");
4661+
let _p = tracing::span!(tracing::Level::INFO, "env_traits").entered();
46614662
self.autoderef_(db)
46624663
.filter(|ty| matches!(ty.kind(Interner), TyKind::Placeholder(_)))
46634664
.flat_map(|ty| {

crates/hir/src/semantics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ impl<'db> SemanticsImpl<'db> {
722722
mut token: SyntaxToken,
723723
f: &mut dyn FnMut(InFile<SyntaxToken>) -> ControlFlow<()>,
724724
) {
725-
let _p = tracing::span!(tracing::Level::INFO, "descend_into_macros");
725+
let _p = tracing::span!(tracing::Level::INFO, "descend_into_macros").entered();
726726
let (sa, span, file_id) =
727727
match token.parent().and_then(|parent| self.analyze_no_infer(&parent)) {
728728
Some(sa) => match sa.file_id.file_id() {
@@ -1359,7 +1359,7 @@ impl<'db> SemanticsImpl<'db> {
13591359
offset: Option<TextSize>,
13601360
infer_body: bool,
13611361
) -> Option<SourceAnalyzer> {
1362-
let _p = tracing::span!(tracing::Level::INFO, "Semantics::analyze_impl");
1362+
let _p = tracing::span!(tracing::Level::INFO, "Semantics::analyze_impl").entered();
13631363
let node = self.find_file(node);
13641364

13651365
let container = self.with_ctx(|ctx| ctx.find_container(node))?;

crates/hir/src/semantics/source_to_def.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub(super) struct SourceToDefCtx<'a, 'b> {
118118

119119
impl SourceToDefCtx<'_, '_> {
120120
pub(super) fn file_to_def(&self, file: FileId) -> SmallVec<[ModuleId; 1]> {
121-
let _p = tracing::span!(tracing::Level::INFO, "SourceBinder::file_to_module_def");
121+
let _p = tracing::span!(tracing::Level::INFO, "SourceBinder::file_to_module_def").entered();
122122
let mut mods = SmallVec::new();
123123
for &crate_id in self.db.relevant_crates(file).iter() {
124124
// FIXME: inner items
@@ -133,7 +133,7 @@ impl SourceToDefCtx<'_, '_> {
133133
}
134134

135135
pub(super) fn module_to_def(&mut self, src: InFile<ast::Module>) -> Option<ModuleId> {
136-
let _p = tracing::span!(tracing::Level::INFO, "module_to_def");
136+
let _p = tracing::span!(tracing::Level::INFO, "module_to_def").entered();
137137
let parent_declaration = src
138138
.syntax()
139139
.ancestors_with_macros_skip_attr_item(self.db.upcast())
@@ -158,7 +158,7 @@ impl SourceToDefCtx<'_, '_> {
158158
}
159159

160160
pub(super) fn source_file_to_def(&self, src: InFile<ast::SourceFile>) -> Option<ModuleId> {
161-
let _p = tracing::span!(tracing::Level::INFO, "source_file_to_def");
161+
let _p = tracing::span!(tracing::Level::INFO, "source_file_to_def").entered();
162162
let file_id = src.file_id.original_file(self.db.upcast());
163163
self.file_to_def(file_id).first().copied()
164164
}

crates/ide-assists/src/handlers/add_missing_impl_members.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn add_missing_impl_members_inner(
105105
assist_id: &'static str,
106106
label: &'static str,
107107
) -> Option<()> {
108-
let _p = tracing::span!(tracing::Level::INFO, "add_missing_impl_members_inner");
108+
let _p = tracing::span!(tracing::Level::INFO, "add_missing_impl_members_inner").entered();
109109
let impl_def = ctx.find_node_at_offset::<ast::Impl>()?;
110110
let impl_ = ctx.sema.to_def(&impl_def)?;
111111

0 commit comments

Comments
 (0)