Skip to content
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

improve error message for using unbound 'self' in macro #26946

Closed
comex opened this issue Jul 10, 2015 · 1 comment
Closed

improve error message for using unbound 'self' in macro #26946

comex opened this issue Jul 10, 2015 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

Comments

@comex
Copy link
Contributor

comex commented Jul 10, 2015

I just mistakenly tried to naively use self in a macro (which is only invoked by a method taking self), and got the error:

 error: `self` is not available in a static method. Maybe a `self` argument is missing?

As described in #15682, failure is intended due to hygiene. However, the error message is inaccurate, because a macro body is not a static method. It should be changed to take this case into account.

@steveklabnik steveklabnik added A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Jul 16, 2015
@brson
Copy link
Contributor

brson commented Jan 12, 2017

Seems a bit vague without a test case. Closing, but feel free to reopen with more detail.

@brson brson closed this as completed Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

No branches or pull requests

3 participants