-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add documentation about env! second argument #51014
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little too informal for my tastes. Here are some suggestions.
I'm a little cautious about the specific error message you used, too, but i think i'll let that fly.
src/libstd/macros.rs
Outdated
@@ -390,6 +389,20 @@ pub mod builtin { | |||
/// let path: &'static str = env!("PATH"); | |||
/// println!("the $PATH variable at the time of compiling was: {}", path); | |||
/// ``` | |||
/// | |||
/// Please note that you can customize the compilation error by passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"You can customize the error message by passing a string as the second parameter:"
src/libstd/macros.rs
Outdated
/// ``` | ||
/// | ||
/// And you'll get a wonderful error (unless the `documentation` | ||
/// environment variable is defined on your computer for some reason...): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If the documentation
environment variable is not defined, you'll get the following error:"
src/libstd/macros.rs
Outdated
/// environment variable is defined on your computer for some reason...): | ||
/// | ||
/// ```text | ||
/// error: what's that?! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "error" should be all-caps here; isn't that how the compiler outputs it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied/pasted the compiler output so apparently no...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, well in that case we can leave it, lol.
Updated. |
Thanks so much! r=me pending travis. |
@bors r+ rollup |
📌 Commit fe9a195 has been approved by |
…dreavus Add documentation about env! second argument Fixes rust-lang#48044. r? @QuietMisdreavus
Rollup of 11 pull requests Successful merges: - #50987 (Underline multiple suggested replacements in the same line) - #51014 (Add documentation about env! second argument) - #51034 (Remove unused lowering field and method) - #51047 (Use AllFacts from polonius-engine) - #51048 (Add more missing examples for Formatter) - #51056 (Mention and use `Once::new` instead of `ONCE_INIT`) - #51059 (What does an expression look like, that consists only of special characters?) - #51065 (Update nomicon link in transmute docs) - #51067 (Add inner links in documentation) - #51070 (Fail typecheck if we encounter a bogus break) - #51073 (Rename TokenStream::empty to TokenStream::new) Failed merges:
Fixes #48044.
r? @QuietMisdreavus