Skip to content

Commit 1ce4adb

Browse files
committed
docs(log): brief description for each log message field
1 parent a70ec7f commit 1ce4adb

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/cargo/util/log_message.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,61 +18,97 @@ use crate::core::compiler::fingerprint::DirtyReason;
1818
pub enum LogMessage {
1919
/// Emitted when a build starts.
2020
BuildStarted {
21+
/// Current working directory.
2122
cwd: PathBuf,
23+
/// Host triple.
2224
host: String,
25+
/// Number of parallel jobs.
2326
jobs: u32,
27+
/// Build profile name (e.g., "dev", "release").
2428
profile: String,
29+
/// The rustc version (`1.23.4-beta.2`).
2530
rustc_version: String,
31+
/// The rustc verbose version information (the output of `rustc -vV`).
2632
rustc_version_verbose: String,
33+
/// Target directory for build artifacts.
2734
target_dir: PathBuf,
35+
/// Workspace root directory.
2836
workspace_root: PathBuf,
2937
},
3038
/// Emitted when a compilation unit starts.
3139
UnitStarted {
40+
/// Package ID specification.
3241
package_id: PackageIdSpec,
42+
/// Cargo target (lib, bin, example, etc.).
3343
target: Target,
44+
/// The compilation action this unit is for (check, build, test, etc.).
3445
mode: CompileMode,
46+
/// Unit index for compact reference in subsequent events.
3547
index: u64,
48+
/// Seconds elapsed from build start.
3649
elapsed: f64,
3750
},
3851
/// Emitted when a section (e.g., rmeta, link) of the compilation unit finishes.
3952
UnitRmetaFinished {
53+
/// Unit index from the associated unit-started event.
4054
index: u64,
55+
/// Seconds elapsed from build start.
4156
elapsed: f64,
57+
/// Unit indices that were unblocked by this rmeta completion.
4258
#[serde(skip_serializing_if = "Vec::is_empty")]
4359
unblocked: Vec<u64>,
4460
},
4561
/// Emitted when a section (e.g., rmeta, link) of the compilation unit starts.
62+
///
63+
/// Requires `-Zsection-timings` to be enabled.
4664
UnitSectionStarted {
65+
/// Unit index from the associated unit-started event.
4766
index: u64,
67+
/// Seconds elapsed from build start.
4868
elapsed: f64,
69+
/// Section name from rustc's `-Zjson=timings` (e.g., "codegen", "link").
4970
section: String,
5071
},
5172
/// Emitted when a section (e.g., rmeta, link) of the compilation unit finishes.
73+
///
74+
/// Requires `-Zsection-timings` to be enabled.
5275
UnitSectionFinished {
76+
/// Unit index from the associated unit-started event.
5377
index: u64,
78+
/// Seconds elapsed from build start.
5479
elapsed: f64,
80+
/// Section name from rustc's `-Zjson=timings` (e.g., "codegen", "link").
5581
section: String,
5682
},
5783
/// Emitted when a compilation unit finishes.
5884
UnitFinished {
85+
/// Unit index from the associated unit-started event.
5986
index: u64,
87+
/// Seconds elapsed from build start.
6088
elapsed: f64,
89+
/// Unit indices that were unblocked by this completion.
6190
#[serde(skip_serializing_if = "Vec::is_empty")]
6291
unblocked: Vec<u64>,
6392
},
6493
/// Emitted when a unit needs to be rebuilt.
6594
Rebuild {
95+
/// Package ID specification.
6696
package_id: PackageIdSpec,
97+
/// Cargo target (lib, bin, example, etc.).
6798
target: Target,
99+
/// The compilation action this unit is for (check, build, test, etc.).
68100
mode: CompileMode,
101+
/// Reason why the unit is dirty and needs rebuilding.
69102
cause: DirtyReason,
70103
},
71104
}
72105

106+
/// Cargo target information.
73107
#[derive(Serialize)]
74108
pub struct Target {
109+
/// Target name.
75110
name: String,
111+
/// Target kind (lib, bin, test, bench, example, build-script).
76112
kind: &'static str,
77113
}
78114

0 commit comments

Comments
 (0)