about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-09-10std::vec: Remove the function same_lengthblake2-ppc-5/+0
The basic construct x.len() == y.len() is just as simple. This function used to be a precondition (not sure about the terminology), so it had to be a function. This is not relevant any more.
2013-09-10std::vec: Update module doc textblake2-ppc-19/+60
Update for a lot of changes (not many free functions left), add examples of the important methods `slice` and `push`, and write a short bit about iteration.
2013-09-10std::vec: Replace each_permutation with a new Permutations iteratorblake2-ppc-119/+165
Introduce ElementSwaps and Permutations. ElementSwaps is an iterator that for a given sequence length yields the element swaps needed to visit each possible permutation of the sequence in turn. We use an algorithm that generates a sequence such that each permutation is only one swap apart. let mut v = [1, 2, 3]; for perm in v.permutations_iter() { // yields 1 2 3 | 1 3 2 | 3 1 2 | 3 2 1 | 2 3 1 | 2 1 3 } The `.permutations_iter()` yields clones of the input vector for each permutation. If a copyless traversal is needed, it can be constructed with `ElementSwaps`: for (a, b) in ElementSwaps::new(3) { // yields (2, 1), (1, 0), (2, 1) ... v.swap(a, b); // .. }
2013-09-10std::vec: Change fn unzip to take an iterator argumentblake2-ppc-31/+13
Remove unzip_slice since it's redundant. Old unzip is equivalent to the `|x| unzip(x.move_iter())`
2013-09-07auto merge of #8906 : novalis/rust/master, r=alexcrichtonbors-46/+145
This is a patch to fix #6031. I didn't see any tests for the C++ library code, so I didn't write a test for my changes. Did I miss something, or are there really no tests?
2013-09-07auto merge of #9032 : alexcrichton/rust/inline-repr, r=thestingerbors-0/+1
This allows cross-crate inlining which is *very* good because this is called a lot throughout libstd (even when libstd is inlined across crates). In one of my projects, I have a test case with the following performance characteristics commit | optimization level | runtime (seconds) ----|------|---- before | O2 | 22s before | O3 | 107s after | O2 | 13s after | O3 | 12s I'm a bit disturbed by the 107s runtime from O3 before this commit. The performance characteristics of this test involve doing an absurd amount of small operations. A huge portion of this is creating hashmaps which involves allocating vectors. The worst portions of the profile are: ![screen shot 2013-09-06 at 10 32 15 pm](https://f.cloud.github.com/assets/64996/1100723/e5e8744c-177e-11e3-83fc-ddc5f18c60f9.png) Which as you can see looks like some *serious* problems with inlining. I would expect the hash map methods to be high up in the profile, but the top 9 callers of `cast::transmute_copy` were `Repr::repr`'s various monomorphized instances. I wish there we a better way to detect things like this in the future, and it's unfortunate that this is required for performance in the first place. I suppose I'm not entirely sure why this is needed because all of the methods should have been generated in-crate (monomorphized versions of library functions), so they should have gotten inlined? It also could just be that by modifying LLVM's idea of the inline cost of this function it was able to inline it in many more locations.
2013-09-07Handle global log levels (fixes #6033)novalis-36/+100
2013-09-06auto merge of #9026 : jbclements/rust/let-var-hygiene, r=jbclementsbors-0/+10
This is a rebase of my approved pull request from ... the end of June? It introduces hygiene for let-bound variables.
2013-09-06Flag the Repr::repr function with #[inline]Alex Crichton-0/+1
This allows cross-crate inlining which is *very* good because this is called a lot throughout libstd (even when libstd is inlined across crates).
2013-09-06Add with_mem_writer to std::rt::io::mem.Brandon Sanderson-0/+14
This is in many ways a replacement for the current std::io::with_str_writer.
2013-09-06Fix #6031. Allow symbolic log levels, not just numbers.novalis-18/+53
2013-09-06auto merge of #9010 : aaronlaursen/rust/master, r=alexcrichtonbors-4/+31
Here's a fix for issue #7588, "Overflow handling of from_str methods is broken". The integer overflow issues are taken care of by checking to see if the multiply-by-radix-and-add-next-digit process is reversible. If it overflowed, then some information is lost and the process is irreversible, in which case, None is returned. Floats now consistently return Some(Inf) of Some(-Inf) on overflow thanks to a call to NumStrConv::inf() and NumStrConv::neg_inf() respectively when the overflow is detected (which yields a value of None in the case of ints and uints anyway). This is my first contribution to Rust, and my first time using the language in general, so any and all feedback is appreciated.
2013-09-06added IterBytes for 4-tuplesJohn Clements-0/+10
2013-09-06Make I/O tests use run_in_mt_newsched_task to get more multi-threaded test ↵Eric Reed-50/+187
coverage
2013-09-06Forgot to make accept() home for IOEric Reed-1/+3
2013-09-06Upgrade libuv to the current master (again)Alex Crichton-124/+81
This is a reopening of the libuv-upgrade part of #8645. Hopefully this won't cause random segfaults all over the place. The windows regression in testing should also be fixed (it shouldn't build the whole compiler twice). A notable difference from before is that gyp is now a git submodule instead of always git-cloned at make time. This allows bundling for releases more easily. Closes #8850
2013-09-06fix for issue #7588, overflow now handled correctlyAaron Laursen-4/+31
2013-09-06Fix Acceptor iterator ending early if a connection attempt failsEric Reed-4/+9
2013-09-09auto merge of #9005 : alexcrichton/rust/rusty-log, r=brsonbors-1/+9
Also redefine all of the standard logging macros to use more rust code instead of custom LLVM translation code. This makes them a bit easier to understand, but also more flexibile for future types of logging. Additionally, this commit removes the LogType language item in preparation for changing how logging is performed.
2013-09-09auto merge of #9051 : bjz/rust/master, r=huonwbors-384/+419
2013-09-09Some work on std::ascii: Marked unsafe function unsafe, added moving ↵Marvin Löbel-20/+77
implementations
2013-09-09auto merge of #9073 : alexcrichton/rust/remove-local-data-hax, r=huonwbors-9/+7
These compiler bugs have since been fixed (one less layer of indirection)
2013-09-09Remove hacks around issues in local_dataAlex Crichton-9/+7
These compiler bugs have since been fixed (one less layer of indirection)
2013-09-09auto merge of #9065 : thestinger/rust/iter, r=alexcrichtonbors-64/+62
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-64/+62
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-08repr: update for removal of constDaniel Micay-2/+1
2013-09-08repr: write the mutability qualifier for slicesDaniel Micay-0/+4
2013-09-08auto merge of #8988 : cmr/rust/fromstr_fn, r=brsonbors-3/+9
It just calls out to the associated function on the trait.
2013-09-08Fix import order which caused the wrong from_str to be in scopeCorey Richardson-3/+3
2013-09-09Fix unused import warnings on 32bit systemsBrendan Zabarauskas-2/+6
2013-09-08Add Clone and DeepClone constraints to Primitive traitBrendan Zabarauskas-1/+4
2013-09-08Moved checked trait impls out of std::numBrendan Zabarauskas-383/+411
This follows the same pattern as the other numeric trait impls, and reduces the clutter in std::num.
2013-09-08std: Rename Unfoldr to Unfold.Huon Wilson-6/+6
The `r` is not relevant, since there is only one direction of folding (unlike Haskell).
2013-09-07auto merge of #9046 : thestinger/rust/repr, r=alexcrichtonbors-5/+22
Closes #8743
2013-09-07fix repr of strings/chars with quotesDaniel Micay-5/+22
Closes #8743
2013-09-06auto merge of #9002 : brson/rust/issue-8769, r=catamorphismbors-22/+21
This is an unsafe implementation detail of `push`.
2013-09-06auto merge of #9000 : brson/rust/dns, r=anasazibors-15/+382
This exposes a very simple function for resolving host names. There's a lot more that needs to be done, but this is probably enough for servo to get started connecting to real websites again.
2013-09-05std::rt: Fix addrinfo definition on BSDBrian Anderson-1/+15
2013-09-05auto merge of #8914 : Dretch/rust/native-glob, r=alexcrichtonbors-84/+0
This is #8201 with a bunch of amendments to address the comments (and re-based).
2013-09-05auto merge of #8909 : lkuper/rust/default-methods-refactor, r=alexcrichtonbors-234/+156
(cc: #3227) Parts I'm unsure about and would like a reviewer to look at are: * `pub trait GenericPath : Clone + Eq + ToStr` -- is this the done thing? I've never done trait inheritance before, let alone from multiple traits, but it seemed to be necessary to be able to call all the methods we have to be able to call on `self`. * changing the argument of `components` from `self` to `&self`, and having it return `self.components.clone()` instead of `self.components`; this was necessary to avoid move errors, but I'm not sure if it's the right thing. (The default methods impls now all have to call `self.components()` instead of just referencing the field `self.components`.)
2013-09-05std: Remove push_fast from OwnedVector. Closes #8769Brian Anderson-22/+21
This is an unsafe implementation detail of `push`.
2013-09-05auto merge of #8997 : fhahn/rust/issue_8985, r=catamorphism,brsonbors-84/+84
Patch for #8985
2013-09-05std::rt: Add get_host_addresses functionBrian Anderson-10/+78
This is a very simplistic method for host name resolution. It converts a host name to a vector of IP addresses. Should be enough to get started.
2013-09-05std::rt: Add libuv bindings for getaddrinfoBrian Anderson-0/+282
2013-09-05std::rt: Some I/O cleanupBrian Anderson-7/+10
2013-09-05Replace os::glob with extra::glob, which is written in rust,Gareth Smith-84/+0
fixing issue #6100.
2013-09-05auto merge of #8984 : chris-morgan/rust/auto-stream-impl, r=huonwbors-0/+2
This is consistent with the existing documentation but was not the actual behaviour, which I've found to be rather a nuisance, actually.
2013-09-05Rename str::from_bytes to str::from_utf8, closes #8985Florian Hahn-84/+84
2013-09-05Minor doc cleanup.Lindsey Kuper-11/+12
2013-09-05Factor shared code out into default GenericPath methods.Lindsey Kuper-223/+144