summary refs log tree commit diff
path: root/src/libstd/env.rs
AgeCommit message (Collapse)AuthorLines
2016-01-15Auto merge of #30898 - petrochenkov:tvarfstab, r=alexcrichtonbors-1/+1
This wasn't done in https://github.com/rust-lang/rust/pull/29083 because attributes weren't parsed on fields of tuple variant back then. r? @alexcrichton
2016-01-14Require stability annotations on fields of tuple variantsVadim Petrochenkov-1/+1
2016-01-13Add powerpc64 and powerpc64le supportAnton Blanchard-0/+12
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2015-12-01Small fix to EXE_SUFFIX and DLL_EXTENSION docsSteve Klabnik-4/+6
2015-11-29Fix #30093Jack Fransham-1/+1
2015-11-08Spell out the fallback of `std::env::home_dir` on POSIXTobias Bucher-1/+3
2015-11-06Auto merge of #29305 - alexcrichton:bad-getenv, r=brsonbors-10/+10
As discovered in #29298, `env::set_var("", "")` will panic, but it turns out that it *also* deadlocks on Unix systems. This happens because if a panic happens while holding the environment lock, we then go try to read RUST_BACKTRACE, grabbing the environment lock, causing a deadlock. Specifically, the changes made here are: * The environment lock is pushed into `std::sys` instead of `std::env`. This also only puts it in the Unix implementation, not Windows where the functions are already threadsafe. * The `std::sys` implementation now returns `io::Result` so panics are explicitly at the `std::env` level.
2015-10-30Tweak env docs a bitSteven Fackler-3/+3
The "optionally" stuff just makes things confusing.
2015-10-29Auto merge of #29289 - DiamondLovesYou:pnacl-std-crates, r=alexcrichtonbors-0/+26
2015-10-28Port the standard crates to PNaCl/NaCl.Richard Diamond-0/+26
2015-10-26std: Slightly more robust env var handlingAlex Crichton-10/+10
As discovered in #29298, `env::set_var("", "")` will panic, but it turns out that it *also* deadlocks on Unix systems. This happens because if a panic happens while holding the environment lock, we then go try to read RUST_BACKTRACE, grabbing the environment lock, causing a deadlock. Specifically, the changes made here are: * The environment lock is pushed into `std::sys` instead of `std::env`. This also only puts it in the Unix implementation, not Windows where the functions are already threadsafe. * The `std::sys` implementation now returns `io::Result` so panics are explicitly at the `std::env` level. The panic messages have also been improved in these situations.
2015-10-25Say that `std::env::{set_var, unset_var}` *may* panicTobias Bucher-4/+6
Previously the documentation suggested that the documentation about the panics are guarantees.
2015-10-25Document possible panics for `std::env::{set_var, unset_var}`Tobias Bucher-0/+10
2015-10-11Clarify the behavior of `std::env::home_dir` and `std::env::temp_dir`Barosl Lee-2/+9
This concern was raised by #28940.
2015-09-09Reduce code bloat from conversion traits in function parametersVadim Petrochenkov-3/+19
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-33/+0
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-0/+2
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-16Fixed typoKristof Söderström-1/+1
2015-07-08Make `std::env::current_dir` work for path names longer than 2048 bytes on ↵Tobias Bucher-1/+0
non-Windows
2015-07-01Add netbsd amd64 supportAlex Newman-0/+12
2015-06-17std: Deprecate the `exit_status` featureAlex Crichton-0/+2
These two functions should be replaceable with the `process::exit` function.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-1/+1
2015-05-28Rollup merge of #25668 - steveklabnik:doc_const, r=alexcrichtonManish Goregaokar-0/+54
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-4/+4
2015-05-26Document std::env::const valuesSteve Klabnik-0/+54
2015-05-13libstd/env: Add non-Rust synchronization warnings for setenv()Colin Walters-0/+22
See: https://sourceware.org/bugzilla/show_bug.cgi?id=4887#c9 https://bugs.freedesktop.org/show_bug.cgi?id=65681 I just noticed this while talking to someone who was using `os.environ['FOO'] = 'BAR'` in Python and since I'm learning Rust, I was curious if it did anything special here. It looks like Rust has an internal mutex, which helps for apps that are pure Rust, but it will be an evil trap for someone later adding in native code (apps like Servo and games will be at risk). Java got this right by disallowing `setenv()` from the start. I suggest Rust program authors only use `setenv()` early in main.
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-2/+2
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-05-05std: Generalize generics a bit in std::envAlex Crichton-7/+5
Many bounds are currently of the form `T: ?Sized + AsRef<OsStr>` where the argument is `&T`, but the pattern elsewhere (primarily `std::fs`) has been to remove the `?Sized` bound and take `T` instead (allowing usage with both references and owned values). This commit generalizes the possible apis in `std::env` from `&T` to `T` in this fashion. The `split_paths` function remains the same as the return value borrows the input value, so ta borrowed reference is required.
2015-04-30doc: current_dir returns a PathBuf, not a PathBrian Anderson-1/+1
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-3/+3
Conflicts: src/libcore/result.rs
2015-04-21std: Bring back f32::from_str_radix as an unstable APIAlex Crichton-3/+3
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
2015-04-17std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-1/+0
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-1/+1
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-12/+12
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31rollup merge of #23875: aturon/revise-convert-2Alex Crichton-1/+0
* Marks `#[stable]` the contents of the `std::convert` module. * Added methods `PathBuf::as_path`, `OsString::as_os_str`, `String::as_str`, `Vec::{as_slice, as_mut_slice}`. * Deprecates `OsStr::from_str` in favor of a new, stable, and more general `OsStr::new`. * Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes, to_cstring}` for ergonomic FFI usage. [breaking-change] r? @alexcrichton
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-12/+12
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-31Stabilize `std::convert` and related codeAaron Turon-1/+0
* Marks `#[stable]` the contents of the `std::convert` module. * Added methods `PathBuf::as_path`, `OsString::as_os_str`, `String::as_str`, `Vec::{as_slice, as_mut_slice}`. * Deprecates `OsStr::from_str` in favor of a new, stable, and more general `OsStr::new`. * Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes, to_cstring}` for ergonomic FFI usage. [breaking-change]
2015-03-31Last docs for std::envSteve Klabnik-1/+28
2015-03-23Test fixes and rebase conflicts, round 3Alex Crichton-1/+1
2015-03-23Test fixes and rebase conflicts, round 2Alex Crichton-2/+3
2015-03-23Test fixes and rebase conflicts, round 1Alex Crichton-1/+1
2015-03-23Add generic conversion traitsAaron Turon-3/+3
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-20std: Remove old_io/old_path from the preludeAlex Crichton-1/+2
This commit removes the reexports of `old_io` traits as well as `old_path` types and traits from the prelude. This functionality is now all deprecated and needs to be removed to make way for other functionality like `Seek` in the `std::io` module (currently reexported as `NewSeek` in the io prelude). Closes #23377 Closes #23378
2015-03-17Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiynManish Goregaokar-13/+13
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-15Fix an String -> a String in env.rs documentationDabo Ross-1/+1
Super minor change! The `an String` was introduced in https://github.com/rust-lang/rust/commit/a828e7948069f310dc5b33be8edb65e5e8e0cf9a#diff-b596503c7c33ce457b6d047e351ac12bR423, which changed `an OsString` to `an String`.
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-13/+13
2015-03-13Auto merge of #23229 - aturon:stab-path, r=alexcrichtonbors-2/+3
This commit stabilizes essentially all of the new `std::path` API. The API itself is changed in a couple of ways (which brings it in closer alignment with the RFC): * `.` components are now normalized away, unless they appear at the start of a path. This in turn effects the semantics of e.g. asking for the file name of `foo/` or `foo/.`, both of which yield `Some("foo")` now. This semantics is what the original RFC specified, and is also desirable given early experience rolling out the new API. * The `parent` method is now `without_file` and succeeds if, and only if, `file_name` is `Some(_)`. That means, in particular, that it fails for a path like `foo/../`. This change affects `pop` as well. In addition, the `old_path` module is now deprecated. [breaking-change] r? @alexcrichton
2015-03-12Stabilize std::pathAaron Turon-2/+3
This commit stabilizes essentially all of the new `std::path` API. The API itself is changed in a couple of ways (which brings it in closer alignment with the RFC): * `.` components are now normalized away, unless they appear at the start of a path. This in turn effects the semantics of e.g. asking for the file name of `foo/` or `foo/.`, both of which yield `Some("foo")` now. This semantics is what the original RFC specified, and is also desirable given early experience rolling out the new API. * The `parent` function now succeeds if, and only if, the path has at least one non-root/prefix component. This change affects `pop` as well. * The `Prefix` component now involves a separate `PrefixComponent` struct, to better allow for keeping both parsed and unparsed prefix data. In addition, the `old_path` module is now deprecated. Closes #23264 [breaking-change]
2015-03-11Example -> ExamplesSteve Klabnik-12/+12
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-09remove uses of as_slice where deref coercions can be usedRicho Healey-3/+3