about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2016-10-11Add missing urls in io moduleGuillaume Gomez-32/+37
2016-10-05Fixed small typo in `BufRead` commentsRazican-1/+1
`BufRead` comments, in the `Seek` trait implementation, was talking about allocating 8 *ebibytes*. It was a typo, the correct unit is *exbibytes*, since *ebibytes* don't even exist. The calculation is correct, though.
2016-10-04Rollup merge of #36938 - tmiasko:cursor-seek-overflow, r=alexcrichtonManish Goregaokar-7/+18
Check for overflow in Cursor<Vec<u8>>::write. Ensure that cursor position fits into usize, before proceeding with write. Fixes issue #36884.
2016-10-04Rollup merge of #36916 - frewsxcv:patch-1, r=alexcrichtonManish Goregaokar-1/+1
Update unstable attr to reference tracking issue.
2016-10-03Check for overflow in Cursor<Vec<u8>>::write.Tomasz Miąsko-7/+18
Ensure that cursor position fits into usize, before proceeding with write. Fixes issue #36884.
2016-10-02Update unstable attr to reference tracking issue.Corey Farwell-1/+1
2016-10-01std: Move platform specific stdio code into sysBrian Anderson-5/+2
2016-09-30Auto merge of #36339 - brson:emscripten-new, r=alexcrichtonbors-4/+8
Working asmjs and wasm targets This patch set results in a working standard library for the asmjs-unknown-emscripten and wasm32-unknown-emscripten targets. It is based on the work of @badboy and @rschulman. It does a few things: - Updates LLVM with the emscripten [fastcomp](https://github.com/rust-lang/llvm/pull/50) patches, which include the pnacl IR legalizer and the asm.js backend. This patch is thought not to have any significant effect on existing targets. - Teaches rustbuild to correctly link C code with emscripten - Updates gcc-rs to work correctly with emscripten - Teaches rustbuild to run crate tests for emscripten with node - Modifies Thread::new to return an error on emscripten, to facilitate debugging a common failure mode - Modifies libtest to run in single-threaded mode for emscripten - Ignores a host of tests that don't work yet, mostly dealing with threads and I/O - Updates libc with wasm32 definitions (presently the same as asmjs) - Adds a wasm32-unknown-emscripten target that feeds the output of LLVM's asmjs backend through emcc to generate wasm Notes and caveats: - This is only known to work with `--enable-rustbuild`. - The wasm32 target can't be tested correctly yet because of issues in compiletest and limitations in node https://github.com/kripken/emscripten/issues/4542, but hello.rs does seem to work when run on node via the binaryen interpreter - This requires an up to date installation of the emscripten sdk from its incoming branch - Unwinding is very broken - When enabling the emscripten targets jemalloc is disabled for all targets, which results in test failures for the host Next steps are to fix the jemalloc issue, start building the two emscripten targets on the auto builders, then start producing nightlies. https://github.com/rust-lang/rust/issues/36317 tracks work on this. Fixes https://github.com/rust-lang/rust/issues/36515 Fixes https://github.com/rust-lang/rust/issues/36515 Fixes https://github.com/rust-lang/rust/issues/36356
2016-09-30Change the sigs of set_print/set_panic to allow restoring the default objectsBrian Anderson-4/+4
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+4
2016-09-30Fix BufRead::{read_until, read_line} documentation.Tomasz Miąsko-7/+3
2016-09-27[std::io::Chain] Mark first as done only when reading into non-zero length ↵Tomasz Miąsko-1/+12
buffer. Fixes #36771.
2016-09-21Fix outdated Doc Comment on BufReader::seekChristopher Serr-2/+2
A long time ago non-panicking `unwrap` methods were renamed to `into_inner` in this Pull Request: https://github.com/rust-lang/rust/pull/19149 Looks like this doc comment was not updated however.
2016-09-13Rollup merge of #36397 - SuperFluffy:bufwriter_unnecessary_cmp, r=aturonGuillaume Gomez-2/+1
Remove unnecessary `cmp::min` from BufWriter::write The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.
2016-09-12Auto merge of #36019 - frewsxcv:take-into-inner, r=alexcrichtonbors-0/+27
Introduce `into_inner` method on `std::io::Take`. https://github.com/rust-lang/rust/issues/23755
2016-09-11Remove unnecessary `cmp::min` from BufWriter::writeRichard Janis Goldschmidt-2/+1
The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.
2016-08-31Rollup merge of #35911 - tbu-:pr_io_errorkind_traits, r=alexcrichtonJonathan Turner-2/+3
Implement more traits for `std::io::ErrorKind` This makes it possible to use it as key in various maps.
2016-08-26Introduce `into_inner` method on `std::io::Take`.Corey Farwell-0/+27
https://github.com/rust-lang/rust/issues/23755
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-26/+0
2016-08-24Restore old ordering of `io::ErrorKind`sTobias Bucher-3/+4
2016-08-23Implement more traits for `std::io::ErrorKind`Tobias Bucher-6/+6
This makes it possible to use it as key in various maps.
2016-08-18Fix linksNick Cameron-3/+3
2016-07-30Add urls in std::io typesGuillaume Gomez-2/+14
2016-07-30Add io::Take doc exampleGuillaume Gomez-0/+18
2016-07-30Add doc example for StdoutGuillaume Gomez-0/+15
2016-07-30Add doc example for StdinGuillaume Gomez-0/+15
2016-07-30Add doc example for io::StderrGuillaume Gomez-0/+15
2016-07-29Add io::Error doc examplesGuillaume Gomez-0/+145
2016-07-19Auto merge of #33974 - habnabit:eintr-retry-for-read-iterators, r=alexcrichtonbors-11/+18
Retry on EINTR in Bytes and Chars. >Since Bytes and Chars called directly into Read::read, they didn't use any of the retrying wrappers. This allows both iterator types to retry.
2016-07-09Auto merge of #34717 - frewsxcv:sink, r=apasel422bors-2/+2
Remove unnecessarily mutable reference in doc example. None
2016-07-07Remove unnecessarily mutable reference in doc example.Corey Farwell-2/+2
2016-07-06Add doc examples for `io::Error::from_raw_os_error`.Corey Farwell-0/+24
2016-06-28Rollup merge of #34524 - frewsxcv:std-io-sink, r=GuillaumeGomezGuillaume Gomez-0/+10
Add doc example for `std::io::sink`. None
2016-06-28Rollup merge of #34518 - frewsxcv:io-repeat, r=GuillaumeGomezGuillaume Gomez-0/+10
Add doc example for `std::io::repeat`. None
2016-06-28Add doc example for `std::io::sink`.Corey Farwell-0/+10
2016-06-27Minor rewrite of `std::io::empty` doc example.Corey Farwell-6/+3
Remove unnecessary hidden `foo` function. Demonstrate this emptiness of the resulting string. Combine imports.
2016-06-27Add doc example for `std::io::repeat`.Corey Farwell-0/+10
2016-05-30Retry on EINTR in Bytes and Chars.Aaron Gallagher-11/+18
Since Bytes and Chars called directly into Read::read, they didn't use any of the retrying wrappers. This allows both iterator types to retry.
2016-05-27Inline simple Cursor write callsJamey Sharp-0/+2
Implementing the Write trait for Cursors over slices is so light-weight that under some circumstances multiple writes can be fused into a single instruction. In general I think inlining these functions is a good idea because most of the code can be constant-folded and copy-propagated away. Closes issue #33916.
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