[PATCH 1/1] Improve error message in case the original file name from which the doctest was generated from to mention the doctest file path.
From: Guillaume Gomez
Date: Fri Feb 28 2025 - 12:06:00 EST
In case the conversion fail, it will allow to get directly the file name
triggering this bug, making the bug fixing process faster.
Signed-off-by: Guillaume Gomez <guillaume1.gomez@xxxxxxxxx>
---
scripts/rustdoc_test_gen.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
index 5ebd42ae4..12115979e 100644
--- a/scripts/rustdoc_test_gen.rs
+++ b/scripts/rustdoc_test_gen.rs
@@ -87,8 +87,8 @@ fn find_candidates(
assert!(
valid_paths.len() > 0,
- "No path candidates found. This is likely a bug in the build system, or some files went \
- away while compiling."
+ "No path candidates found for `{file}`. This is likely a bug in the build system, or some \
+ files went away while compiling.",
);
if valid_paths.len() > 1 {
@@ -97,8 +97,8 @@ fn find_candidates(
eprintln!(" {path:?}");
}
panic!(
- "Several path candidates found, please resolve the ambiguity by renaming a file or \
- folder."
+ "Several path candidates found for `{file}`, please resolve the ambiguity by renaming \
+ a file or folder."
);
}
--
2.48.1