Under this RFC, for users on new editions this warning would become an error, but the compiler message would remain the same. When a user uses a deprecated item, they currently receive a compiler warning telling them what the suggested replacement is.My concern: People reading code sometimes search the docs for APIs used by that code in order to figure out what they do. This problem of increasing noise in the documentation is only going to become more acute as time passes this RFC seeks to tackle it before it becomes too onerous. Of course, due to the conservative policy proposed here, these specific modules would not actually be removed for several more years, but it would be nice to think that someday they would no longer clutter the index. To illustrate, as of Rust 1.52, of the 61 stable modules in the Rust stdlib, 12 of them will be marked as deprecated a full fifth of the modules listed on the index page will be for modules that users are expected to ignore. The goal is not smallness, rather it is that the documentation should not be permanently cluttered with things that users are encouraged not to use. Upon reading this RFC, it seems like the only clear benefit is "the documentation is smaller." It doesn't have any of the traditional advantages of removal, because they're not removed, only hidden.įor users of the new edition these items would be effectively removed the only stronger statement would be to forbid instead of deny them, which would also be fully within the purview of an edition's capabilities. Historically, I have not found sufficient motivation for actually hiding things. But even with those limitations this could still probably be successfully applied to several of the items mentioned in the RFC (currently none at all are making use of this). transforming an identifier into an expression, changing parameter order, adding import paths, etc. AFAICT the current implementation is limited to only transforming one identifier into another identifier, without being able to do anything smarter e.g. Here is an item where cargo fix applies the suggestion properly. here is the suggestion that motivated that this field be added in the first place, and yet cargo fix exits with an error when it tries and invariably fails to apply this suggestion. The problem is that documentation of this field is so nonexistent that even in the rare places where it's being used, it's being used incorrectly: e.g. # has both a mandatory reason field, which is shown to the user in warning messages, and an optional suggestion field, which seems like it is intended for machine consumption via cargo fix and the like. Would it make sense to have this redirection be a part of the rustc_deprecated attribute itself? It seems likely that the replacement is mentioned in the human text of the deprecation making that machine accessible could be nice.Īctually, this might already be supported, to a degree.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |