rustdoc: Add unstable --merge-doctests=yes/no/auto flag by jyn514 · Pull Request #149565 · rust-lang/rust (original) (raw)

This is useful for changing the default for whether doctests are merged or not. Currently, that default is solely controlled by edition = 2024, which adds a high switching cost to get doctest merging. This flag allows opting in even on earlier editions.

Unlike the edition = 2024 default, --merge-doctests=yes gives a hard error if merging fails instead of falling back to running standalone tests. The user has explicitly said they want merging, so we shouldn't silently do something else.

--merge-doctests=auto is equivalent to the current 2024 edition behavior, but available on earlier editions.

Helps with #141240. @epage said in that issue he would like a per-doctest opt-in, and that seems useful to me in addition to this flag, but I think it's a separate use case from changing the default.