about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2015-11-09std: Migrate to the new libcAlex Crichton-3/+2
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself * Update all references to use `libc` as a result. * Update all references to the new flat namespace. * Moves all windows bindings into sys::c
2015-11-06Auto merge of #29643 - petrochenkov:stability5, r=alexcrichtonbors-1/+0
Also remove `stable` stability annotations from inherent impls (There will be a warning for useless stability annotations soon.) r? @Gankro
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-1/+0
Remove `stable` stability annotations from inherent impls
2015-10-31std: Prevent print panics when using TLSAlex Crichton-8/+26
Currently if a print happens while a thread is being torn down it may cause a panic if the LOCAL_STDOUT TLS slot has been destroyed by that point. This adds a guard to check and prints to the process stdout if that's the case (as we do for if the slot is already borrowed). Closes #29488
2015-10-25std: Stabilize library APIs for 1.5Alex Crichton-0/+1
This commit stabilizes and deprecates library APIs whose FCP has closed in the last cycle, specifically: Stabilized APIs: * `fs::canonicalize` * `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists, is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait. * `Formatter::fill` * `Formatter::width` * `Formatter::precision` * `Formatter::sign_plus` * `Formatter::sign_minus` * `Formatter::alternate` * `Formatter::sign_aware_zero_pad` * `string::ParseError` * `Utf8Error::valid_up_to` * `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}` * `<[T]>::split_{first,last}{,_mut}` * `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated but will be once 1.5 is released. * `str::{R,}MatchIndices` * `str::{r,}match_indices` * `char::from_u32_unchecked` * `VecDeque::insert` * `VecDeque::shrink_to_fit` * `VecDeque::as_slices` * `VecDeque::as_mut_slices` * `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`) * `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`) * `Vec::resize` * `str::slice_mut_unchecked` * `FileTypeExt` * `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}` * `BinaryHeap::from` - `from_vec` deprecated in favor of this * `BinaryHeap::into_vec` - plus a `Into` impl * `BinaryHeap::into_sorted_vec` Deprecated APIs * `slice::ref_slice` * `slice::mut_ref_slice` * `iter::{range_inclusive, RangeInclusive}` * `std::dynamic_lib` Closes #27706 Closes #27725 cc #27726 (align not stabilized yet) Closes #27734 Closes #27737 Closes #27742 Closes #27743 Closes #27772 Closes #27774 Closes #27777 Closes #27781 cc #27788 (a few remaining methods though) Closes #27790 Closes #27793 Closes #27796 Closes #27810 cc #28147 (not all parts stabilized)
2015-10-21Fix doc sample for CursorWesley Wiser-1/+1
Fixes #29219
2015-10-17Fix minor issues with std::io docsKevin Yap-7/+7
2015-10-14Remove unnecessary parentheses around range expressionsAndrew Paseltiner-4/+4
2015-10-14fix tidyManish Goregaokar-1/+1
2015-10-14fix link on std::result::ResultVladimir Rutsky-3/+2
The link is broken here: <https://doc.rust-lang.org/std/io/#types>. Looks like crate documentation generator uses only first paragraph of the module documentation and so doesn't resolve the link defined below.
2015-10-09Auto merge of #27897 - sfackler:cursor-box-slice, r=alexcrichtonbors-0/+57
2015-10-09Implement Read, BufRead, Write and Seek for Cursor<Box<[u8]>>Steven Fackler-0/+57
2015-10-08Auto merge of #28900 - cristicbz:typos, r=alexcrichtonbors-6/+6
I found these automatically, but fixed them manually to ensure the semantics are correct. I know things like these are hardly important, since they only marginally improve clarity. But at least for me typos and simple grammatical errors trigger an---unjustified---sense of unprofessionalism, despite the fact that I make them all the time and I understand that they're the sort of thing that is bound to slip through review. Anyway, to find most of these I used: * `ag '.*//.*(\b[A-Za-z]{2,}\b) \1\b'` for repeated words * `ag '\b(the|this|those|these|a|it) (a|the|this|those|these|it)\b'` to find constructs like 'the this' etc. many false positives, but not too hard to scroll through them to actually find the mistakes. * `cat ../../typos.txt | paste -d'|' - - - - - - - - - - - - - - - - - - - - - - | tr '\n' '\0' | xargs -0 -P4 -n1 ag`. Hacky way to find misspellings, but it works ok. I got `typos.txt` from [Wikipedia](https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines) * `ag '.*//.* a ([ae][a-z]|(o[^n])|(i[a-rt-z]))'` to find places where 'a' was followed by a vowel (requiring 'an' instead). I also used a handful more one off regexes that are too boring to reproduce here.
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-6/+6
2015-10-02Use generic trait implementations for Cursor when possible.nwin-49/+25
2015-09-30Make note of performance implications of ReadSteve Klabnik-0/+7
Fixes #28073
2015-09-14Auto merge of #28256 - petrochenkov:conv, r=alexcrichtonbors-1/+5
This patch transforms functions of the form ``` fn f<Generic: AsRef<Concrete>>(arg: Generic) { let arg: &Concrete = arg.as_ref(); // Code using arg } ``` to the next form: ``` #[inline] fn f<Generic: AsRef<Concrete>>(arg: Generic) { fn f_inner(arg: &Concrete) { // Code using arg } f_inner(arg.as_ref()); } ``` Therefore, most of the code is concrete and not duplicated during monomorphisation (unless inlined) and only the tiny bit of conversion code is duplicated. This method was mentioned by @aturon in the Conversion Traits RFC (https://github.com/rust-lang/rfcs/blame/master/text/0529-conversion-traits.md#L249) and similar techniques are not uncommon in C++ template libraries. This patch goes to the extremes and applies the transformation even to smaller functions<sup>1</sup> for purity of the experiment. *Some of them can be rolled back* if considered too ridiculous. <sup>1</sup> However who knows how small are these functions are after inlining and everything. The functions in question are mostly `fs`/`os` functions and not used especially often with variety of argument types, so the code size reduction is rather small (but consistent). Here are the sizes of stage2 artifacts before and after the patch: https://gist.github.com/petrochenkov/e76a6b280f382da13c5d https://gist.github.com/petrochenkov/6cc28727d5256dbdfed0 Note: All the `inner` functions are concrete and unavailable for cross-crate inlining, some of them may need `#[inline]` annotations in the future. r? @aturon
2015-09-11std: Internalize almost all of `std::rt`Alex Crichton-2/+2
This commit does some refactoring to make almost all of the `std::rt` private. Specifically, the following items are no longer part of its API: * DEFAULT_ERROR_CODE * backtrace * unwind * args * at_exit * cleanup * heap (this is just alloc::heap) * min_stack * util The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is an entry point for the `panic!` macro via the `begin_unwind` and `begin_unwind_fmt` reexports.
2015-09-09Reduce code bloat from conversion traits in function parametersVadim Petrochenkov-1/+5
2015-09-08some more clippy-based improvementsAndre Bogus-4/+4
2015-09-03std: Account for CRLF in {str, BufRead}::linesAlex Crichton-4/+7
This commit is an implementation of [RFC 1212][rfc] which tweaks the behavior of the `str::lines` and `BufRead::lines` iterators. Both iterators now account for `\r\n` sequences in addition to `\n`, allowing for less surprising behavior across platforms (especially in the `BufRead` case). Splitting *only* on the `\n` character can still be achieved with `split('\n')` in both cases. The `str::lines_any` function is also now deprecated as `str::lines` is a drop-in replacement for it. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1212-line-endings.md Closes #28032
2015-09-03Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T`Vadim Petrochenkov-1/+2
2015-08-30Auto merge of #27588 - cesarb:read_all, r=alexcrichtonbors-0/+140
This implements the proposed "read_exact" RFC (https://github.com/rust-lang/rfcs/pull/980). Tracking issue: https://github.com/rust-lang/rust/issues/27585
2015-08-28Add issue number to read_exact unstable declarationsCesar Eduardo Barros-2/+2
2015-08-24Implement read_exact for the Read traitCesar Eduardo Barros-0/+140
This implements the proposed "read_exact" RFC (https://github.com/rust-lang/rfcs/pull/980).
2015-08-19Improve std::io::ErrorKindSteve Klabnik-0/+3
Hopefully make this distinction a little more clear. Fixes #27637
2015-08-18Remove repetition in Seek::seek() docRemi Rampin-3/+0
2015-08-15std: Add issues to all unstable featuresAlex Crichton-16/+32
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-149/+2
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-08-11rollup merge of #27679: durka/patch-5Alex Crichton-4/+4
I'm not 100% sure lines 63 and 73 are typos.
2015-08-11correct copy/paste typos in stdio.rs commentsAlex Burka-4/+4
I'm not 100% sure lines 63 and 73 are typos.
2015-08-11Register new snapshotsAlex Crichton-9/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-10Auto merge of #27531 - bluss:io-copy-dst, r=alexcrichtonbors-2/+14
std: Allow ?Sized parameters in std::io::copy
2015-08-10std: Allow ?Sized parameters in std::io::copyUlrik Sverdrup-2/+14
std::io::copy did not allow passing trait objects directly (only with an extra &mut wrapping).
2015-08-03syntax: Implement #![no_core]Alex Crichton-2/+5
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-08-02Docs: clarify return value of std::io::Seek::seekSimon Sapin-2/+3
2015-07-31Auto merge of #27370 - alexcrichton:stabilize-easy, r=brsonbors-9/+6
The following APIs were all marked with a `#[stable]` tag: * process::Child::id * error::Error::is * error::Error::downcast * error::Error::downcast_ref * error::Error::downcast_mut * io::Error::get_ref * io::Error::get_mut * io::Error::into_inner * hash::Hash::hash_slice * hash::Hasher::write_{i,u}{8,16,32,64,size}
2015-07-31Auto merge of #26897 - RalfJung:stdin-mut, r=alexcrichtonbors-1/+1
This fixes #26890. To be honest, the local compile-test is still running. This just takes so long. But this looks trivial enough...
2015-07-29Rollup merge of #27345 - killercup:patch-15, r=alexcrichtonSteve Klabnik-4/+2
The first paragraph of the docs of the Cursor struct ([src](https://github.com/rust-lang/rust/blob/ff6c6ce917bd6af9c5d9315708ae6be3ba0b7e91/src/libstd/io/cursor.rs#L18-L21)) contains a Markdown link. In listings (like <http://doc.rust-lang.org/nightly/std/io/>), this won't get rendered: ![std__io_-_rust](https://cloud.githubusercontent.com/assets/20063/8925843/5c5281a8-350b-11e5-8c63-09a369d746b0.png) The hotfix would be to change the link by reference: ```rust /// A `Cursor` wraps another type and provides it with a [`Seek`][seek] /// implementation. /// /// [seek]: trait.Seek.html ``` to a direct link: ```rust /// A `Cursor` wraps another type and provides it with a /// [`Seek`](trait.Seek.html) implementation. ``` _I have not tested this as I don't have access to a machine for compiling Rust right now._ (This seems to be a more general issue, but I think I have seen this mentioned before. This PR is just to hotfix on particular occurrence. Rustdoc seems to only read the first paragraph of a doc string for the description in index pages, and _after that_ convert Markdown to HTML.) r? @steveklabnik
2015-07-29Rollup merge of #27342 - steveklabnik:fix_links, r=alexcrichtonSteve Klabnik-2/+2
How embarassing :sob: r? @alexcrichton
2015-07-29Rollup merge of #27341 - steveklabnik:remove_warning, r=alexcrichtonSteve Klabnik-4/+0
This isn't a standard header, and the other docs don't use it, so let's remove it.
2015-07-29Rollup merge of #27327 - steveklabnik:fix_take, r=alexcrichtonSteve Klabnik-1/+1
This only reads five bytes, so don't use a ten byte buffer, that's confusing. r? @alexcrichton
2015-07-28std: Stabilize a number of small APIsAlex Crichton-9/+6
The following APIs were all marked with a `#[stable]` tag: * process::Child::id * error::Error::is * error::Error::downcast * error::Error::downcast_ref * error::Error::downcast_mut * io::Error::get_ref * io::Error::get_mut * io::Error::into_inner * hash::Hash::hash_slice * hash::Hasher::write_{i,u}{8,16,32,64,size}
2015-07-28IO Docs: Fix Link in Cursor descriptionPascal Hertleif-4/+2
The first paragraph of the docs of the Cursor struct contains a Markdown link. In listings, this won't get rendered. (Rustdoc seems to split off the first paragraph and after that convert Markdown to HTML.)
2015-07-27fix two linksSteve Klabnik-2/+2
How embarassing :sob:
2015-07-27Remove warning header for consistencySteve Klabnik-4/+0
This isn't a standard header, and the other docs don't use it, so let's remove it.
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-2/+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-27Fix buffer length in std::io::takeSteve Klabnik-1/+1
This only reads five bytes, so don't use a ten byte buffer, that's confusing.
2015-07-22Rollup merge of #27170 - steveklabnik:doc_std_io_intoinnererror, r=alexcrichtonSteve Klabnik-1/+73
Mostly adding examples. r? @alexcrichton
2015-07-22Rollup merge of #27167 - steveklabnik:doc_std_io_take, r=alexcrichtonSteve Klabnik-2/+8
Better and more consistent links to their creators.