about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-03-27Rollup merge of #23419 - murarth:lookup-addr, r=alexcrichtonManish Goregaokar-1/+57
Closes #22608
2015-03-27Rollup merge of #23738 - alexcrichton:snapshots, r=cmrManish Goregaokar-111/+4
2015-03-27default => or_insert per RFCAlexis Beingessner-5/+6
2015-03-26update everything to use Entry defaultsAlexis-8/+2
2015-03-26entry API v3: replace Entry::get with Entry::default and Entry::default_withAlexis-1/+25
2015-03-26Add `std::net::lookup_addr` for reverse DNS lookupMurarth-1/+57
Closes #22608
2015-03-26Register new snapshotsAlex Crichton-111/+4
2015-03-26Auto merge of #23680 - erickt:inline, r=cmrbors-0/+113
before: test bench_read_slice ... bench: 68 ns/iter (+/- 56) test bench_read_vec ... bench: 78 ns/iter (+/- 21) test bench_write_slice ... bench: 133 ns/iter (+/- 46) test bench_write_vec ... bench: 308 ns/iter (+/- 69) after: test bench_read_slice ... bench: 32 ns/iter (+/- 10) test bench_read_vec ... bench: 32 ns/iter (+/- 8) test bench_write_slice ... bench: 53 ns/iter (+/- 12) test bench_write_vec ... bench: 247 ns/iter (+/- 172)
2015-03-26Auto merge of #23711 - alexcrichton:ip-addr, r=aturonbors-21/+68
This commits adds back an `IpAddr` enum matching the `SocketAddr` enum, but without a port. The enumeration is `#[unstable]`. The `lookup_host` function and iterator are also destabilized behind a new feature gate due to questions around the semantics of returning `SocketAddr` values.
2015-03-25std: Add net::IpAddr, destabilize lookup_hostAlex Crichton-21/+68
This commits adds back an `IpAddr` enum matching the `SocketAddr` enum, but without a port. The enumeration is `#[unstable]`. The `lookup_host` function and iterator are also destabilized behind a new feature gate due to questions around the semantics of returning `SocketAddr` values.
2015-03-25Auto merge of #23695 - sae-bom:mac-android-debuginfo, r=alexcrichtonbors-0/+1
1. when mac-android cross compile and make-check , make it use gdb instead of lldb so as to it passes debuginfo tests. 2. ignore some tests on aarch64
2015-03-25Speed up reading/writing slices with #[inline]Erick Tryzelaar-0/+113
When built with `rustc -O`: before: test bench_read_slice ... bench: 68 ns/iter (+/- 56) test bench_read_vec ... bench: 78 ns/iter (+/- 21) test bench_write_slice ... bench: 133 ns/iter (+/- 46) test bench_write_vec ... bench: 308 ns/iter (+/- 69) after: test bench_read_slice ... bench: 32 ns/iter (+/- 10) test bench_read_vec ... bench: 32 ns/iter (+/- 8) test bench_write_slice ... bench: 53 ns/iter (+/- 12) test bench_write_vec ... bench: 247 ns/iter (+/- 172)
2015-03-25Rollup merge of #23693 - semarie:openbsd-pathbuf-new, r=nikomatsakisManish Goregaokar-2/+2
`PathBuf::new` have been changed. Use `PathBuf::from` instead. Apply the same change for freebsd too, while here.
2015-03-25Rollup merge of #23684 - tamird:ios-fallout, r=alexcrichtonManish Goregaokar-1/+1
r? @aturon cc @alexcrichton
2015-03-25Rollup merge of #23664 - bluss:std-docs, r=steveklabnikManish Goregaokar-16/+16
Main motivation was to update docs for the removal or "demotion" of certain extension traits. The update to the slice docs was larger, since the text was largely outdated.
2015-03-25Ignore some tests on aarch64Sae-bom Kim-0/+1
2015-03-25unbreak bitrig/openbsd build after 8389253dSébastien Marie-2/+2
`PathBuf::new` have been changed. Use `PathBuf::from` instead. Apply the same change for freebsd too, while here.
2015-03-24[iOS] Fallout from 8389253Tamir Duberstein-1/+1
2015-03-24Test fixes and rebase conflicts, round 2Alex Crichton-3/+7
2015-03-24Test fixes and rebase conflicts, round 1Alex Crichton-0/+2
2015-03-24rollup merge of #23638: pnkfelix/fsk-reject-specialized-dropsAlex Crichton-43/+43
Reject specialized Drop impls. See Issue #8142 for discussion. This makes it illegal for a Drop impl to be more specialized than the original item. So for example, all of the following are now rejected (when they would have been blindly accepted before): ```rust struct S<A> { ... }; impl Drop for S<i8> { ... } // error: specialized to concrete type struct T<'a> { ... }; impl Drop for T<'static> { ... } // error: specialized to concrete region struct U<A> { ... }; impl<A:Clone> Drop for U<A> { ... } // error: added extra type requirement struct V<'a,'b>; impl<'a,'b:a> Drop for V<'a,'b> { ... } // error: added extra region requirement ``` Due to examples like the above, this is a [breaking-change]. (The fix is to either remove the specialization from the `Drop` impl, or to transcribe the requirements into the struct/enum definition; examples of both are shown in the PR's fixed to `libstd`.) ---- This is likely to be the last thing blocking the removal of the `#[unsafe_destructor]` attribute. Fix #8142 Fix #23584
2015-03-24rollup merge of #23668: alexcrichton/io-zeroAlex Crichton-30/+14
This commit alters the behavior of the `Read::read_to_end()` method to zero all memory instead of passing an uninitialized buffer to `read`. This change is motivated by the [discussion on the internals forum][discuss] where the conclusion has been that the standard library will not expose uninitialized memory. [discuss]: http://internals.rust-lang.org/t/uninitialized-memory/1652 Closes #20314
2015-03-24rollup merge of #23646: steveklabnik/doc_fileAlex Crichton-0/+74
This is pretty basic, but it's nice to have something. r? @alexcrichton
2015-03-24rollup merge of #23630: nrc/coerce-tidyAlex Crichton-4/+7
See notes on the first commit Closes #18601 r? @nikomatsakis cc @eddyb
2015-03-24rollup merge of #23592: alexcrichton/tweak-at-exitAlex Crichton-45/+64
There have been some recent panics on the bots and this commit is an attempt to appease them. Previously it was considered invalid to run `rt::at_exit` after the handlers had already started running. Due to the multithreaded nature of applications, however, it is not always possible to guarantee this. For example [this program][ex] will show off the abort. [ex]: https://gist.github.com/alexcrichton/56300b87af6fa554e52d The semantics of the `rt::at_exit` function have been modified as such: * It is now legal to call `rt::at_exit` at any time. The return value now indicates whether the closure was successfully registered or not. Callers must now decide what to do with this information. * The `rt::at_exit` handlers will now be run for a fixed number of iterations. Common cases (such as the example shown) may end up registering a new handler while others are running perhaps once or twice, so this common condition is covered by re-running the handlers a fixed number of times, after which new registrations are forbidden. Some usage of `rt::at_exit` was updated to handle these new semantics, but deprecated or unstable libraries calling `rt::at_exit` were not updated.
2015-03-25Bug fixesNick Cameron-1/+2
2015-03-24Reject specialized Drop impls.Felix S. Klock II-1/+1
See Issue 8142 for discussion. This makes it illegal for a Drop impl to be more specialized than the original item. So for example, all of the following are now rejected (when they would have been blindly accepted before): ```rust struct S<A> { ... }; impl Drop for S<i8> { ... } // error: specialized to concrete type struct T<'a> { ... }; impl Drop for T<'static> { ... } // error: specialized to concrete region struct U<A> { ... }; impl<A:Clone> Drop for U<A> { ... } // error: added extra type requirement struct V<'a,'b>; impl<'a,'b:a> Drop for V<'a,'b> { ... } // error: added extra region requirement ``` Due to examples like the above, this is a [breaking-change]. (The fix is to either remove the specialization from the `Drop` impl, or to transcribe the requirements into the struct/enum definition; examples of both are shown in the PR's fixed to `libstd`.) ---- This is likely to be the last thing blocking the removal of the `#[unsafe_destructor]` attribute. Includes two new error codes for the new dropck check. Update run-pass tests to accommodate new dropck pass. Update tests and docs to reflect new destructor restriction. ---- Implementation notes: We identify Drop impl specialization by not being as parametric as the struct/enum definition via unification. More specifically: 1. Attempt unification of a skolemized instance of the struct/enum with an instance of the Drop impl's type expression where all of the impl's generics (i.e. the free variables of the type expression) have been replaced with unification variables. 2. If unification fails, then reject Drop impl as specialized. 3. If unification succeeds, check if any of the skolemized variables "leaked" into the constraint set for the inference context; if so, then reject Drop impl as specialized. 4. Otherwise, unification succeeded without leaking skolemized variables: accept the Drop impl. We identify whether a Drop impl is injecting new predicates by simply looking whether the predicate, after an appropriate substitution, appears on the struct/enum definition.
2015-03-24Added `T:Send` bound to `JoinGuard<T>` to avoid specialized `Drop` impl.Felix S. Klock II-1/+1
2015-03-24Added `T:Send` bound to `Queue<T>` to avoid specialized `Drop` impl.Felix S. Klock II-1/+1
2015-03-24Added `T:Send` bound to `Packet<T>` to avoid specialized `Drop` impl.Felix S. Klock II-2/+2
2015-03-24added `T:Send` bound to `Mutex<T>` to avoid specialized Drop impl.Felix S. Klock II-1/+1
2015-03-24Added `W: Writer` bound to `BufferedWriter<W>` to avoid specialized `Drop` impl.Felix S. Klock II-9/+9
2015-03-24Added `T:Send` bound to `Queue<T>` to avoid specialized Drop impl.Felix S. Klock II-2/+2
2015-03-24Added `Write` bounds to avoid a specialized Drop impl for `BufWriter`.Felix S. Klock II-9/+9
2015-03-24Added `T:Send` bound to `sync::mpsc::Receiver` and `sync::mpsc::Sender`.Felix S. Klock II-17/+17
This was necessary to avoid specialized `Drop` impls for the two structs.
2015-03-24std: Update docs for removal of ReadExt, WriteExtUlrik Sverdrup-16/+16
2015-03-25Change lint names to pluralsNick Cameron-2/+2
2015-03-25Add trivial cast lints.Nick Cameron-3/+5
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-24std: Zero memory when calling `read_to_end()`Alex Crichton-30/+14
This commit alters the behavior of the `Read::read_to_end()` method to zero all memory instead of passing an uninitialized buffer to `read`. This change is motivated by the [discussion on the internals forum][discuss] where the conclusion has been that the standard library will not expose uninitialized memory. [discuss]: http://internals.rust-lang.org/t/uninitialized-memory/1652 Closes #20314
2015-03-24Add Examples for FileSteve Klabnik-0/+74
This is pretty basic, but it's nice to have something.
2015-03-23Test fixes and rebase conflicts, round 3Alex Crichton-3/+1
2015-03-23Test fixes and rebase conflicts, round 2Alex Crichton-26/+26
2015-03-23rollup merge of #23503: alexcrichton/fix-ptr-docsAlex Crichton-2/+2
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-23Test fixes and rebase conflicts, round 1Alex Crichton-1/+1
2015-03-23rollup merge of #23383: alexcrichton/fs-create-dir-allAlex Crichton-1/+1
Conflicts: src/libstd/fs/mod.rs
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-1/+284
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23rollup merge of #23648: steveklabnik/rollupAlex Crichton-8/+8
- Successful merges: #22954, #23119, #23509, #23561, #23590, #23607, #23608, #23618, #23622, #23639, #23641 - Failed merges: #23401
2015-03-23rollup merge of #23641: steveklabnik/gh23632Alex Crichton-5/+5
Fixes #23632
2015-03-23rollup merge of #23640: nagisa/thread-less-weakAlex Crichton-11/+8
This is more portable as far as linux is concerned.
2015-03-23rollup merge of #23637: apasel422/iterAlex Crichton-0/+25