about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2016-05-24std: Stabilize APIs for the 1.10 releaseAlex Crichton-9/+12
This commit applies the FCP decisions made by the libs team for the 1.10 cycle, including both new stabilizations and deprecations. Specifically, the list of APIs is: Stabilized: * `os::windows::fs::OpenOptionsExt::access_mode` * `os::windows::fs::OpenOptionsExt::share_mode` * `os::windows::fs::OpenOptionsExt::custom_flags` * `os::windows::fs::OpenOptionsExt::attributes` * `os::windows::fs::OpenOptionsExt::security_qos_flags` * `os::unix::fs::OpenOptionsExt::custom_flags` * `sync::Weak::new` * `Default for sync::Weak` * `panic::set_hook` * `panic::take_hook` * `panic::PanicInfo` * `panic::PanicInfo::payload` * `panic::PanicInfo::location` * `panic::Location` * `panic::Location::file` * `panic::Location::line` * `ffi::CStr::from_bytes_with_nul` * `ffi::CStr::from_bytes_with_nul_unchecked` * `ffi::FromBytesWithNulError` * `fs::Metadata::modified` * `fs::Metadata::accessed` * `fs::Metadata::created` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak` * `collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key` * `os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}` * `SocketAddr::is_unnamed` * `SocketAddr::as_pathname` * `UnixStream::connect` * `UnixStream::pair` * `UnixStream::try_clone` * `UnixStream::local_addr` * `UnixStream::peer_addr` * `UnixStream::set_read_timeout` * `UnixStream::set_write_timeout` * `UnixStream::read_timeout` * `UnixStream::write_Timeout` * `UnixStream::set_nonblocking` * `UnixStream::take_error` * `UnixStream::shutdown` * Read/Write/RawFd impls for `UnixStream` * `UnixListener::bind` * `UnixListener::accept` * `UnixListener::try_clone` * `UnixListener::local_addr` * `UnixListener::set_nonblocking` * `UnixListener::take_error` * `UnixListener::incoming` * RawFd impls for `UnixListener` * `UnixDatagram::bind` * `UnixDatagram::unbound` * `UnixDatagram::pair` * `UnixDatagram::connect` * `UnixDatagram::try_clone` * `UnixDatagram::local_addr` * `UnixDatagram::peer_addr` * `UnixDatagram::recv_from` * `UnixDatagram::recv` * `UnixDatagram::send_to` * `UnixDatagram::send` * `UnixDatagram::set_read_timeout` * `UnixDatagram::set_write_timeout` * `UnixDatagram::read_timeout` * `UnixDatagram::write_timeout` * `UnixDatagram::set_nonblocking` * `UnixDatagram::take_error` * `UnixDatagram::shutdown` * RawFd impls for `UnixDatagram` * `{BTree,Hash}Map::values_mut` * `<[_]>::binary_search_by_key` Deprecated: * `StaticCondvar` - this, and all other static synchronization primitives below, are usable today through the lazy-static crate on stable Rust today. Additionally, we'd like the non-static versions to be directly usable in a static context one day, so they're unlikely to be the final forms of the APIs in any case. * `CONDVAR_INIT` * `StaticMutex` * `MUTEX_INIT` * `StaticRwLock` * `RWLOCK_INIT` * `iter::Peekable::is_empty` Closes #27717 Closes #27720 cc #27784 (but encode methods still exist) Closes #30014 Closes #30425 Closes #30449 Closes #31190 Closes #31399 Closes #31767 Closes #32111 Closes #32281 Closes #32312 Closes #32551 Closes #33018
2016-05-09Utilize `Result::unwrap_err` in more places.Corey Farwell-1/+1
2016-05-08Auto merge of #33091 - sanxiyn:unused-trait-import-3, r=nrcbors-1/+0
Warn unused trait imports, rebased Rebase of #30021. Fix #25730.
2016-05-06doc: binding not neededTshepang Lekhonkhobe-2/+1
2016-05-06doc: mut not neededTshepang Lekhonkhobe-1/+1
2016-05-03Remove unused trait imports flagged by lintSeo Sanghyeon-1/+0
2016-05-02libstd: correct the link to functions in io module documentationRyman-2/+2
Currently the link refers to it's own section of the documentation rather than the list of functions generated by rustdoc.
2016-04-14Rollup merge of #32855 - troplin:take-bufread-fix, r=alexcrichtonSteve Klabnik-0/+12
Don't read past limit for in BufRead instance of Take Similar to `Read::read`, `BufRead::fill_buf` impl of `Take` should not call `inner.fill_buf` if the limit is already reached.
2016-04-11std: Stabilize APIs for the 1.9 releaseAlex Crichton-1/+1
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes #27719 cc #27751 (deprecating the `Slice` bits) Closes #27754 Closes #27780 Closes #27809 Closes #27811 Closes #27830 Closes #28050 Closes #29453 Closes #29791 Closes #29935 Closes #30014 Closes #30752 Closes #31262 cc #31398 (still need to deal with `before_exec`) Closes #31405 Closes #31572 Closes #31755 Closes #31756
2016-04-09Don't read past limit for in BufRead instance of TakeTobias Müller-0/+12
2016-04-02Drop the default buffer size to 8KSteven Fackler-1/+1
The 64k capacity was picked by me a couple of years ago in the initial implementation of buffered IO adaptors: https://github.com/rust-lang/rust/pull/9091/files#diff-b131eeef531ad098b32f49695a031008R62. 64K was picked for symmetry with libuv, which we no longer use. 64K is *way* larger than the default size of any other language that I can find. C, C++, and Java default to 8K, and Go defaults to 4K. There have been a variety of issues filed relating to this such as #31885. Closes #31885
2016-03-29Auto merge of #32541 - troplin:chain-bufread, r=alexcrichtonbors-0/+54
Implement BufRead for Chain Addresses #32536
2016-03-28Auto merge of #32461 - mitaa:rdoc-anchors, r=alexcrichtonbors-1/+1
rustdoc: Correct anchor for links to associated trait items fixes #28478 r? @alexcrichton
2016-03-28Fix formattingTobias Müller-2/+5
2016-03-28Use ? instead of try!, add some basic testsTobias Müller-1/+31
2016-03-28Implement BufRead for ChainTobias Müller-0/+21
2016-03-27Extend linkchecker with anchor checkingmitaa-1/+1
This adds checks to ensure that: * link anchors refer to existing id's on the target page * id's are unique within an html document * page redirects are valid
2016-03-24Rollup merge of #32276 - brson:doc, r=alexcrichtonSteve Klabnik-2/+2
doc: Stdin is not writable
2016-03-23doc: Stdin is locked for reads, not writesBrian Anderson-2/+2
2016-03-22try! -> ?Jorge Aparicio-17/+17
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-13Auto merge of #32184 - ollie27:win_stdout, r=alexcrichtonbors-19/+2
Fixup stout/stderr on Windows WriteConsoleW can fail if called with a large buffer so we need to slice any stdout/stderr output. However the current slicing has a few problems: 1. It slices by byte but still expects valid UTF-8. 2. The slicing happens even when not outputting to a console. 3. panic! output is not sliced. This fixes these issues by moving the slice to right before WriteConsoleW and slicing on a char boundary.
2016-03-12std: Clean out deprecated APIsAlex Crichton-185/+0
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that are deprecated in the 1.8 release are sticking around for the rest of this cycle. Some notable changes are: * The `dynamic_lib` module was moved into `rustc_back` as the compiler still relies on a few bits and pieces. * The `DebugTuple` formatter now special-cases an empty struct name with only one field to append a trailing comma.
2016-03-10Fixup stout/stderr on WindowsOliver Middleton-19/+2
WriteConsoleW can fail if called with a large buffer so we need to slice any stdout/stderr output. However the current slicing has a few problems: 1. It slices by byte but still expects valid UTF-8. 2. The slicing happens even when not outputting to a console. 3. panic! output is not sliced. This fixes these issues by moving the slice to right before WriteConsoleW and slicing on a char boundary.
2016-03-10Auto merge of #32107 - Stebalien:partial-write, r=alexcrichtonbors-2/+32
Never return an error after a partial write If LineWriter fails to flush, return the number of bytes written instead of an error. Fixes #32085
2016-03-08std: Funnel read_to_end through to one locationAlex Crichton-2/+10
This pushes the implementation detail of proxying `read_to_end` through to `read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle` implementations on Unix/Windows. This way intermediate layers will also be able to take advantage of this optimized implementation. This commit also adds the optimized implementation for `ChildStdout` and `ChildStderr`.
2016-03-07Add test case for #32085Steven Allen-0/+28
2016-03-07Never return an error after a partial writeSteven Allen-2/+4
If LineWriter fails to flush, return the number of bytes written instead of an error. Fixes #32085
2016-02-27Auto merge of #31914 - bluss:copy-from-slice-everywhere, r=alexcrichtonbors-4/+4
Use .copy_from_slice() where applicable .copy_from_slice() does the same job of .clone_from_slice(), but the former is explicitly for Copy elements and calls `memcpy` directly, and thus is it efficient without optimization too.
2016-02-26Use .copy_from_slice() where applicableUlrik Sverdrup-4/+4
.copy_from_slice() does the same job of .clone_from_slice(), but the former is explicitly for Copy elements and calls `memcpy` directly, and thus is it efficient without optimization too.
2016-02-26Rollup merge of #31904 - bluss:writer-formatter-error, r=alexcrichtonManish Goregaokar-1/+8
Make sure formatter errors are emitted by the default Write::write_fmt Previously, if an error was returned from the formatter that did not originate in an underlying writer error, Write::write_fmt would return successfully even if the formatting did not complete (was interrupted by an `fmt::Error` return). Now we choose to emit an io::Error with kind Other for formatter errors. Since this may reveal error returns from `write!()` and similar that previously passed silently, it's a kind of a [breaking-change]. Fixes #31879
2016-02-26Make sure formatter errors are emitted by the default Write::write_fmtUlrik Sverdrup-1/+8
Previously, if an error was returned from the formatter that did not originate in an underlying writer error, Write::write_fmt would return successfully even if the formatting did not complete (was interrupted by an `fmt::Error` return). Now we choose to emit an io::Error with kind Other for formatter errors. Since this may reveal error returns from `write!()` and similar that previously passed silently, it's a kind of a [breaking-change].
2016-02-23Register new snapshotsAaron Turon-3/+3
2016-01-26Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brsonbors-2/+2
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-26Fix warnings during testsAlex Crichton-2/+2
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
2016-01-25std: Fix some behavior without stdio handlesAlex Crichton-1/+1
On all platforms, reading from stdin where the actual stdin isn't present should return 0 bytes as having been read rather than the entire buffer. On Windows, handle the case where we're inheriting stdio handles but one of them isn't present. Currently the behavior is to fail returning an I/O error but instead this commit corrects it to detecting this situation and propagating the non-set handle. Closes #31167
2016-01-22Auto merge of #31070 - sfackler:bufreader-box-slice, r=alexcrichtonbors-2/+2
Saves a word, and also prevents the impl from accidentally changing the buffer length. r? @alexcrichton
2016-01-20Use a Box<[u8]> in BufReaderSteven Fackler-2/+2
Saves a word, and also prevents the impl from accidentally changing the buffer length.
2016-01-20Don't flush in BufWriter destructor after a panic in writeSteven Fackler-3/+40
We don't want to write the same data twice. Closes #30888
2016-01-16std: Stabilize APIs for the 1.7 releaseAlex Crichton-5/+8
This commit stabilizes and deprecates the FCP (final comment period) APIs for the upcoming 1.7 beta release. The specific APIs which changed were: Stabilized * `Path::strip_prefix` (renamed from `relative_from`) * `path::StripPrefixError` (new error type returned from `strip_prefix`) * `Ipv4Addr::is_loopback` * `Ipv4Addr::is_private` * `Ipv4Addr::is_link_local` * `Ipv4Addr::is_multicast` * `Ipv4Addr::is_broadcast` * `Ipv4Addr::is_documentation` * `Ipv6Addr::is_unspecified` * `Ipv6Addr::is_loopback` * `Ipv6Addr::is_unique_local` * `Ipv6Addr::is_multicast` * `Vec::as_slice` * `Vec::as_mut_slice` * `String::as_str` * `String::as_mut_str` * `<[T]>::clone_from_slice` - the `usize` return value is removed * `<[T]>::sort_by_key` * `i32::checked_rem` (and other signed types) * `i32::checked_neg` (and other signed types) * `i32::checked_shl` (and other signed types) * `i32::checked_shr` (and other signed types) * `i32::saturating_mul` (and other signed types) * `i32::overflowing_add` (and other signed types) * `i32::overflowing_sub` (and other signed types) * `i32::overflowing_mul` (and other signed types) * `i32::overflowing_div` (and other signed types) * `i32::overflowing_rem` (and other signed types) * `i32::overflowing_neg` (and other signed types) * `i32::overflowing_shl` (and other signed types) * `i32::overflowing_shr` (and other signed types) * `u32::checked_rem` (and other unsigned types) * `u32::checked_neg` (and other unsigned types) * `u32::checked_shl` (and other unsigned types) * `u32::saturating_mul` (and other unsigned types) * `u32::overflowing_add` (and other unsigned types) * `u32::overflowing_sub` (and other unsigned types) * `u32::overflowing_mul` (and other unsigned types) * `u32::overflowing_div` (and other unsigned types) * `u32::overflowing_rem` (and other unsigned types) * `u32::overflowing_neg` (and other unsigned types) * `u32::overflowing_shl` (and other unsigned types) * `u32::overflowing_shr` (and other unsigned types) * `ffi::IntoStringError` * `CString::into_string` * `CString::into_bytes` * `CString::into_bytes_with_nul` * `From<CString> for Vec<u8>` * `From<CString> for Vec<u8>` * `IntoStringError::into_cstring` * `IntoStringError::utf8_error` * `Error for IntoStringError` Deprecated * `Path::relative_from` - renamed to `strip_prefix` * `Path::prefix` - use `components().next()` instead * `os::unix::fs` constants - moved to the `libc` crate * `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize * `IntoCow` - conflicts with `Into` and may come back later * `i32::{BITS, BYTES}` (and other integers) - not pulling their weight * `DebugTuple::formatter` - will be removed * `sync::Semaphore` - not used enough and confused with system semaphores Closes #23284 cc #27709 (still lots more methods though) Closes #27712 Closes #27722 Closes #27728 Closes #27735 Closes #27729 Closes #27755 Closes #27782 Closes #27798
2016-01-15Auto merge of #30898 - petrochenkov:tvarfstab, r=alexcrichtonbors-3/+3
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-3/+3
2016-01-14Rollup merge of #30886 - ollie27:docs_links, r=steveklabnikManish Goregaokar-13/+13
r? @steveklabnik
2016-01-13Fix some broken and missing links in the docsOliver Middleton-13/+13
2016-01-12Remove dead `InternalBufWriter` implementationAndrea Canciani-15/+0
In 8d90d3f36871a00023cc1f313f91e351c287ca15 `BufStream`, the only consumer of `InternalBufWriter`, was removed. As implied by the name, this type is private, hence it is currently dead code.
2016-01-02Adjusted heading and created dedicated section in std::io docsNathan-0/+9
2016-01-01Auto merge of #30648 - tshepang:missing-graves, r=steveklabnikbors-2/+2
2015-12-31Auto merge of #30645 - tshepang:grammar, r=steveklabnikbors-2/+2
2015-12-30doc: missed these in a4da9acTshepang Lekhonkhobe-2/+2
2015-12-30doc: fix grammarTshepang Lekhonkhobe-2/+2
2015-12-30doc: add gravesTshepang Lekhonkhobe-23/+23