-
Notifications
You must be signed in to change notification settings - Fork 13.3k
#[must_use]
for associated functions is supposed to actually work
#55003
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
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
b94903d
to
718609b
Compare
(Travis pointed out that this affected some doctests in liballoc!) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
In the comments of (closed, defunct) pull request rust-lang#54884, Mazdak "Centril" Farrokhzad noted that must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for self-ful methods have always worked—but documenting or reworking that can be left to another day.)
718609b
to
ab91a6b
Compare
That is quite confusing. It'd be good to address this later, I agree. @bors r+ |
📌 Commit ab91a6b has been approved by |
`#[must_use]` for associated functions is supposed to actually work In the comments of (closed, defunct) pull request #54884, @Centril [noted that](#54884 (comment)) must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for `self`-ful methods have always worked—but documenting or reworking that can be left to another day.) r? @varkor
☀️ Test successful - status-appveyor, status-travis |
In the comments of (closed, defunct) pull request #54884, @Centril noted that must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a
Def::Method
, whereas the lint pass was only matching onDef::Fn
. (One could argue that those def-names are thereby misleading—must-use forself
-ful methods have always worked—but documenting or reworking that can be left to another day.)r? @varkor