-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
The documentation for the compiler-built-in macro core::env
/ std::env
currently reads:
macro_rules! env {
($name:expr $(,)?) => { ... };
}
The text and example state that a second parameter can be given to customize the error message in case the environment variable is not defined. This second parameter is not reflected in the syntax above. The following is valid:
fn main() {
let x: &'static str = env!("CARGO_MANIFEST_DIR", "oh no!"); // this should not match `$(name:expr $(,)?)`
}
Looking at the implementation, the syntax should most likely be documented as
macro_rules! env {
($name:expr) => { ... };
($name:expr, $error:expr) => { ... };
}
Am I missing something? I can commit a PR if so desired.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.