Skip to content

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

Closed
@ExpHP

Description

@ExpHP

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions