From: Tamir Duberstein <tamird@gmail.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"David Gow" <davidgow@google.com>, "Rae Moar" <rmoar@google.com>
Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
Tamir Duberstein <tamird@gmail.com>
Subject: [PATCH v2 2/2] rust: emit path candidates in panic message
Date: Thu, 29 May 2025 09:14:59 -0400 [thread overview]
Message-ID: <20250529-idiomatic-match-slice-v2-2-4925ca2f1550@gmail.com> (raw)
In-Reply-To: <20250529-idiomatic-match-slice-v2-0-4925ca2f1550@gmail.com>
Include all information in the panic message rather than emit fragments
to stderr.
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
scripts/rustdoc_test_gen.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
index d796481f4359..f95129b03cd8 100644
--- a/scripts/rustdoc_test_gen.rs
+++ b/scripts/rustdoc_test_gen.rs
@@ -92,13 +92,15 @@ fn find_candidates(
),
[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:?}");
+ write!(&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}",
);
}
}
--
2.49.0
next prev parent reply other threads:[~2025-05-29 13:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 13:14 [PATCH v2 0/2] rust: minor idiomatic fixes to doctest generator Tamir Duberstein
2025-05-29 13:14 ` [PATCH v2 1/2] rust: replace length checks with match Tamir Duberstein
2025-05-29 13:14 ` Tamir Duberstein [this message]
2025-05-29 13:21 ` [PATCH v2 2/2] rust: emit path candidates in panic message Miguel Ojeda
2025-05-29 14:38 ` Tamir Duberstein
2025-05-29 16:00 ` Miguel Ojeda
2025-07-20 22:20 ` Miguel Ojeda
2025-07-20 23:01 ` Tamir Duberstein
2025-07-20 22:57 ` [PATCH v2 0/2] rust: minor idiomatic fixes to doctest generator Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250529-idiomatic-match-slice-v2-2-4925ca2f1550@gmail.com \
--to=tamird@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=brendan.higgins@linux.dev \
--cc=dakr@kernel.org \
--cc=davidgow@google.com \
--cc=gary@garyguo.net \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rmoar@google.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).