-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Deprecated function calls inside of macros don't warn #17185
Comments
cc @aturon |
I'm looking into this, if no-one is doing it yet. |
@vberger Please do! For reference, the stability lint (which includes deprecation) is currently coded to ignore any output from macros. This was done to solve the opposite problem: macros that use unstable/deprecated items in their definition should not cause warnings for macro users. Getting this right is going to be tricky, because you'd need to distinguish which parts of a macro's output came from its definition, versus client-supplied code. While that's plausible for macro rules, doing it for syntax extensions seems difficult if not impossible. |
@aturon Thanks for the links! Currently, my approach was indeed to try to ignore code that was generated by the macro, marking for lint only nodes declared outside of macro invocation, using I managed to have the example in this issue running, but encountered issues with |
You may also be able to use the hygiene machinery to figure out what was passed in. |
Closes #17185. The stability lint will now check code generated by macro expansion. It will allow to detect : - arguments passed to macros using deprecated (and others) items - macro expansion generating code using deprecated items due to its arguments (hence the second commit, fixing such issue found in libcollections) Checking is still done at expansion, but it will also detect a macro explicitly using a deprecated item in its definition.
@aturon In fact, I realized my fix doesn't completely close it. There is one case where the checking is not done: when the argument of the macro is directly passed to an other macro and not used otherwise, like for I'm looking into this. |
@vberger Thanks for the heads-up. I've reopened the issue. |
fix: keep parentheses when the precedence of inner expr is lower than the outer one fix rust-lang#17185 Additionally, this PR simplifies some code in `apply_demorgan`.
This does not generate a deprecation warning, but will if the
try!
call is removed.The text was updated successfully, but these errors were encountered: