Fix bug where option_env! would return None when env var is prese… · qinheping/verify-rust-std@6fc4b1a (original) (raw)

Original file line number Diff line number Diff line change
@@ -1107,17 +1107,19 @@ pub(crate) mod builtin {
1107 1107 ///
1108 1108 /// If the named environment variable is present at compile time, this will
1109 1109 /// expand into an expression of type `Option<&'static str>` whose value is
1110 - /// `Some` of the value of the environment variable. If the environment
1111 - /// variable is not present, then this will expand to `None`. See
1112 - /// [`Option`][Option] for more information on this type. Use
1113 - /// [`std::env::var`] instead if you want to read the value at runtime.
1110 + /// `Some` of the value of the environment variable (a compilation error
1111 + /// will be emitted if the environment variable is not a valid Unicode
1112 + /// string). If the environment variable is not present, then this will
1113 + /// expand to `None`. See [`Option`][Option] for more information on this
1114 + /// type. Use [`std::env::var`] instead if you want to read the value at
1115 + /// runtime.
1114 1116 ///
1115 1117 /// [`std::env::var`]: ../std/env/fn.var.html
1116 1118 ///
1117 - /// A compile time error is never emitted when using this macro regardless
1118 - /// of whether the environment variable is present or not.
1119 - /// To emit a compile error if the environment variable is not present,
1120 - /// use the [`env!`] macro instead.
1119 + /// A compile time error is only emitted when using this macro if the
1120 + /// environment variable exists and is not a valid Unicode string. To also
1121 + /// emit a compile error if the environment variable is not present, use the
1122 + /// [`env!`] macro instead.
1121 1123 ///
1122 1124 /// # Examples
1123 1125 ///