On Fri, Dec 19, 2025 at 10:25 AM David Gow davidgow@google.com wrote:
- Is it worth renumbering all of the tests (hopefully just once), or
would that break too many people's test histories?
Personally I don't have such histories just yet (and anyway the tests generally work), and even if someone does, it may be best to pay the price sooner rather than later.
- Is there a better way of doing this in Rust? I can think of ways
which might be nicer if the whole thing is refactored somewhat seriously, but if there's an easy numeric sort on strings, that'd be much easier.
We do essentially the same in the main loop (which is where I suppose you picked it up), so it isn't too bad:
// The `name` follows the `{file}_{line}_{number}` pattern (see description in // `scripts/rustdoc_test_builder.rs`). Discard the `number`. let name = path.file_name().unwrap().to_str().unwrap().to_string();
// Extract the `file` and the `line`, discarding the `number`. let (file, line) = name.rsplit_once('_').unwrap().0.rsplit_once('_').unwrap();
However, we could perhaps save the information so that the main loop is cleaner instead of redoing it.
Having said that, given we are migrating anyway, this patch may be simpler to avoid reworking this code. So I am happy either way.
- Should we wait until after all or some of the changes to the test
generation? Does the new --output-format=doctest option make this easier/harder/different?
We could do it there -- it would be easier in the sense that we have the proper data already with the proper types etc.
On the other hand, it may be best to define the order we want to follow (independently of the approaches), and then the migration would be a smaller change conceptually, i.e. one less thing to decide then.
(I have to send the version to finally integrate the migration soon, by the way -- I would like to put it in this cycle if possible).
Thanks!
Cheers, Miguel