Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#[plugin(...)] at the top level should cause an error; #![plugin(...)] is correct #24213

Closed
apoelstra opened this issue Apr 8, 2015 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html

Comments

@apoelstra
Copy link
Contributor

Right now if you write #[plugin(...)] to import some syntax extension, the import simply won't happen and other errors will occur. For example, if you write #[plugin(serde_macros)] and then later do #[derive(Serialize)] on a type you will get errors about Serialize not being implemented, as though the derive had done nothing.

This is extremely confusing since a user is basically being told "#derive had no effect" when the real problem is a missing exclamation mark in a totally different source file.

This should trigger an error to use #![plugin(...)] instead.

cc @erickt

@steveklabnik steveklabnik added A-diagnostics Area: Messages for errors, warnings, and lints A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html labels Apr 9, 2015
@jonas-schievink
Copy link
Contributor

The same works for no_std and probably all other gated attributes, since they are ignored by the unused_attributes lint. In other cases, the lint already prints "crate-level attribute should be an inner attribute: add an exclamation mark: #![foo]", but gated attributes cannot simultaneously be marked as CrateLevel.

bors added a commit that referenced this issue Aug 29, 2015
This allows marking attributes as whitelisted/crate-only independent of
their feature gate status.

Closes #24213
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html
Projects
None yet
Development

No branches or pull requests

3 participants