summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-09-04std: Fix overflow of HashMap's capacityPiotr Czarnecki-32/+49
2014-09-04std: Refine and document HashMap's codePiotr Czarnecki-482/+704
* branchless `bucket.next()` * robin_hood is a free function * fixed the resize policy that was off by one * documented the growth algorithm * updated documentation after interface changes * removed old fixmes
2014-09-04auto merge of #16986 : bjz/rust/bitflags, r=alexcrichtonbors-117/+136
Closes #16469
2014-09-04auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, ↵bors-7/+7
r=alexcrichton I corrected spelling and capitalization errors in comments and strings.
2014-09-05Use {} for bitflags! definition and invocationsBrendan Zabarauskas-27/+27
This looks nicer because it reflects Rust's other syntactic structures.
2014-09-05Attach documentation to the bitflags! macro itselfBrendan Zabarauskas-97/+98
This is in consistent with the style demonstrated in the std::macros module.
2014-09-05Test attributesBrendan Zabarauskas-0/+8
2014-09-05Allow trailing commas in bitflags! macroBrendan Zabarauskas-4/+14
2014-09-04auto merge of #16923 : wickerwaka/rust/crate-as-fixup, r=alexcrichtonbors-4/+4
Changed occurances of: extern crate foo = "bar"; to: extern crate "bar" as foo; Added warning for old deprecated syntax
2014-09-04Center alignment for fmtwickerwaka-1/+2
Use '^' to specify center alignment in format strings. fmt!( "[{:^5s}]", "Hi" ) -> "[ Hi ]" fmt!( "[{:^5s}]", "H" ) -> "[ H ]" fmt!( "[{:^5d}]", 1i ) -> "[ 1 ]" fmt!( "[{:^5d}]", -1i ) -> "[ -1 ]" fmt!( "[{:^6d}]", 1i ) -> "[ 1 ]" fmt!( "[{:^6d}]", -1i ) -> "[ -1 ]" If the padding is odd then the padding on the right will be one character longer than the padding on the left. Tuples squashed
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-7/+7
2014-09-03Print file permissions in octal form.Jonas Hietala-2/+23
Closes #16943.
2014-09-03Remove cross-borrowing for traits.Nick Cameron-2/+2
Closes #15349 [breaking-change] Trait objects are no longer implicitly coerced from Box<T> to &T. You must make an explicit coercion using `&*`.
2014-09-02std: Split hashmap.rs into modulesPiotr Czarnecki-1660/+1743
2014-09-02std: RawTable exposes a safe interface for HashMapPiotr Czarnecki-528/+883
Introduced a new growth algorithm.
2014-09-02std: branchless bucket distance for hashmapPiotr Czarnecki-9/+1
2014-09-01Updated to new extern crate syntax.wickerwaka-4/+4
Added warning for old deprecated syntax
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-30auto merge of #16859 : alexcrichton/rust/snapshots, r=huonwbors-165/+0
2014-08-29Register new snapshotsAlex Crichton-165/+0
2014-08-30Unify non-snake-case lints and non-uppercase statics lintsP1start-6/+6
This unifies the `non_snake_case_functions` and `uppercase_variables` lints into one lint, `non_snake_case`. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges the `non_uppercase_pattern_statics` lint into the `non_uppercase_statics` lint. Because the `uppercase_variables` lint is now part of the `non_snake_case` lint, all non-snake-case variables that start with lowercase characters (such as `fooBar`) will now trigger the `non_snake_case` lint. New code should be updated to use the new `non_snake_case` lint instead of the previous `non_snake_case_functions` and `uppercase_variables` lints. All use of the `non_uppercase_pattern_statics` should be replaced with the `non_uppercase_statics` lint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable the `non_snake_case` lint. Any code with non-camel-case type parameters should be changed to use camel case or disable the `non_camel_case_types` lint. [breaking-change]
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-279/+200
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-28libstd: Wrap duration.rs at 100 characters.Ruud van Asseldonk-3/+6
2014-08-28Fallout from stabilizing core::optionAaron Turon-4/+4
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-13/+152
2014-08-26auto merge of #16742 : vhbit/rust/ios-ffi-fix, r=alexcrichtonbors-0/+1
2014-08-26DST coercions and DST structsNick Cameron-78/+100
[breaking-change] 1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code. 2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible. 3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
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