-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
librustc: Can mark functions as deprecated. #4643
Conversation
Awesome. Can you add a test? Here's an example: https://github.com/mozilla/rust/blob/incoming/src/test/compile-fail/lint-deprecated-self.rs Checking use of deprecated types will require either looking through the types of all the nodes in the type context, or possibly adding a new table of 'used types' to the type context. Types would be added to this table by the type checker during unification. |
Hmm ok. Also, are methods handled differently than regular fn's in the def_map? There's def_fn and def_static_method. |
I am not familiar enough with resolve to know what's in def_map, but @pcwalton, @nikomatsakis or @catamorphism might be. |
@luqmana This should all be documented, but isn't. Feel free to ask follow-up questions... |
(see |
So how could I get the ast::def_id associated with a ast::expr_method_call to lookup the ast::item? |
@luqmana You can't, because the method you're actually calling isn't known until trans time. For example:
Does So you could do this check as part of trans (as a sort of link-time lint check) or just punt on allowing impl methods to have a |
I'm not sure what the status of this is; closing. @luqmana -- feel free to open a new pull requests, or ask questions on IRC if you're blocked! |
#723 - Add a deprecated items check to lint.
So far it actually only works for functions. I'm not exactly sure how to go about doing it for things like types, structs etc and catching only their uses.