Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#12918 - lowr:fix/doctest-names, r=Veykril
fix: remove whitespaces from doctest names When rustdoc runs doctests, it removes whitespaces from the tests' path ([code](https://github.com/rust-lang/rust/blob/25bb1c13bd472b75ceebee3b8dcf4dcbc431a8be/src/librustdoc/doctest.rs#L951)). See rust-lang#89422 for details. Interestingly enough, "Run doctest" has been working without much problem even though rust-analyzer hasn't followed the change. This is because cargo passes the test name to rustdoc via `--test-args` option, and then rustdoc [splits it by whitespace](https://github.com/rust-lang/rust/blob/25bb1c13bd472b75ceebee3b8dcf4dcbc431a8be/src/librustdoc/config.rs#L513-L514); the last element of the split test name **always** matches the test name that rustdoc generates. However, it may run other tests unexpectedly (to be precise, this has long since been a thing because of the split). Consider the following example: ```rust struct A<T, U>(T, U); struct B<T, U>(T, U); /// ``` /// doctest here /// ``` impl<T, U> A<T, U> {} /// ``` /// doctest here /// ``` impl<T, U> B<T, U> {} ``` When you "Run doctest" either of the two, rustdoc considers "U>" one of the test specs and both doctests are run. This patch fixes it by following rustdoc and removing the whitespace from the doctests' name.
- Loading branch information