You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lukaslueg opened this issue
Feb 14, 2021
· 1 comment
· Fixed by #82118
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.
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:
fnmain(){let x:&'staticstr = env!("CARGO_MANIFEST_DIR","oh no!");// this should not match `$(name:expr $(,)?)`}
Looking at the implementation, the syntax should most likely be documented as
@lukaslueg I think you're right; probably the compiler should be checking that the declared macro and the built-in macro accept the same syntax, although that could be hard to enforce. Changing the declared macro seems like a good first step :)
jyn514
added
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
labels
Feb 14, 2021
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.
The documentation for the compiler-built-in macro
core::env
/std::env
currently reads: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:
Looking at the implementation, the syntax should most likely be documented as
Am I missing something? I can commit a PR if so desired.
The text was updated successfully, but these errors were encountered: