about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2014-07-02Rename recvfrom -> recv_from, sendto -> send_to.OGINO Masanori-34/+34
POSIX has recvfrom(2) and sendto(2), but their name seem not to be suitable with Rust. We already renamed getpeername(2) and getsockname(2), so I think it makes sense. Alternatively, `receive_from` would be fine. However, we have `.recv()` so I chose `recv_from`. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-06-30libstd: set baseline stability levels.Aaron Turon-0/+1
Earlier commits have established a baseline of `experimental` stability for all crates under the facade (so their contents are considered experimental within libstd). Since `experimental` is `allow` by default, we should use the same baseline stability for libstd itself. This commit adds `experimental` tags to all of the modules defined in `std`, and `unstable` to `std` itself.
2014-06-29auto merge of #15252 : alexcrichton/rust/issue-15231, r=pcwaltonbors-0/+40
When cloning a stream, the data is already guaranteed to be in a consistent state, so there's no need to perform a zeroing. This prevents segfaults as seen in #15231 Closes #15231
2014-06-29librustc: Remove the fallback to `int` for integers and `f64` forPatrick Walton-1/+1
floating point numbers for real. This will break code that looks like: let mut x = 0; while ... { x += 1; } println!("{}", x); Change that code to: let mut x = 0i; while ... { x += 1; } println!("{}", x); Closes #15201. [breaking-change]
2014-06-29rustuv: Don't zero-out data on clonesAlex Crichton-0/+40
When cloning a stream, the data is already guaranteed to be in a consistent state, so there's no need to perform a zeroing. This prevents segfaults as seen in #15231 Closes #15231
2014-06-28auto merge of #15208 : alexcrichton/rust/snapshots, r=pcwaltonbors-2/+2
This change registers new snapshots, allowing `*T` to be removed from the language. This is a large breaking change, and it is recommended that if compiler errors are seen that any FFI calls are audited to determine whether they should be actually taking `*mut T`.
2014-06-28Rename all raw pointers as necessaryAlex Crichton-2/+2
2014-06-28librustc: Match trait self types exactly.Patrick Walton-1/+4
This can break code that looked like: impl Foo for Box<Any> { fn f(&self) { ... } } let x: Box<Any + Send> = ...; x.f(); Change such code to: impl Foo for Box<Any> { fn f(&self) { ... } } let x: Box<Any> = ...; x.f(); That is, upcast before calling methods. This is a conservative solution to #5781. A more proper treatment (see the xfail'd `trait-contravariant-self.rs`) would take variance into account. This change fixes the soundness hole. Some library changes had to be made to make this work. In particular, `Box<Any>` is no longer showable, and only `Box<Any+Send>` is showable. Eventually, this restriction can be lifted; for now, it does not prove too onerous, because `Any` is only used for propagating the result of task failure. This patch also adds a test for the variance inference work in #12828, which accidentally landed as part of DST. Closes #5781. [breaking-change]
2014-06-27std::io: Use re-exported pathes in examples.OGINO Masanori-10/+10
We use re-exported pathes (e.g. std::io::Command) and original ones (e.g. std::io::process::Command) together in examples now. Using re-exported ones consistently avoids confusion. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-21/+21
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-21std: inline many of the Writer/Reader methodsErick Tryzelaar-0/+127
This allows llvm to optimize away much of the overhead from using the MemReader/MemWriters. My benchmarks showed it to shave 15% off of my in progress serialization/json encoding.
2014-06-18Deprecate the bytes!() macro.Simon Sapin-35/+35
Replace its usage with byte string literals, except in `bytes!()` tests. Also add a new snapshot, to be able to use the new b"foo" syntax. The src/etc/2014-06-rewrite-bytes-macros.py script automatically rewrites `bytes!()` invocations into byte string literals. Pass it filenames as arguments to generate a diff that you can inspect, or `--apply` followed by filenames to apply the changes in place. Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-16std: Chunk writing to stdout on windowsAlex Crichton-4/+15
This just takes a similar approach to reading stdin on windows by artificially limiting the size of the buffers going in and out. Closes #14940
2014-06-16auto merge of #14781 : alexcrichton/rust/issue-14724, r=brsonbors-3/+42
* os::pipe() now returns `IoResult<os::Pipe>` * os::pipe() is now unsafe because it does not arrange for deallocation of file descriptors * PipeStream::pair() has been added. This is a safe method to get a pair of pipes. * Dealing with pipes in native process bindings have been improved to be more robust in the face of failure and intermittent errors. This converts a few fail!() situations to Err situations. cc #13538 Closes #14724 [breaking-change]
2014-06-16std: Improve pipe() functionalityAlex Crichton-3/+42
* os::pipe() now returns IoResult<os::Pipe> * os::pipe() is now unsafe because it does not arrange for deallocation of file descriptors * os::Pipe fields are renamed from input to reader and out to write. * PipeStream::pair() has been added. This is a safe method to get a pair of pipes. * Dealing with pipes in native process bindings have been improved to be more robust in the face of failure and intermittent errors. This converts a few fail!() situations to Err situations. Closes #9458 cc #13538 Closes #14724 [breaking-change]
2014-06-16std: Support consuming a Process without waitingAlex Crichton-0/+23
Forking off a child which survives the parent is often a useful task, and is currently not possible because the Process type will invoke `wait()` in its destructor in order to prevent leaking resources. This function adds a new safe method, `forget`, which can be used to consume an instance of `Process` which will then not call `wait` in the destructor. This new method is clearly documented as a leak of resources, but it must be forcibly opted in to. Closes #14467
2014-06-15Register new snapshotsAlex Crichton-20/+20
2014-06-13Rolling up PRs in the queueAlex Crichton-2/+6
Closes #14797 (librustc: Fix the issue with labels shadowing variable names by making) Closes #14823 (Improve error messages for io::fs) Closes #14827 (libsyntax: Allow `+` to separate trait bounds from objects.) Closes #14834 (configure: Don't sync unused submodules) Closes #14838 (Remove typo on collections::treemap::UnionItems) Closes #14839 (Fix the unused struct field lint for struct variants) Closes #14840 (Clarify `Any` docs) Closes #14846 (rustc: [T, ..N] and [T, ..N+1] are not the same) Closes #14847 (Audit usage of NativeMutex) Closes #14850 (remove unnecessary PaX detection) Closes #14856 (librustc: Take in account mutability when casting array to raw ptr.) Closes #14859 (librustc: Forbid `transmute` from being called on types whose size is) Closes #14860 (Fix `quote_pat!` & parse outer attributes in `quote_item!`)
2014-06-13std: Rebase better errors on masterAlex Crichton-7/+11
2014-06-13Improve error messages for io::fsYehuda Katz-64/+244
2014-06-11rustc: Remove ~[T] from the languageAlex Crichton-27/+26
The following features have been removed * box [a, b, c] * ~[a, b, c] * box [a, ..N] * ~[a, ..N] * ~[T] (as a type) * deprecated_owned_vector lint All users of ~[T] should move to using Vec<T> instead.
2014-06-09std: adjust the TCP io doc example to work reliably.Huon Wilson-1/+6
Fixes #11576 by making the code never run (and hence never pass when the test was marked `should_fail`).
2014-06-09auto merge of #14709 : alexcrichton/rust/collections, r=brsonbors-8/+8
This is mostly just a cosmetic change, continuing the work from #14333.
2014-06-08core: Rename `container` mod to `collections`. Closes #12543Brian Anderson-8/+8
Also renames the `Container` trait to `Collection`. [breaking-change]
2014-06-08auto merge of #14765 : rapha/rust/master, r=alexcrichtonbors-22/+23
2014-06-09Converted PortReader and ChanWriter to use Vec.Raphael Speyer-22/+23
2014-06-08Fix spelling errors in comments.Joseph Crail-6/+6
2014-06-08std::io: expand the oneshot/periodic docs.Huon Wilson-8/+68
Examples! Fixes #14714.
2014-06-06libs: Fix miscellaneous fallout of librustrtAlex Crichton-3/+5
2014-06-06std: Deal with fallout of rtio changesAlex Crichton-165/+400
2014-06-06rtio: Remove usage of `Path`Alex Crichton-2/+6
The rtio interface is a thin low-level interface over the I/O subsystems, and the `Path` type is a little too high-level for this interface.
2014-06-05auto merge of #14568 : erickt/rust/slice-update, r=alexcrichtonbors-0/+49
This PR adds two features to make it possible to transform an `Iterator<u8>` into a `Reader`. The first patch adds a method to mutable slices that allows it to be updated with an `Iterator<T>` without paying for the bounds cost. The second adds a Iterator adaptor, `IterReader`, to provide that `Reader` interface. I had two questions. First, are these named the right things? Second, should `IterReader` instead wrap an `Iterator<Result<u8, E>>`? This would allow you to `IterReader::new(rdr.bytes())`, which could be useful if you want to apply some iterator transformations on a reader while still exporting the Reader interface, but I'd expect there'd be a lot of overhead annotating each byte with an error result.
2014-06-03std: Remove generics from Option::expectAlex Crichton-1/+0
This commit removes the <M: Any + Send> type parameter from Option::expect in favor of just taking a hard-coded `&str` argument. This allows this function to move into libcore. Previous code using strings with `expect` will continue to work, but code using this implicitly to transmit task failure will need to unwrap manually with a `match` statement. [breaking-change] Closes #14008
2014-06-02std: add `IterReader` to adapt iterators into readersErick Tryzelaar-0/+49
2014-06-01std: Drop Total from Total{Eq,Ord}Alex Crichton-4/+4
This completes the last stage of the renaming of the comparison hierarchy of traits. This change renames TotalEq to Eq and TotalOrd to Ord. In the future the new Eq/Ord will be filled out with their appropriate methods, but for now this change is purely a renaming change. [breaking-change]
2014-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-10/+10
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-05-28std: Remove format_strbuf!()Alex Crichton-14/+13
This was only ever a transitionary macro.
2014-05-27std: Rename strbuf operations to stringRicho Healey-28/+28
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-1/+1
2014-05-25libstd: Remove unnecessary re-exports under std::stdKevin Ballard-3/+3
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-9/+9
[breaking-change]
2014-05-23std: Move running_on_valgrind to rt::util. #1457Brian Anderson-1/+1
[breaking-change]
2014-05-22auto merge of #14357 : huonw/rust/spelling, r=pnkfelixbors-7/+7
The span on a inner doc-comment would point to the next token, e.g. the span for the `a` line points to the `b` line, and the span of `b` points to the `fn`. ```rust //! a //! b fn bar() {} ```
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-7/+8
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-124/+144
2014-05-22Spelling/doc formatting fixes.Huon Wilson-7/+7
2014-05-20Add .isatty() method to StdReaderKevin Ballard-0/+10
StdWriter has .isatty(). StdReader can trivially vend the same function, and someone asked today on IRC how to call isatty() on stdin.
2014-05-16rustc: Stop leaking enum variants into childrenAlex Crichton-3/+3
This plugs a leak where resolve was treating enums defined in parent modules as in-scope for all children modules when resolving a pattern identifier. This eliminates the code path in resolve entirely. If this breaks any existing code, then it indicates that the variants need to be explicitly imported into the module. Closes #14221 [breaking-change]
2014-05-15core: Update all tests for fmt movementAlex Crichton-2/+2
2014-05-15Updates with core::fmt changesAlex Crichton-16/+14
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.