-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using deprecated items within the crate that deprecated them issues warnings #47219
Comments
Whelp, I only read the RFC (rust-lang/rfcs#1270), not its accompanying tracking issue (#29935) where some people have written concerns about the extreme verbosity of deprecated warnings but the discussion died out. I was thinking in the direction of allowing access to deprecated items in the crate which defines it in its entirety but I imagine that's more something for rust-lang/rfcs. Still the extreme verbosity of deprecated warning deserves an issue. |
So I still have this issue. We deprecated a type, and suddenly we get tens of deprecation warnings of internal usage of this type, which are just method implementations on those types. Adding a deprecation warning to all these methods doesn't change anything. I tried adding
|
154: journal: adjust open() mechanisms to use a builder pattern r=jmesmon a=jmesmon - `JournalFiles` doesn't properly cover all inclusions/exclusions - The various boolean arguments were leading to "boolean blindness" (ie: lack of clarity in what `open()` call options meant). - `OpenOptions`, `OpenFileOptions`, and `OpenDirectoryOptions` are added. These are patterned after `std::fs::OpenOptions`. - I've marked the commonly used `Journal::open()` as deprecated (and was somewhat annoyed by rust-lang/rust#47219). - I've removed `Journal::open_directory` and `Journal::open_files` entirely. They'll need to use the new `journal::OpenFileOptions` and `journal::OpenDirectoryOptions`. Co-authored-by: Cody P Schafer <dev@codyps.com>
154: journal: adjust open() mechanisms to use a builder pattern r=jmesmon a=jmesmon - `JournalFiles` doesn't properly cover all inclusions/exclusions - The various boolean arguments were leading to "boolean blindness" (ie: lack of clarity in what `open()` call options meant). - `OpenOptions`, `OpenFileOptions`, and `OpenDirectoryOptions` are added. These are patterned after `std::fs::OpenOptions`. - I've marked the commonly used `Journal::open()` as deprecated (and was somewhat annoyed by rust-lang/rust#47219). - I've removed `Journal::open_directory` and `Journal::open_files` entirely. They'll need to use the new `journal::OpenFileOptions` and `journal::OpenDirectoryOptions`. Co-authored-by: Cody P Schafer <dev@codyps.com>
Another related case is whether we should still output deprecated usage warnings for deprecated items inside an already deprecated item. Say we have an deprecated item #[deprecated]
pub fn drop_foo(f: Foo) {
} In this case the usage is already in a deprecated function, there is little upside to change the already deprecated code. We can however to add an option if it may indeed be useful in some cases. |
Typically you want to know about all usages of a deprecated item, since you want to remove all usage of it. And where you want to temporarily still use it it makes sense to have to add Triage: Changing to T-lang since I don't think it's self evident that this should be changed. |
When I made this issue I came from a perspective of using deprecated as a tool to guide consumers of the crate on what to use (without breaking compatibility). Within my own crate I can just xref all uses and break/fix things as there is no compatibility hazard. |
When deprecating an item, you typically still want the helper methods supporting it to work without the compiler whining that the item is deprecated.
I tried this code: playground
I expected to see this happen: The code compiles without deprecation warnings.
Instead, this happened: Litterally every usage of
Foo
gets a use of deprecated itemFoo
warning.The fact that I'm deprecating an item doesn't mean the crate itself should now be spammed with deprecation warnings. Working around it by either a global
#![allow(deprecated)]
will swallow legitimate deprecation warnings or require all uses to be tagged with it.Meta
Playground, all channels (how do you get the version info from the playground?)
The text was updated successfully, but these errors were encountered: