about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2014-09-08auto merge of #16952 : alexcrichton/rust/windows-large-console-write, r=brsonbors-1/+8
I've found that 64k is still too much and continue to see the errors as reported in #14940. I've locally found that 32k fails, and 24k succeeds, so I've trimmed the size down to 10000 which the included links in the added comment end up recommending. It sounds like the limit can still be hit with many threads in play, but I have yet to reproduce this, so I figure we can wait until that's hit (if it's possible) and then take action.
2014-09-08std: Turn down the stdout chunk sizeAlex Crichton-1/+8
I've found that 64k is still too much and continue to see the errors as reported in #14940. I've locally found that 32k fails, and 24k succeeds, so I've trimmed the size down to 8192 which libuv happens to use as well. It sounds like the limit can still be hit with many threads in play, but I have yet to reproduce this, so I figure we can wait until that's hit (if it's possible) and then take action.
2014-09-07Register snapshots.Huon Wilson-16/+0
Closes #16880.
2014-09-06auto merge of #16907 : SimonSapin/rust/tempdir-result, r=huonwbors-9/+13
This allows using `try!()` [breaking-change] Fixes #16875
2014-09-05auto merge of #16843 : bkoropoff/rust/reader-writer-box, r=alexcrichtonbors-0/+16
Cargo needs this to be able to instantiate `TerminfoTerminal<Box<Writer+'a>>` for 'a other than 'static.
2014-09-04auto merge of #16986 : bjz/rust/bitflags, r=alexcrichtonbors-12/+12
Closes #16469
2014-09-04auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, ↵bors-1/+1
r=alexcrichton I corrected spelling and capitalization errors in comments and strings.
2014-09-05Use {} for bitflags! definition and invocationsBrendan Zabarauskas-12/+12
This looks nicer because it reflects Rust's other syntactic structures.
2014-09-04auto merge of #16976 : treeman/rust/issue-16943, r=kballardbors-2/+23
Closes #16943.
2014-09-04Print file permissions with 4 digits.Jonas Hietala-10/+10
2014-09-03Fix spelling errors and capitalization.Joseph Crail-1/+1
2014-09-03Print file permissions in octal form.Jonas Hietala-2/+23
Closes #16943.
2014-09-03Remove cross-borrowing for traits.Nick Cameron-1/+1
Closes #15349 [breaking-change] Trait objects are no longer implicitly coerced from Box<T> to &T. You must make an explicit coercion using `&*`.
2014-08-31Have std::io::TempDir::new and new_in return IoResultSimon Sapin-9/+13
This allows using `try!()` [breaking-change] Fixes #16875
2014-08-29Register new snapshotsAlex Crichton-111/+0
2014-08-29Relax lifetime bounds on Reader/Writer impls for trait boxesBrian Koropoff-0/+16
Cargo needs this to be able to instantiate `TerminfoTerminal<Box<Writer+'a>>` for 'a other than 'static.
2014-08-28auto merge of #16664 : aturon/rust/stabilize-option-result, r=alexcrichtonbors-4/+4
Per API meeting https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-13.md # Changes to `core::option` Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues. However, a few methods have been deprecated, either due to lack of use or redundancy: * `take_unwrap`, `get_ref` and `get_mut_ref` (redundant, and we prefer for this functionality to go through an explicit .unwrap) * `filtered` and `while` * `mutate` and `mutate_or_set` * `collect`: this functionality is being moved to a new `FromIterator` impl. # Changes to `core::result` Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues. * `collect`: this functionality is being moved to a new `FromIterator` impl. * `fold_` is deprecated due to lack of use * Several methods found in `core::option` are added here, including `iter`, `as_slice`, and variants. Due to deprecations, this is a: [breaking-change]
2014-08-28auto merge of #16626 : ruud-v-a/rust/duration-reform, r=brsonbors-3/+3
This changes the internal representation of `Duration` from days: i32, secs: i32, nanos: u32 to secs: i64, nanos: i32 This resolves #16466. Note that `nanos` is an `i32` and not `u32` as suggested, because `i32` is easier to deal with, and it is not exposed anyway. Some methods now take `i64` instead of `i32` due to the increased range. Some methods, like `num_milliseconds`, now return an `Option<i64>` instead of `i64`, because the range of `Duration` is now larger than e.g. 2^63 milliseconds. A few remarks: - Negating `MIN` is impossible. I chose to return `MAX` as `-MIN`, but it is one nanosecond less than the actual negation. Is this the desired behaviour? - In `std::io::timer`, some functions accept a `Duration`, which is internally converted into a number of milliseconds. However, the range of `Duration` is now larger than 2^64 milliseconds. There is already a FIXME in the file that this should be addressed (without a ticket number though). I chose to silently use 0 ms if the duration is too long. Is that right, as long as the backend still uses milliseconds? - Negative durations are not formatted correctly, but they were not formatted correctly before either.
2014-08-28Fallout from stabilizing core::optionAaron Turon-4/+4
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-9/+121
2014-08-26Use temp vars for implicit coercion to ^[T]Nick Cameron-43/+73
2014-08-24native: clone/close_accept for win32 pipesAlex Crichton-2/+3
This commits takes a similar strategy to the previous commit to implement close_accept and clone for the native win32 pipes implementation. Closes #15595
2014-08-24native: Implement clone/close_accept for unixAlex Crichton-0/+227
This commits implements {Tcp,Unix}Acceptor::{clone,close_accept} methods for unix. A windows implementation is coming in a later commit. The clone implementation is based on atomic reference counting (as with all other clones), and the close_accept implementation is based on selecting on a self-pipe which signals that a close has been seen.
2014-08-23Complete renaming of win32 to windowsVadim Chugunov-1/+1
2014-08-21libstd: Limit Duration range to i64 milliseconds.Ruud van Asseldonk-15/+3
This enables `num_milliseconds` to return an `i64` again instead of `Option<i64>`, because it is guaranteed not to overflow. The Duration range is now rougly 300e6 years (positive and negative), whereas it was 300e9 years previously. To put these numbers in perspective, 300e9 years is about 21 times the age of the universe (according to Wolfram|Alpha). 300e6 years is about 1/15 of the age of the earth (according to Wolfram|Alpha).
2014-08-20Add #[repr(C)] to all the things!Corey Richardson-0/+1
2014-08-20libstd: Refactor Duration.Ruud van Asseldonk-6/+18
This changes the internal representation of `Duration` from days: i32, secs: i32, nanos: u32 to secs: i64, nanos: i32 This resolves #16466. Some methods now take `i64` instead of `i32` due to the increased range. Some methods, like `num_milliseconds`, now return an `Option<i64>` instead of `i64`, because the range of `Duration` is now larger than e.g. 2^63 milliseconds.
2014-08-18Explain EOF behavior in File.eof().Steve Klabnik-1/+6
Fies #16239.
2014-08-17auto merge of #16498 : Kimundi/rust/inline-utf-encoding, r=alexcrichtonbors-1/+1
The first commit improves code generation through a few changes: - The `#[inline]` attributes allow llvm to constant fold the encoding step away in certain situations. For example, code like this changes from a call to `encode_utf8` in a inner loop to the pushing of a byte constant: ```rust let mut s = String::new(); for _ in range(0u, 21) { s.push_char('a'); } ``` - Both methods changed their semantic from causing run time failure if the target buffer is not large enough to returning `None` instead. This makes llvm no longer emit code for causing failure for these methods. - A few debug `assert!()` calls got removed because they affected code generation due to unwinding, and where basically unnecessary with today's sound handling of `char` as a Unicode scalar value. ~~The second commit is optional. It changes the methods from regular indexing with the `dst[i]` syntax to unsafe indexing with `dst.unsafe_mut_ref(i)`. This does not change code generation directly - in both cases llvm is smart enough to see that there can never be an out-of-bounds access. But it makes it emit a `nounwind` attribute for the function. However, I'm not sure whether that is a real improvement, so if there is any objection to this I'll remove the commit.~~ This changes how the methods behave on a too small buffer, so this is a [breaking-change]
2014-08-16librustc: Forbid external crates, imports, and/or items from beingPatrick Walton-9/+1
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
2014-08-16Optimized IR generation for UTF-8 and UTF-16 encodingMarvin Löbel-1/+1
- Both can now be inlined and constant folded away - Both can no longer cause failure - Both now return an `Option` instead Removed debug `assert!()`s over the valid ranges of a `char` - It affected optimizations due to unwinding - Char handling is now sound enought that they became uneccessary
2014-08-14std::io::util cleanup + fixesSteven Fackler-18/+38
* Fix `LimitReader`'s `Buffer::consume` impl to avoid limit underflow * Make `MultiWriter` fail fast instead of always running through each `Writer`. This may or may not be what we want, but it at least doesn't throw any errors encountered in later `Writer`s into oblivion. * Prevent `IterReader`'s `Reader::read` impl from returning EOF if given an empty buffer. [breaking-change]
2014-08-14auto merge of #16332 : brson/rust/slicestab, r=aturonbors-11/+11
This implements some of the recommendations from https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-06.md. Explanation in commits.
2014-08-13std: Fix build errorsBrian Anderson-2/+2
2014-08-13std: Make connect_timeout return Err on zero durationBrian Anderson-12/+16
[breaking-change]
2014-08-13Fix various fallout from timer changesBrian Anderson-9/+16
2014-08-13std: connect_timeout requires a positive DurationBrian Anderson-9/+27
This is only breaking if you were previously specifying a duration of zero for some mysterious reason. [breaking-change]
2014-08-13std: Make the TCP/UDP connect_timeout methods take DurationBrian Anderson-16/+24
[breaking-change]
2014-08-13std: Clarify what timers do with zero and negative durationsBrian Anderson-16/+83
Add tests. Also fix a bunch of broken time tests.
2014-08-13std: Restore missing timer examplesBrian Anderson-0/+52
2014-08-13std: Remove ms-taking methods from timersBrian Anderson-172/+49
2014-08-13std: Update Duration from upstreamBrian Anderson-25/+9
From rust-chrono 4f34003e03e259bd5cbda0cb4d35325861307cc6
2014-08-13std: Add sleep, oneshot and periodic timers, taking DurationBrian Anderson-0/+97
2014-08-13std: Rename sleep, periodic, and oneshot timers to sleep_ms, etc.Brian Anderson-55/+55
Rename io::timer::sleep, Timer::sleep, Timer::oneshot, Timer::periodic, to sleep_ms, oneshot_ms, periodic_ms. These functions all take an integer and interpret it as milliseconds. Replacement functions will be added that take Duration. [breaking-change]
2014-08-13std: Rename slice::Vector to SliceBrian Anderson-3/+3
This required some contortions because importing both raw::Slice and slice::Slice makes rustc crash. Since `Slice` is in the prelude, this renaming is unlikely to casue breakage. [breaking-change]
2014-08-13std: Rename various slice traits for consistencyBrian Anderson-11/+11
ImmutableVector -> ImmutableSlice ImmutableEqVector -> ImmutableEqSlice ImmutableOrdVector -> ImmutableOrdSlice MutableVector -> MutableSlice MutableVectorAllocating -> MutableSliceAllocating MutableCloneableVector -> MutableCloneableSlice MutableOrdVector -> MutableOrdSlice These are all in the prelude so most code will not break. [breaking-change]
2014-08-12libnative: process spawning should not close inherited file descriptorsIvan Petkov-1/+24
* The caller should be responsible for cleaning up file descriptors * If a caller safely creates a file descriptor (via native::io::file::open) the returned structure (FileDesc) will try to clean up the file, failing in the process and writing error messages to the screen. * This should not happen as the caller has no public interface for telling the FileDesc structure to NOT free the underlying fd. * Alternatively, if another file is opened under the same fd held by the FileDesc structure returned by native::io::file::open, it will close the wrong file upon destruction.
2014-08-08auto merge of #16336 : retep998/rust/master, r=brsonbors-4/+5
Several of the tests in `make check-fast` were failing so this fixes those tests.
2014-08-08Register new snapshot 12e0f72Niko Matsakis-3/+0
2014-08-07windows: Fix several tests on 64-bit.Peter Atashian-4/+5
Signed-off-by: Peter Atashian <retep998@gmail.com>