libtest: Index tests by a unique TestId#82300
Conversation
|
r? @KodrAus (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
library/test/src/types.rs
Outdated
There was a problem hiding this comment.
I guess an alternative here could be to add an id field to TestDesc. If all we need is to guarantee that different tests with the same description don't equate that should even be enough to leave the derived equality and hashing.
There was a problem hiding this comment.
If we added id to TestDesc, the responsibility for generating it and ensuring its uniqueness would fall to the compiler (I’m not sure if this macro even can generate a unique ID):
rust/compiler/rustc_builtin_macros/src/test.rs
Lines 227 to 297 in 3e826bb
as well as librustdoc:
rust/src/librustdoc/doctest.rs
Lines 831 to 842 in 3e826bb
and all the tests for libtest itself. Even if this is somehow possible, it wouldn’t reduce churn.
Another alternative would be to try using the address of the TestDesc as a unique identifier—but then instead of moving or cloning TestDesc we’d have to pass it by reference, which also at best wouldn’t reduce churn.
|
☔ The latest upstream changes (presumably #83454) made this pull request unmergeable. Please resolve the merge conflicts. |
This more robustly avoids problems with duplicate TestDesc. See rust-lang#81852 and rust-lang#82274. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
|
r? @Amanieu |
|
@bors r+ |
|
📌 Commit 3c42d9f has been approved by |
|
☀️ Test successful - checks-actions |
This more robustly avoids problems with duplicate
TestDesc. See #81852 and #82274.Cc @Mark-Simulacrum.