about summary refs log tree commit diff
path: root/src/libcollections/bit.rs
AgeCommit message (Collapse)AuthorLines
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-2209/+0
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-11Register new snapshotsAlex Crichton-3/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-03syntax: Implement #![no_core]Alex Crichton-1/+2
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-27Show appropriate feature flags in docsSteve Klabnik-49/+98
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-1/+1
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-07-01fallout of bitvec/bitset deprecationAlexis Beingessner-1/+1
2015-06-30Deprecate BitSet and BitVec in favour of bit-vec and bit-set crates in cargoAlexis Beingessner-0/+5
2015-06-17More test fixes and fallout of stability changesAlex Crichton-0/+2
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-61/+64
2015-06-17collections: Split the `collections` featureAlex Crichton-20/+20
This commit also deprecates the `as_string` and `as_slice` free functions in the `string` and `vec` modules.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-4/+4
2015-06-08Auto merge of #25989 - jooert:implement_rfc839, r=Gankrobors-0/+14
I had to use `impl<'a, V: Copy> Extend<(usize, &'a V)> for VecMap<V>` instead of `impl<'a, V: Copy> Extend<(&'a usize, &'a V)> for VecMap<V>` as that's what is needed for doing ```rust let mut a = VecMap::new(); let b = VecMap::new(); b.insert(1, "foo"); a.extend(&b) ``` I can squash the commits after review. r? @Gankro
2015-06-08Implement RFC 839Johannes Oertel-0/+14
Closes #25976.
2015-06-07change some statics to constantsOliver 'ker' Schneider-4/+4
2015-05-18Auto merge of #25230 - rayglover:patch-bitset, r=Gankrobors-74/+83
Some modest running-time improvements to `std::collections::BitSet` on bit-sets of varying set-membership densities. This is work originally from [here](https://github.com/rayglover/alt_collections). (Benchmarks copied below) ``` std::collections::BitSet / alt_collections::BitSet copy_dense ... 3.08x copy_sparse ... 4.22x count_dense ... 11.01x count_sparse ... 8.11x from_bytes ... 1.47x intersect_dense ... 6.54x intersect_sparse ... 4.37x union_dense ... 5.53x union_sparse ... 5.60x ``` The exception is `from_bytes`, which I've left unaltered since the optimization is rather obscure. Compiling with the cpu feature `popcnt` gave a further ~10% improvement on my machine, but this wasn't factored in to the benchmarks above. Similar improvements could be made to `BitVec`, although that would probably require more substantial changes. criticism welcome!
2015-05-16fix to size_hint(); documentation for bit-twiddle;ray glover-15/+22
2015-05-11Rollup merge of #25288 - DrKwint:master, r=alexcrichtonSteve Klabnik-3/+3
The functions BitSet::{iter,union,symmetric_difference} each had docs that claimed u32s were output when their actual output each end up being usizes. r? @steveklabnik
2015-05-11Auto merge of #24934 - jooert:bitset-append-split_off, r=Gankrobors-0/+83
cc #19986
2015-05-10Update BitSet docs to correct typesPaul Quint-3/+3
Update BitSet docs to correct type in one more spot removed accidental file
2015-05-10Implement `append` and `split_off` for BitSet (RFC 509)Johannes Oertel-0/+83
2015-05-09Perf improvements to `collections::BitSet`.ray glover-75/+77
2015-05-09Document panic behaviour of BitVec::split_offJohannes Oertel-0/+4
2015-05-06Implement append and split_off for BitVec (RFC 509)Johannes Oertel-0/+101
2015-05-04Make `BitVec::process` faster (branch free).Huon Wilson-6/+4
This makes the `bit::vec::bench::bench_bit_vec_big_union` benchmark go from `774 ns/iter (+/- 190)` to `602 ns/iter (+/- 5)`. (There's room for more work here too: if one can guarantee 128-bit alignment for the vector, the compiler actually optimises `union`, `intersection` etc. to SIMD instructions, which end up being ~5x faster that the original version, and 4x faster than the optimised version in this patch.)
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-1/+0
Conflicts: src/libcore/result.rs
2015-04-21std: Bring back f32::from_str_radix as an unstable APIAlex Crichton-1/+0
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
2015-04-17std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-2/+1
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-2/+2
2015-04-03Auto merge of #23832 - petrochenkov:usize, r=aturonbors-17/+17
These constants are small and can fit even in `u8`, but semantically they have type `usize` because they denote sizes and are almost always used in `usize` context. The change of their type to `u32` during the integer audit led only to the large amount of `as usize` noise (see the second commit, which removes this noise). This is a minor [breaking-change] to an unstable interface. r? @aturon
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-10/+2
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-31Stabilize std::numAaron Turon-1/+0
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-30Remove unnecessary `as usize`Vadim Petrochenkov-17/+17
2015-03-26Register new snapshotsAlex Crichton-12/+0
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+45
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 #23637: apasel422/iterAlex Crichton-0/+4
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+45
2015-03-23Compiler and trait changes to make indexing by value.Niko Matsakis-0/+12
2015-03-23implement `Clone` for various iteratorsAndrew Paseltiner-0/+4
2015-03-17Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiynManish Goregaokar-1/+1
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-16extract libcollections tests into libcollectionstestJorge Aparicio-1180/+0
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-1/+1
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-12/+12
2015-03-03Auto merge of #22532 - pnkfelix:arith-overflow, r=pnkfelix,eddybbors-3/+3
Rebase and follow-through on work done by @cmr and @aatch. Implements most of rust-lang/rfcs#560. Errors encountered from the checks during building were fixed. The checks for division, remainder and bit-shifting have not been implemented yet. See also PR #20795 cc @Aatch ; cc @nikomatsakis
2015-03-03Rollup merge of #22876 - Florob:const, r=nikomatsakisManish Goregaokar-2/+2
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-03-03Add `core::num::wrapping` and fix overflow errors.James Miller-3/+3
Many of the core rust libraries have places that rely on integer wrapping behaviour. These places have been altered to use the wrapping_* methods: * core::hash::sip - A number of macros * core::str - The `maximal_suffix` method in `TwoWaySearcher` * rustc::util::nodemap - Implementation of FnvHash * rustc_back::sha2 - A number of macros and other places * rand::isaac - Isaac64Rng, changed to use the Wrapping helper type Some places had "benign" underflow. This is when underflow or overflow occurs, but the unspecified value is not used due to other conditions. * collections::bit::Bitv - underflow when `self.nbits` is zero. * collections::hash::{map,table} - Underflow when searching an empty table. Did cause undefined behaviour in this case due to an out-of-bounds ptr::offset based on the underflowed index. However the resulting pointers would never be read from. * syntax::ext::deriving::encodable - Underflow when calculating the index of the last field in a variant with no fields. These cases were altered to avoid the underflow, often by moving the underflowing operation to a place where underflow could not happen. There was one case that relied on the fact that unsigned arithmetic and two's complement arithmetic are identical with wrapping semantics. This was changed to use the wrapping_* methods. Finally, the calculation of variant discriminants could overflow if the preceeding discriminant was `U64_MAX`. The logic in `rustc::middle::ty` for this was altered to avoid the overflow completely, while the remaining places were changed to use wrapping methods. This is because `rustc::middle::ty::enum_variants` now throws an error when the calculated discriminant value overflows a `u64`. This behaviour can be triggered by the following code: ``` enum Foo { A = U64_MAX, B } ``` This commit also implements the remaining integer operators for Wrapped<T>.
2015-03-02core: Audit num module for int/uintBrian Anderson-59/+59
* count_ones/zeros, trailing_ones/zeros return u32, not usize * rotate_left/right take u32, not usize * RADIX, MANTISSA_DIGITS, DIGITS, BITS, BYTES are u32, not usize Doesn't touch pow because there's another PR for it. [breaking-change]
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-2/+2
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-02-25Rollup merge of #22157 - tbu-:pr_debug_collections, r=alexcrichtonManish Goregaokar-3/+3
r? @Gankro
2015-02-24Modify collection's `Debug` output to resemble in their content onlyTobias Bucher-3/+3
2015-02-24Use arrays instead of vectors in testsVadim Petrochenkov-6/+6