aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/rustdoc_test_gen.rs
diff options
context:
space:
mode:
authorTamir Duberstein <[email protected]>2025-05-29 13:14:59 +0000
committerMiguel Ojeda <[email protected]>2025-07-20 22:18:43 +0000
commit2254991d5b573662f841998c1d263118a15f067a (patch)
tree214221a980b2e24fc02011d68f292bbec452ce2b /scripts/rustdoc_test_gen.rs
parentscripts: rust: replace length checks with match (diff)
downloadkernel-2254991d5b573662f841998c1d263118a15f067a.tar.gz
kernel-2254991d5b573662f841998c1d263118a15f067a.zip
scripts: rust: emit path candidates in panic message
Include all information in the panic message rather than emit fragments to stderr to avoid possible interleaving with other output. Signed-off-by: Tamir Duberstein <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Kept newlines using `writeln!`. Used new message from Tamir. Reworded title. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'scripts/rustdoc_test_gen.rs')
-rw-r--r--scripts/rustdoc_test_gen.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
index d796481f4359..abb34ada2508 100644
--- a/scripts/rustdoc_test_gen.rs
+++ b/scripts/rustdoc_test_gen.rs
@@ -92,13 +92,15 @@ fn find_real_path<'a>(srctree: &Path, valid_paths: &'a mut Vec<PathBuf>, file: &
),
[valid_path] => valid_path.to_str().unwrap(),
valid_paths => {
- eprintln!("Several path candidates found:");
+ use std::fmt::Write;
+
+ let mut candidates = String::new();
for path in valid_paths {
- eprintln!(" {path:?}");
+ writeln!(&mut candidates, " {path:?}").unwrap();
}
panic!(
"Several path candidates found for `{file}`, please resolve the ambiguity by \
- renaming a file or folder."
+ renaming a file or folder. Candidates:\n{candidates}",
);
}
}