-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Document std::env::const values #25668
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -598,40 +598,94 @@ pub fn page_size() -> usize { | |
pub mod consts { | ||
/// A string describing the architecture of the CPU that this is currently | ||
/// in use. | ||
/// | ||
/// Some possible values: | ||
/// | ||
/// - x86 | ||
/// - x86_64 | ||
/// - arm | ||
/// - aarch64 | ||
/// - mips | ||
/// - mipsel | ||
/// - powerpc | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const ARCH: &'static str = super::arch::ARCH; | ||
|
||
/// The family of the operating system. In this case, `unix`. | ||
/// | ||
/// Some possible values: | ||
/// | ||
/// - unix | ||
/// - windows | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const FAMILY: &'static str = super::os::FAMILY; | ||
|
||
/// A string describing the specific operating system in use: in this | ||
/// case, `linux`. | ||
/// | ||
/// Some possible values: | ||
/// | ||
/// - linux | ||
/// - macos | ||
/// - ios | ||
/// - freebsd | ||
/// - dragonfly | ||
/// - bitrig | ||
/// - openbsd | ||
/// - android | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing something for windows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whoops, that was the last line of my git grep, accidentally deleted it |
||
/// - windows | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const OS: &'static str = super::os::OS; | ||
|
||
/// Specifies the filename prefix used for shared libraries on this | ||
/// platform: in this case, `lib`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be nice to identify which values are used on which platforms. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that something we want to directly guarantee? Not sure what benefit that would bring, maybe I'm wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have to guarantee anything, but if we're going to enumerate the values that exist it seems like we might as well say "empty string on Windows, 'lib' on everything else". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess my implicit assumption is that if it's documented, it's guaranteed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're willing to document that |
||
/// | ||
/// Some possible values: | ||
/// | ||
/// - lib | ||
/// - `""` (an empty string) | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const DLL_PREFIX: &'static str = super::os::DLL_PREFIX; | ||
|
||
/// Specifies the filename suffix used for shared libraries on this | ||
/// platform: in this case, `.so`. | ||
/// | ||
/// Some possible values: | ||
/// | ||
/// - .so | ||
/// - .dylib | ||
/// - .dll | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const DLL_SUFFIX: &'static str = super::os::DLL_SUFFIX; | ||
|
||
/// Specifies the file extension used for shared libraries on this | ||
/// platform that goes after the dot: in this case, `so`. | ||
/// | ||
/// Some possible values: | ||
/// | ||
/// - .so | ||
/// - .dylib | ||
/// - .dll | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const DLL_EXTENSION: &'static str = super::os::DLL_EXTENSION; | ||
|
||
/// Specifies the filename suffix used for executable binaries on this | ||
/// platform: in this case, the empty string. | ||
/// | ||
/// Some possible values: | ||
/// | ||
/// - exe | ||
/// - `""` (an empty string) | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const EXE_SUFFIX: &'static str = super::os::EXE_SUFFIX; | ||
|
||
/// Specifies the file extension, if any, used for executable binaries | ||
/// on this platform: in this case, the empty string. | ||
/// | ||
/// Some possible values: | ||
/// | ||
/// - exe | ||
/// - `""` (an empty string) | ||
#[stable(feature = "env", since = "1.0.0")] | ||
pub const EXE_EXTENSION: &'static str = super::os::EXE_EXTENSION; | ||
|
||
|
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.
Is this a leftover? I don't think this documentation is Linux-specific.
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.
The documentation is currently built on Linux, and so all of these examples have something like this.
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.
Is this file generated by some script? Otherwise this should probably be changed.