summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-08-26Use temp vars for implicit coercion to ^[T]Nick Cameron-54/+91
2014-08-25Adopting FFI changes for iOSValerii Hiora-0/+1
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-24auto merge of #16703 : bluss/rust/assert-bloat, r=huonwbors-1/+1
With no custom message, we should just use concat! + stringify! for `assert!(expr)` to avoid the string formatting code path. Inspired by issue #16625
2014-08-23std: Use concat! and stringify! to simplify the most common assert! case.root-1/+1
With no custom message, we should just use concat! + stringify! for `assert!(expr)`. Inspired by issue #16625
2014-08-23Complete renaming of win32 to windowsVadim Chugunov-7/+7
2014-08-23Remove stage0 attributes.Vadim Chugunov-2/+0
2014-08-22auto merge of #16647 : vhbit/rust/ios-build-fixes, r=alexcrichtonbors-2/+2
2014-08-21auto merge of #16499 : cmr/rust/struct-undef-repr, r=pcwaltonbors-1/+33
r? @pcwalton
2014-08-21libstd: Limit Duration range to i64 milliseconds.Ruud van Asseldonk-54/+52
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-21iOS compilation fixValerii Hiora-2/+2
2014-08-21auto merge of #16362 : nham/rust/std_rand_pi_example, r=huonwbors-0/+43
Pros: I like this example because it's concise without being trivial. The Monty Hall example code is somewhat lengthy and possibly inaccessible to those unfamiliar with probability. Cons: The Monty Hall example already exists. Do we need another example? Also, this is probably inaccessible to people who don't know basic geometry.
2014-08-21Use unicode pi symbol in pi estimation example. Additional tweaksnham-7/+7
2014-08-21Surround formula in a 'notrust' code blocknham-0/+2
2014-08-21auto merge of #16443 : steveklabnik/rust/fix_path_docs, r=kballardbors-4/+22
Originally discovered here: http://www.reddit.com/r/rust/comments/2dbg3j/hm_unwrap_is_being_renamed_to_assert/cjnxiax
2014-08-20Stage #[repr(packed)] in std::rtCorey Richardson-1/+32
2014-08-20liblibc: don't use int/uint for intptr_t/uintptr_tCorey Richardson-1/+1
int/uint aren't considered FFI safe, replace them with the actual type they represent (i64/u64 or i32/u32). This is a breaking change, but at most a cast to `uint` or `int` needs to be added. [breaking-change]
2014-08-20Add #[repr(C)] to all the things!Corey Richardson-0/+1
2014-08-20librustc: handle repr on structs, require it for ffi, unify with packedCorey Richardson-1/+1
As of RFC 18, struct layout is undefined. Opting into a C-compatible struct layout is now down with #[repr(C)]. For consistency, specifying a packed layout is now also down with #[repr(packed)]. Both can be specified. To fix errors caused by this, just add #[repr(C)] to the structs, and change #[packed] to #[repr(packed)] Closes #14309 [breaking-change]
2014-08-20Fix error message for WindowsPath::newSteve Klabnik-4/+22
Originally discovered here: http://www.reddit.com/r/rust/comments/2dbg3j/hm_unwrap_is_being_renamed_to_assert/cjnxiax
2014-08-20libstd: Refactor Duration.Ruud van Asseldonk-288/+208
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-19libstd: Add `Fn`/`FnMut`/`FnOnce` to the prelude.Patrick Walton-0/+1
Closes #16600.
2014-08-18auto merge of #16578 : steveklabnik/rust/gh16239, r=pcwaltonbors-1/+6
Fies #16239.
2014-08-18Explain EOF behavior in File.eof().Steve Klabnik-1/+6
Fies #16239.
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-23/+23
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
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-13/+5
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-16auto merge of #16513 : sfackler/rust/io-util-cleanup, r=alexcrichtonbors-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-15Derive Clone for std::time::DurationAndrew Poelstra-1/+1
This is needed to derive Clone for types containing Durations.
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-15auto merge of #16435 : vadimcn/rust/windows, r=pcwaltonbors-3/+5
Using "win32" to mean "Windows" is confusing, especially now, that Rust supports win64 builds. Let's call spade a spade.
2014-08-14auto merge of #16332 : brson/rust/slicestab, r=aturonbors-45/+45
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-13Add a fixme about Duration representationBrian Anderson-0/+2
2014-08-13Update docsBrian Anderson-2/+5
2014-08-13std: Fix build errorsBrian Anderson-3/+3
2014-08-13std: Remove Duration::new/new_opt/to_tupleBrian Anderson-37/+0
These all expose the underlying data representation and are not the most convenient way of instantiation anyway.
2014-08-13std: Improve Duration commentsBrian Anderson-17/+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: Refactor time module a bitBrian Anderson-15/+30
Put `Duration` in `time::duration`, where the two constants can be called just `MAX` and `MIN`. Reexport from `time`. This provides more room for the time module to expand.
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-31/+111
Add tests. Also fix a bunch of broken time tests.
2014-08-13std: Restore missing timer examplesBrian Anderson-0/+52
2014-08-13std: Remove the `zero` constructor from `Duration`Brian Anderson-6/+0
This is a workaround for having to write `Zero::zero` and will be solved at the language level someday.
2014-08-13std: Remove ms-taking methods from timersBrian Anderson-172/+49
2014-08-13std: Change time::MAX to time::MAX_DURATION, etc.Brian Anderson-15/+15
2014-08-13std: Update Duration from upstreamBrian Anderson-100/+328
From rust-chrono 4f34003e03e259bd5cbda0cb4d35325861307cc6