A rare issue programmers have is adding sleep statements for testing purposes then forgetting to remove them. They somehow get missed in review and wind up in a real application leading to a slowdown.
What I love about std::thread::sleep_ms is I can use it for testing purposes and get reminded through compiler warnings about its existence on every build. Then when I'm done, I click all the links on the warnings to find the statements to remove without having to search too hard. I think this is a great feature and perhaps it would be good to never remove this API while keeping it deprecated. I'd be a little sad to see it go.
AFAIK, we have never actually removed anything that was stabilized before deprecation. Some folks have proposed that we try to do that across edition boundaries, but there's no agreement yet.
Something I use to prevent accidents like this: I diff before I commit, carefully checking each change. I tend to have a lot more temporary debug aids than just sleep.
warning: use of deprecated macro `dnc`: DO NOT COMMIT
--> src/main.rs:7:5
|
7 | dnc!( /* anything goes! */ );
| ^^^
|
= note: `#[warn(deprecated)]` on by default
I also diff, but I'm not infallible. My point was how it's nice that I get something screaming at me. Additionally, I don't have to bother importing or specifying std::time::Duration, which is quite verbose for quick changes.
Assuming deprecated items start being removed from std, I don't think the justification that some people use deprecation as an ad hoc way to trigger compilation warnings in debug builds is a good reason to keep them around
That and there are many more debugging aids (printing, interactivity, sleeping, extra locking...) one might want, so really I'd like to see this written
A way to do this at the call site and at the declaration would be useful. I've actually been abusing the deprecated attribute in my test code for debugging functionality that shouldn't make it into the comitted test suite.
Note that I've not really seen any discussion about trying to remove things like sleep_ms that are only deprecated for "this works fine but there's another thing that's a bit better".
The discussions I've seen about trying to remove things from an edition are about things are are just massive footguns that nobody should ever use -- notably mem::uninitialized.