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

The documented patterns for some compiler builtin macros are subtly incorrect #46242

Closed
ExpHP opened this issue Nov 24, 2017 · 2 comments
Closed
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@ExpHP
Copy link
Contributor

ExpHP commented Nov 24, 2017

Example: The macro env is documented as

macro_rules! env {
    ($name:expr) => { ... };
}

when in reality, the following call is legal (playground):

let e = env!("PATH",); // <- Note: Trailing comma

I believe this is because the definition in std is just a fake stub. concat! and concat_idents! (edit: also format_args!) are in a similar boat (they also support trailing commas in places where the documented pattern suggests they would not).

In all fairness this is not a big deal, and even has the conceivable benefit that the documentation is cleaner without such laser precision. I just thought it was worth making an issue for.

@steveklabnik
Copy link
Member

this is not a big deal

it's all good! These should be correct. Happy to take PRs.

@steveklabnik steveklabnik added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Nov 24, 2017
ExpHP added a commit to exphp-forks/rust that referenced this issue Nov 25, 2017
@ExpHP
Copy link
Contributor Author

ExpHP commented Dec 13, 2017

closing since fix was merged

@ExpHP ExpHP closed this as completed Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

No branches or pull requests

2 participants