summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-12-15Standardize some usages of "which" in docstringsAndrew Wagner-11/+11
In US english, "that" is used in restrictive clauses in place of "which", and often affects the meaning of sentences. In UK english and many dialects, no distinction is made. While Rust devs want to avoid unproductive pedanticism, it is worth at least being uniform in documentation such as: http://doc.rust-lang.org/std/iter/index.html and also in cases where correct usage of US english clarifies the sentence.
2014-12-14Free stdin on exitSteven Fackler-0/+7
2014-12-14Fix Markdown syntax in docs for OsRngMartin Pool-3/+6
2014-12-14std: Collapse SlicePrelude traitsAlex Crichton-46/+37
This commit collapses the various prelude traits for slices into just one trait: * SlicePrelude/SliceAllocPrelude => SliceExt * CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt * OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt * PartialEqSlicePrelude => PartialEqSliceExt
2014-12-14std: Bind port early to make a test more reliableAlex Crichton-1/+2
This test would read with a timeout and then send a UDP message, expecting the message to be received. The receiving port, however, was bound in the child thread so it could be the case that the timeout and send happens before the child thread runs. To remedy this we just bind the port before the child thread runs, moving it into the child later on. cc #19120
2014-12-15auto merge of #19742 : vhbit/rust/copy-for-bitflags, r=alexcrichtonbors-10/+1
2014-12-14Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`)Niko Matsakis-272/+284
2014-12-14Rewrite threading infrastructure, introducing `Thunk` to representNiko Matsakis-87/+115
boxed `FnOnce` closures.
2014-12-13libstd: fix unit testsJorge Aparicio-11/+13
2014-12-13libstd: convert `Duration` binops to by valueJorge Aparicio-0/+64
2014-12-13libstd: convert `BitFlags` binops to by valueJorge Aparicio-0/+44
2014-12-13Get rid of all the remaining uses of `refN`/`valN`/`mutN`/`TupleN`Jorge Aparicio-2/+2
2014-12-13libstd: use tuple indexingJorge Aparicio-4/+4
2014-12-13Windows dbghelp strips leading underscores from symbols, so let's accept ↵Vadim Chugunov-8/+25
"ZN...E" form too. Also, print PC displacement from symbols.
2014-12-13libstd: add missing importsJorge Aparicio-0/+2
2014-12-13libstd: use unboxed closuresJorge Aparicio-95/+171
2014-12-13libstd: fix falloutJorge Aparicio-0/+1
2014-12-13libstd: fix falloutJorge Aparicio-1/+1
2014-12-13libstd: fix falloutJorge Aparicio-3/+2
2014-12-13libstd: fix falloutJorge Aparicio-14/+22
2014-12-13libstd: fix falloutJorge Aparicio-16/+28
2014-12-13Add `Copy` to bitflags-generated structuresValerii Hiora-10/+1
2014-12-13auto merge of #19664 : tbu-/rust/pr_oibit2_fix, r=Gankrobors-29/+21
These probably happened during the merge of the commit that made `Copy` opt-in. Also, convert the last occurence of `/**` to `///` in `src/libstd/num/strconv.rs`
2014-12-12libc::c_char is not necessarily i8Akos Kiss-1/+1
2014-12-11Register new snapshotsAlex Crichton-18/+16
2014-12-10Fix inappropriate ## headingsSteve Klabnik-7/+7
Fixes #15499.
2014-12-09Test fixes and rebase conflicts from the rollupAlex Crichton-3/+3
2014-12-09Rollback accidental documentation changesTobias Bucher-29/+21
These probably happened during the merge of the commit that made `Copy` opt-in. Also, convert the last occurence of `/**` to `///` in `src/libstd/num/strconv.rs`
2014-12-09rollup merge of #19653: frewsxcv/rm-reexportsAlex Crichton-1/+4
Brief note: This does *not* affect anything in the prelude Part of #19253 All this does is remove the reexporting of Result and Option from their respective modules. More core reexports might be removed, but these ones are the safest to remove since these enums (and their variants) are included in the prelude. Depends on https://github.com/rust-lang/rust/pull/19407 which is merged, but might need a new snapshot [breaking-change]
2014-12-09rollup merge of #19620: retep998/memorymapAlex Crichton-39/+35
2014-12-09rollup merge of #19614: steveklabnik/gh19599Alex Crichton-1/+1
Fixes #19599
2014-12-09rollup merge of #19577: aidancully/masterAlex Crichton-1/+17
pthread_key_create can be 0. addresses issue #19567.
2014-12-08Remove Result and Option reexportsCorey Farwell-1/+4
Brief note: This does *not* affect anything in the prelude Part of #19253 All this does is remove the reexporting of Result and Option from their respective modules. More core reexports might be removed, but these ones are the safest to remove since these enums (and their variants) are included in the prelude. [breaking-change]
2014-12-09Rename assert_eq arguments to left and right.Niels Egberts-6/+6
The names expected and actual are not used anymore in the output. It also removes the confusion that the argument order is the opposite of junit.
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-22/+125
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-08core: remove the dead function fmt::argumentstr.Eduard Burtescu-1/+1
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-218/+215
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-07Make MemoryMap use HANDLE on Windows.Peter Atashian-39/+35
Also fixes some conflicting module names. Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-12-07Fix syntax error on android testsJorge Aparicio-2/+2
2014-12-07remove usage of notrust from the docsSteve Klabnik-1/+1
Fixes #19599
2014-12-06libstd: remove unnecessary `to_string()` callsJorge Aparicio-96/+96
2014-12-06libstd: remove unnecessary `as_mut_slice` callsJorge Aparicio-1/+1
2014-12-06libstd: remove unnecessary `as_slice()` callsJorge Aparicio-121/+118
2014-12-07auto merge of #19407 : frewsxcv/rust/rm-reexports, r=cmrbors-84/+115
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::\*, Result::\*, and Ordering::\*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-06auto merge of #19431 : erickt/rust/buf-writer-error, r=alexcrichtonbors-17/+27
Previously, `BufWriter::write` would just return an `std::io::OtherIoError` if someone attempted to write past the end of the wrapped buffer. This pull request changes the error to support partial writes and return a `std::io::ShortWrite`, or an `io::io::EndOfFile` if it's been fully exhausted. I've also optimized away a bounds check inside `BufWriter::write`, which should help shave off some nanoseconds in an inner loops.
2014-12-05prefer "FIXME" to "TODO".Aidan Cully-1/+1
2014-12-05Utilize fewer reexportsCorey Farwell-84/+115
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05work around portability issue on FreeBSD, in which the key returned fromAidan Cully-1/+17
pthread_key_create can be 0.
2014-12-05rollup merge of #19454: nodakai/libstd-reap-failed-childCorey Richardson-10/+33
After the library successfully called `fork(2)`, the child does several setup works such as setting UID, GID and current directory before it calls `exec(2)`. When those setup works failed, the child exits but the parent didn't call `waitpid(2)` and left it as a zombie. This patch also add several sanity checks. They shouldn't make any noticeable impact to runtime performance. The new test case in `libstd/io/process.rs` calls the ps command to check if the new code can really reap a zombie. The output of `ps -A -o pid,sid,command` should look like this: ``` PID SID COMMAND 1 1 /sbin/init 2 0 [kthreadd] 3 0 [ksoftirqd/0] ... 12562 9237 ./spawn-failure 12563 9237 [spawn-failure] <defunct> 12564 9237 [spawn-failure] <defunct> ... 12592 9237 [spawn-failure] <defunct> 12593 9237 ps -A -o pid,sid,command 12884 12884 /bin/zsh 12922 12922 /bin/zsh ... ``` where `./spawn-failure` is my test program which intentionally leaves many zombies. Filtering the output with the "SID" (session ID) column is a quick way to tell if a process (zombie) was spawned by my own test program. Then the number of "defunct" lines is the number of zombie children.
2014-12-05rollup merge of #19416: sfackler/global-stdinCorey Richardson-24/+136
io::stdin returns a new `BufferedReader` each time it's called, which results in some very confusing behavior with disappearing output. It now returns a `StdinReader`, which wraps a global singleton `Arc<Mutex<BufferedReader<StdReader>>`. `Reader` is implemented directly on `StdinReader`. However, `Buffer` is not, as the `fill_buf` method is fundamentaly un-thread safe. A `lock` method is defined on `StdinReader` which returns a smart pointer wrapping the underlying `BufferedReader` while guaranteeing mutual exclusion. Code that treats the return value of io::stdin as implementing `Buffer` will break. Add a call to `lock`: ```rust io::stdin().read_line(); // => io::stdin().lock().read_line(); ``` Closes #14434 [breaking-change]