Skip to content

Commit e0b9fae

Browse files
committed
Auto merge of #13830 - epage:trace, r=weihanglo
fix(toml): Improve granularity of traces ### What does this PR try to resolve? Once we move resolving out of `to_targets`, we won't have tracing visibility. As we don't have a top-level function for resolving, I put it on each. I mirrored this for "to_" for consistency and it seems useful when looking at the output. ### How should we test and review this PR? ### Additional information
2 parents ba6fb40 + a226ce1 commit e0b9fae

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cargo/util/toml/targets.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ pub(super) fn to_targets(
125125
Ok(targets)
126126
}
127127

128+
#[tracing::instrument(skip_all)]
128129
pub fn resolve_lib(
129130
original_lib: Option<&TomlLibTarget>,
130131
package_root: &Path,
@@ -174,6 +175,7 @@ pub fn resolve_lib(
174175
Ok(Some(lib))
175176
}
176177

178+
#[tracing::instrument(skip_all)]
177179
fn to_lib_target(
178180
original_lib: Option<&TomlLibTarget>,
179181
resolved_lib: Option<&TomlLibTarget>,
@@ -250,6 +252,7 @@ fn to_lib_target(
250252
Ok(Some(target))
251253
}
252254

255+
#[tracing::instrument(skip_all)]
253256
pub fn resolve_bins(
254257
toml_bins: Option<&Vec<TomlBinTarget>>,
255258
package_root: &Path,
@@ -299,6 +302,7 @@ pub fn resolve_bins(
299302
Ok(bins)
300303
}
301304

305+
#[tracing::instrument(skip_all)]
302306
fn to_bin_targets(
303307
features: &Features,
304308
bins: &[TomlBinTarget],
@@ -376,6 +380,7 @@ fn legacy_bin_path(package_root: &Path, name: &str, has_lib: bool) -> Option<Pat
376380
None
377381
}
378382

383+
#[tracing::instrument(skip_all)]
379384
pub fn resolve_examples(
380385
toml_examples: Option<&Vec<TomlExampleTarget>>,
381386
package_root: &Path,
@@ -402,6 +407,7 @@ pub fn resolve_examples(
402407
Ok(targets)
403408
}
404409

410+
#[tracing::instrument(skip_all)]
405411
fn to_example_targets(
406412
targets: &[TomlExampleTarget],
407413
package_root: &Path,
@@ -431,6 +437,7 @@ fn to_example_targets(
431437
Ok(result)
432438
}
433439

440+
#[tracing::instrument(skip_all)]
434441
pub fn resolve_tests(
435442
toml_tests: Option<&Vec<TomlTestTarget>>,
436443
package_root: &Path,
@@ -457,6 +464,7 @@ pub fn resolve_tests(
457464
Ok(targets)
458465
}
459466

467+
#[tracing::instrument(skip_all)]
460468
fn to_test_targets(
461469
targets: &[TomlTestTarget],
462470
package_root: &Path,
@@ -479,6 +487,7 @@ fn to_test_targets(
479487
Ok(result)
480488
}
481489

490+
#[tracing::instrument(skip_all)]
482491
pub fn resolve_benches(
483492
toml_benches: Option<&Vec<TomlBenchTarget>>,
484493
package_root: &Path,
@@ -522,6 +531,7 @@ pub fn resolve_benches(
522531
Ok(targets)
523532
}
524533

534+
#[tracing::instrument(skip_all)]
525535
fn to_bench_targets(
526536
targets: &[TomlBenchTarget],
527537
package_root: &Path,
@@ -1039,6 +1049,7 @@ Cargo doesn't know which to use because multiple target files found at `{}` and
10391049
}
10401050

10411051
/// Returns the path to the build script if one exists for this crate.
1052+
#[tracing::instrument(skip_all)]
10421053
pub fn resolve_build(build: Option<&StringOrBool>, package_root: &Path) -> Option<StringOrBool> {
10431054
const BUILD_RS: &str = "build.rs";
10441055
match build {

0 commit comments

Comments
 (0)