Skip to content

Documentation for cfg! says it takes a single token tree #30073

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

Closed
jonas-schievink opened this issue Nov 26, 2015 · 3 comments
Closed

Documentation for cfg! says it takes a single token tree #30073

jonas-schievink opened this issue Nov 26, 2015 · 3 comments

Comments

@jonas-schievink
Copy link
Contributor

The documentation page for cfg! starts with this:

macro_rules! cfg { ($cfg:tt) => ({ /* compiler built-in */ }) }

In reality, cfg! accepts things like feature = "bla", which isn't a single token tree.

@durka
Copy link
Contributor

durka commented Nov 26, 2015

Should be $cfg:meta I guess, right?

@jonas-schievink
Copy link
Contributor Author

I think so, yeah

@durka
Copy link
Contributor

durka commented Nov 26, 2015

Source here. Looks like the doc for include! is also wrong, as it says $cfg:tt where it should probably have $file:expr same as include_bytes! above.

bors added a commit that referenced this issue Nov 30, 2015
Fixes #30073. The input to `cfg!` is a meta attribute, but not _any_ meta attribute (e.g. `cfg!(allow(dead_code))` doesn't compile). But the macro_rules syntax can't quite express this, so I added a note to the doc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants