]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scripts: rust: mention file name in error messages
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 28 Feb 2025 17:05:31 +0000 (18:05 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Sat, 8 Mar 2025 22:02:12 +0000 (23:02 +0100)
Improve two error messages in the script by mentioning the doctest file
path from which the doctest was generated from.

This will allow, in case the conversion fails, to get directly the file
name triggering the issue, making the bug fixing process faster.

Signed-off-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
Link: https://lore.kernel.org/r/20250228170530.950268-2-guillaume1.gomez@gmail.com
[ Reworded and removed an unneeded added parameter comma. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
scripts/rustdoc_test_gen.rs

index 5ebd42ae4a3fd1296eb4c8d706476911fde76224..036635fb16213190f151395942971e5256f15fb3 100644 (file)
@@ -87,8 +87,8 @@ fn find_real_path<'a>(srctree: &Path, valid_paths: &'a mut Vec<PathBuf>, file: &
 
     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_real_path<'a>(srctree: &Path, valid_paths: &'a mut Vec<PathBuf>, file: &
             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."
         );
     }