about summary refs log tree commit diff
path: root/src/libstd/os.rs
AgeCommit message (Collapse)AuthorLines
2014-12-20Fix fallout of removing import_shadowing in tests.Eduard Burtescu-1/+0
2014-12-19libstd: use `#[deriving(Copy)]`Jorge Aparicio-4/+2
2014-12-18Revise std::thread API to join by defaultAaron Turon-1/+2
This commit is part of a series that introduces a `std::thread` API to replace `std::task`. In the new API, `spawn` returns a `JoinGuard`, which by default will join the spawned thread when dropped. It can also be used to join explicitly at any time, returning the thread's result. Alternatively, the spawned thread can be explicitly detached (so no join takes place). As part of this change, Rust processes now terminate when the main thread exits, even if other detached threads are still running, moving Rust closer to standard threading models. This new behavior may break code that was relying on the previously implicit join-all. In addition to the above, the new thread API also offers some built-in support for building blocking abstractions in user space; see the module doc for details. Closes #18000 [breaking-change]
2014-12-18Fix compilation on linuxAlex Crichton-1/+0
2014-12-18Fallout from new thread APIAaron Turon-1/+1
2014-12-18Make at_exit initialize lazilyAaron Turon-1/+0
2014-12-18Allow args to work without rt initializationAaron Turon-5/+1
2014-12-18Refactor std::os to use sys::osAaron Turon-381/+25
2014-12-18libs: merge librustrt into libstdAaron Turon-2/+2
This commit merges the `rustrt` crate into `std`, undoing part of the facade. This merger continues the paring down of the runtime system. Code relying on the public API of `rustrt` will break; some of this API is now available through `std::rt`, but is likely to change and/or be removed very soon. [breaking-change]
2014-12-16auto merge of #19747 : alexcrichton/rust/slice-one-trait, r=brsonbors-3/+3
This commit collapses the various prelude traits for slices into just one trait: * SlicePrelude/SliceAllocPrelude => SliceExt * CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt * OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt * PartialEqSlicePrelude => PartialEqSliceExt
2014-12-15rollup merge of #19787: akiss77/fix-i8-c_charBrian Anderson-1/+1
On AArch64, libc::c_char is u8. There are some places in the code where i8 is assumed, which causes compilation errors. (AArch64 is not officially supported yet, but this change does not hurt any other targets and makes the code future-proof.)
2014-12-15rollup merge of #19710: steveklabnik/gh15449Brian Anderson-2/+2
Fixes #15499.
2014-12-14std: Collapse SlicePrelude traitsAlex Crichton-3/+3
This commit collapses the various prelude traits for slices into just one trait: * SlicePrelude/SliceAllocPrelude => SliceExt * CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt * OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt * PartialEqSlicePrelude => PartialEqSliceExt
2014-12-13libstd: add missing importsJorge Aparicio-0/+1
2014-12-13libstd: use unboxed closuresJorge Aparicio-4/+7
2014-12-12libc::c_char is not necessarily i8Akos Kiss-1/+1
2014-12-11Register new snapshotsAlex Crichton-3/+1
2014-12-10Fix inappropriate ## headingsSteve Klabnik-2/+2
Fixes #15499.
2014-12-09Test fixes and rebase conflicts from the rollupAlex Crichton-3/+3
2014-12-09rollup merge of #19620: retep998/memorymapAlex Crichton-38/+34
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+12
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-3/+3
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-07Make MemoryMap use HANDLE on Windows.Peter Atashian-38/+34
Also fixes some conflicting module names. Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-12-06libstd: remove unnecessary `as_slice()` callsJorge Aparicio-3/+3
2014-12-05Utilize fewer reexportsCorey Farwell-12/+15
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05Fall out of the std::sync rewriteAlex Crichton-6/+4
2014-12-03Fix falloutJorge Aparicio-2/+2
2014-11-26rollup merge of #19329: steveklabnik/doc_style_cleanup2Alex Crichton-17/+13
2014-11-26/*! -> //!Steve Klabnik-17/+13
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-26rollup merge of #19288: steveklabnik/doc_style_cleanupAlex Crichton-27/+21
This is considered good convention. This is about half of them in total, I just don't want an impossible to land patch. :smile:
2014-11-26auto merge of #19176 : aturon/rust/stab-iter, r=alexcrichtonbors-1/+1
This is an initial pass at stabilizing the `iter` module. The module is fairly large, but is also pretty polished, so most of the stabilization leaves things as they are. Some changes: * Due to the new object safety rules, various traits needs to be split into object-safe traits and extension traits. This includes `Iterator` itself. While splitting up the traits adds some complexity, it will also increase flexbility: once we have automatic impls of `Trait` for trait objects over `Trait`, then things like the iterator adapters will all work with trait objects. * Iterator adapters that use up the entire iterator now take it by value, which makes the semantics more clear and helps catch bugs. Due to the splitting of Iterator, this does not affect trait objects. If the underlying iterator is still desired for some reason, `by_ref` can be used. (Note: this change had no fallout in the Rust distro except for the useless mut lint.) * In general, extension traits new and old are following an [in-progress convention](rust-lang/rfcs#445). As such, they are marked `unstable`. * As usual, anything involving closures is `unstable` pending unboxed closures. * A few of the more esoteric/underdeveloped iterator forms (like `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with various unfolds) are left experimental for now. * The `order` submodule is left `experimental` because it will hopefully be replaced by generalized comparison traits. * "Leaf" iterators (like `Repeat` and `Counter`) are uniformly constructed by free fns at the module level. That's because the types are not otherwise of any significance (if we had `impl Trait`, you wouldn't want to define a type at all). Closes #17701 Due to renamings and splitting of traits, this is a: [breaking-change]
2014-11-26auto merge of #19169 : aturon/rust/fds, r=alexcrichtonbors-0/+5
This PR adds some internal infrastructure to allow the private `std::sys` module to access internal representation details of `std::io`. It then exposes those details in two new, platform-specific API surfaces: `std::os::unix` and `std::os::windows`. To start with, these will provide the ability to extract file descriptors, HANDLEs, SOCKETs, and so on from `std::io` types. More functionality, and more specific platforms (e.g. `std::os::linux`) will be added over time. Closes #18897
2014-11-25/** -> ///Steve Klabnik-27/+21
This is considered good convention.
2014-11-25Fallout from stabilizationAaron Turon-1/+1
2014-11-23rollup merge of #19205: jashank/docs-fixJakub Bukaj-1/+1
Catch a missed triple-slash in the docs for `std::os::args()`. Passes `make check`. (I've also eyeballed the rest of `libstd` with the aid of some funky regexes and haven't found anything similar.)
2014-11-23auto merge of #19152 : alexcrichton/rust/issue-17863, r=aturonbors-7/+7
This commit is an implementation of [RFC 240][rfc] when applied to the standard library. It primarily deprecates the entirety of `string::raw`, `vec::raw`, `slice::raw`, and `str::raw` in favor of associated functions, methods, and other free functions. The detailed renaming is: * slice::raw::buf_as_slice => slice::from_raw_buf * slice::raw::mut_buf_as_slice => slice::from_raw_mut_buf * slice::shift_ptr => deprecated with no replacement * slice::pop_ptr => deprecated with no replacement * str::raw::from_utf8 => str::from_utf8_unchecked * str::raw::c_str_to_static_slice => str::from_c_str * str::raw::slice_bytes => deprecated for slice_unchecked (slight semantic diff) * str::raw::slice_unchecked => str.slice_unchecked * string::raw::from_parts => String::from_raw_parts * string::raw::from_buf_len => String::from_raw_buf_len * string::raw::from_buf => String::from_raw_buf * string::raw::from_utf8 => String::from_utf8_unchecked * vec::raw::from_buf => Vec::from_raw_buf All previous functions exist in their `#[deprecated]` form, and the deprecation messages indicate how to migrate to the newer variants. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0240-unsafe-api-location.md [breaking-change] Closes #17863
2014-11-22std: Align `raw` modules with unsafe conventionsAlex Crichton-7/+7
This commit is an implementation of [RFC 240][rfc] when applied to the standard library. It primarily deprecates the entirety of `string::raw`, `vec::raw`, `slice::raw`, and `str::raw` in favor of associated functions, methods, and other free functions. The detailed renaming is: * slice::raw::buf_as_slice => slice::with_raw_buf * slice::raw::mut_buf_as_slice => slice::with_raw_mut_buf * slice::shift_ptr => deprecated with no replacement * slice::pop_ptr => deprecated with no replacement * str::raw::from_utf8 => str::from_utf8_unchecked * str::raw::c_str_to_static_slice => str::from_c_str * str::raw::slice_bytes => deprecated for slice_unchecked (slight semantic diff) * str::raw::slice_unchecked => str.slice_unchecked * string::raw::from_parts => String::from_raw_parts * string::raw::from_buf_len => String::from_raw_buf_len * string::raw::from_buf => String::from_raw_buf * string::raw::from_utf8 => String::from_utf8_unchecked * vec::raw::from_buf => Vec::from_raw_buf All previous functions exist in their `#[deprecated]` form, and the deprecation messages indicate how to migrate to the newer variants. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0240-unsafe-api-location.md [breaking-change] Closes #17863
2014-11-22args() doc: Fix a documentation line.Jashank Jeremy-1/+1
2014-11-21libs: add std::os::windows moduleAaron Turon-0/+5
The new `std::os::windows` module exposes several extension traits for extracting file descriptors, sockets, and handles from `std::io` types.
2014-11-20Make most of std::rt privateAaron Turon-3/+3
Previously, the entire runtime API surface was publicly exposed, but that is neither necessary nor desirable. This commit hides most of the module, using librustrt directly as needed. The arrangement will need to be revisited when rustrt is pulled into std. [breaking-change]
2014-11-19rollup merge of #18944: liigo/improve-os-args-docJakub Bukaj-0/+4
2014-11-19Make os::setenv() and os::unsetenv() panic if an error occursBarosl Lee-5/+14
These functions can fail if: - EINVAL: The name is empty, or contains an '=' character - ENOMEM: Insufficient memory
2014-11-19Make os::change_dir() return IoResult<()>Barosl Lee-14/+15
os::change_dir() returns bool, without a meaningful error message. Change it to return IoResult<()> to indicate what IoError caused the failure. Fixes #16315. [breaking-change]
2014-11-19Make os::getcwd() return IoResult<Path>Barosl Lee-26/+38
os::getcwd() panics if the current directory is not available. According to getcwd(3), there are three cases: - EACCES: Permission denied. - ENOENT: The current working directory has been removed. - ERANGE: The buffer size is less than the actual absolute path. This commit makes os::getcwd() return IoResult<Path>, not just Path, preventing it from panicking. As os::make_absolute() depends on os::getcwd(), it is also modified to return IoResult<Path>. Fixes #16946. [breaking-change]
2014-11-18auto merge of #18645 : nick29581/rust/coercions-1, r=alexcrichtonbors-5/+5
r? (I realise this needs a rebase, but I will probably have to chop it up in order to land and I'd like to get r+ first so I can do that quicker)
2014-11-18Windows and OS X falloutNick Cameron-5/+5
2014-11-18rollup merge of #19038: jayelm/fixed-typosJakub Bukaj-1/+1
Baby steps here... Fixed some comments in liblog, libregex, librustc, libstd.
2014-11-17Fix several typos in commentsjmu303-1/+1
liblog, libregex, librustc, libstd
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+4
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17Fix fallout from coercion removalNick Cameron-22/+22