about summary refs log tree commit diff
path: root/src/libextra
AgeCommit message (Collapse)AuthorLines
2014-01-29extra: move glob to libglobDavid Manescu-778/+0
In line with the dissolution of libextra - moves glob to its own library libglob. Changes based on PR #11787. Updates .gitignore to ignore doc/glob.
2014-01-29extra: move arena to libarenaDavid Manescu-603/+0
In line with the dissolution of libextra - #8784 - moves arena to its own library libarena. Changes based on PR #11787. Updates .gitignore to ignore doc/arena.
2014-01-27auto merge of #11826 : huonw/rust/7621-deriving-errors, r=alexcrichtonbors-1/+5
cc #7621. See the commit message. I'm not sure if we should merge this now, or wait until we can write `Clone::clone(x)` which will directly solve the above issue with perfect error messages.
2014-01-28syntax: make deriving have slightly less cryptic error messages.Huon Wilson-1/+5
This unfortunately changes an error like error: mismatched types: expected `&&NotClone` but found `&NotClone` into error: type `NotClone` does not implement any method in scope named `clone`
2014-01-27Demote self to an (almost) regular argument and remove the env param.Eduard Burtescu-1/+1
Fixes #10667 and closes #10259.
2014-01-26auto merge of #11823 : derekchiang/rust/fix-barrier-doc, r=alexcrichtonbors-0/+1
The original comments weren't rendered correctly by Markdown.
2014-01-26auto merge of #11787 : alexcrichton/rust/refactor, r=brsonbors-130/+0
It was decided a long, long time ago that libextra should not exist, but rather its modules should be split out into smaller independent libraries maintained outside of the compiler itself. The theory was to use `rustpkg` to manage dependencies in order to move everything out of the compiler, but maintain an ease of usability. Sadly, the work on `rustpkg` isn't making progress as quickly as expected, but the need for dissolving libextra is becoming more and more pressing. Because of this, we've thought that a good interim solution would be to simply package more libraries with the rust distribution itself. Instead of dissolving libextra into libraries outside of the mozilla/rust repo, we can dissolve libraries into the mozilla/rust repo for now. Work on this has been excruciatingly painful in the past because the makefiles are completely opaque to all but a few. Adding a new library involved adding about 100 lines spread out across 8 files (incredibly error prone). The first commit of this pull request targets this pain point. It does not rewrite the build system, but rather refactors large portions of it. Afterwards, adding a new library is as simple as modifying 2 lines (easy, right?). The build system automatically keeps track of dependencies between crates (rust *and* native), promotes binaries between stages, tracks dependencies of installed tools, etc, etc. With this newfound buildsystem power, I chose the `extra::flate` module as the first candidate for removal from libextra. While a small module, this module is relative complex in that is has a C dependency and the compiler requires it (messing with the dependency graph a bit). Albeit I modified more than 2 lines of makefiles to accomodate libflate (the native dependency required 2 extra lines of modifications), but the removal process was easy to do and straightforward. --- Testing-wise, I've cross-compiled, run tests, built some docs, installed, uninstalled, etc. I'm still working out a few kinks, and I'm sure that there's gonna be built system issues after this, but it should be working well for basic use! cc #8784
2014-01-26Move extra::flate to libflateAlex Crichton-130/+0
This is hopefully the beginning of the long-awaited dissolution of libextra. Using the newly created build infrastructure for building libraries, I decided to move the first module out of libextra. While not being a particularly meaty module in and of itself, the flate module is required by rustc and additionally has a native C dependency. I was able to very easily split out the C dependency from rustrt, update librustc, and magically everything gets installed to the right locations and built automatically. This is meant to be a proof-of-concept commit to how easy it is to remove modules from libextra now. I didn't put any effort into modernizing the interface of libflate or updating it other than to remove the one glob import it had.
2014-01-26auto merge of #11817 : salemtalha/rust/master, r=brsonbors-6/+6
Fixes Issue #11815
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-6/+6
2014-01-26Fix barrier docsDerek Chiang-0/+1
2014-01-26Fix privacy fallout from previous changeAlex Crichton-13/+13
2014-01-25auto merge of #11808 : huonw/rust/std-visible-types, r=brsonbors-10/+11
These are either returned from public functions, and really should appear in the documentation, but don't since they're private, or are implementation details that are currently public.
2014-01-26std,extra: Make some types public and other private.Huon Wilson-10/+11
These are either returned from public functions, and really should appear in the documentation, but don't since they're private, or are implementation details that are currently public.
2014-01-25Stop allocating so much in arena testsBrian Anderson-2/+2
Android bots are OOMing.
2014-01-25auto merge of #11725 : derekchiang/rust/add-barrier, r=alexcrichtonbors-0/+95
2014-01-25Implement barrier.Derek Chiang-0/+95
2014-01-25Uppercase numeric constantsChris Wong-57/+57
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
2014-01-23Update flip() to be rev().Sean Chalmers-20/+20
Consensus leaned in favour of using rev instead of flip.
2014-01-23Rename Invert to Flip - Issue 10632Sean Chalmers-21/+21
Renamed the invert() function in iter.rs to flip(). Also renamed the Invert<T> type to Flip<T>. Some related code comments changed. Documentation that I could find has been updated, and all the instances I could locate where the function/type were called have been updated as well.
2014-01-22libc: switch `free` to the proper signatureDaniel Micay-3/+3
This does not attempt to fully propagate the mutability everywhere, but gives new code a hint to avoid the same issues.
2014-01-21[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old ↵Simon Sapin-13/+13
from_utf8_owned() behavior
2014-01-21[std::str] Rename from_utf8_opt() to from_utf8(), drop the old from_utf8() ↵Simon Sapin-2/+2
behavior
2014-01-21[std::vec] Rename .remove_opt() to .remove(), drop the old .remove() behaviorSimon Sapin-1/+1
2014-01-21[std::vec] Rename .shift_opt() to .shift(), drop the old .shift() behaviorSimon Sapin-1/+1
2014-01-21[std::vec] Rename .pop_opt() to .pop(), drop the old .pop() behaviorSimon Sapin-41/+41
2014-01-21[std::vec] Rename .last_opt() to .last(), drop the old .last() behaviorSimon Sapin-4/+4
2014-01-21Remove unnecessary parentheses.Huon Wilson-23/+23
2014-01-20Register new snapshotsAlex Crichton-2/+1
Upgrade the version to 0.10-pre
2014-01-20auto merge of #11664 : bjz/rust/identities, r=alexcrichtonbors-31/+14
`Zero` and `One` have precise definitions in mathematics as the identities of the `Add` and `Mul` operations respectively. As such, types that implement these identities are now also required to implement their respective operator traits. This should reduce their misuse whilst still enabling them to be used in generalized algebraic structures (not just numbers). Existing usages of `#[deriving(Zero)]` in client code could break under these new rules, but this is probably a sign that they should have been using something like `#[deriving(Default)]` in the first place. For more information regarding the mathematical definitions of the additive and multiplicative identities, see the following Wikipedia articles: - http://wikipedia.org/wiki/Additive_identity - http://wikipedia.org/wiki/Multiplicative_identity Note that for floating point numbers the laws specified in the doc comments of `Zero::zero` and `One::one` may not always hold. This is true however for many other traits currently implemented by floating point numbers. What traits floating point numbers should and should not implement is an open question that is beyond the scope of this pull request. The implementation of `std::num::pow` has been made more succinct and no longer requires `Clone`. The coverage of the associated unit test has also been increased to test for more combinations of bases, exponents, and expected results.
2014-01-20Add operator trait constraints to std::num::{Zero, One} and document their ↵Brendan Zabarauskas-31/+14
appropriate use Zero and One have precise definitions in mathematics. Documentation has been added to describe the appropriate uses for these traits and the laws that they should satisfy. For more information regarding these identities, see the following wikipedia pages: - http://wikipedia.org/wiki/Additive_identity - http://wikipedia.org/wiki/Multiplicative_identity
2014-01-19auto merge of #11652 : hdima/rust/base64-padding-newlines, r=alexcrichtonbors-2/+5
Ignore all newline characters in Base64 decoder to make it compatible with other Base64 decoders. Most of the Base64 decoder implementations ignore all newline characters in the input string. There are some examples: Python: ```python >>> " A Q = = ".decode("base64") '\x01' ``` Ruby: ```ruby irb(main):001:0> " A Q = = ".unpack("m") => [""] ``` Erlang: ```erlang 1> base64:decode(" A Q = = "). <<1>> ``` Moreover some Base64 encoders append newline character at the end of the output string by default: Python: ```python >>> "".encode("base64") 'AQ== ' ``` Ruby: ```ruby irb(main):001:0> [""].pack("m") => "AQ== " ``` So I think it's fairly important for Rust Base64 decoder to accept Base64 inputs even with newline characters in the padding.
2014-01-19auto merge of #11649 : FlaPer87/rust/pow, r=cmrbors-1/+1
There was an old and barely used implementation of pow, which expected both parameters to be uint and required more traits to be implemented. Since a new implementation for `pow` landed, I'm proposing to remove this old impl in favor of the new one. The benchmark shows that the new implementation is faster than the one being removed: ``` test num::bench::bench_pow_function ..bench: 9429 ns/iter (+/- 2055) test num::bench::bench_pow_with_uint_function ...bench: 28476 ns/iter (+/- 2202) ```
2014-01-19auto merge of #10801 : musitdev/rust/jsondoc2, r=cmrbors-1/+222
I update the example of json use to the last update of the json.rs code. I delete the old branch. From my last request, I remove the example3 because it doesn't compile. I don't understand why and I don't have the time now to investigate.
2014-01-19auto merge of #11635 : thestinger/rust/zero-size-alloc, r=alexcrichtonbors-5/+3
The `malloc` family of functions may return a null pointer for a zero-size allocation, which should not be interpreted as an out-of-memory error. If the implementation does not return a null pointer, then handling this will result in memory savings for zero-size types. This also switches some code to `malloc_raw` in order to maintain a centralized point for handling out-of-memory in `rt::global_heap`. Closes #11634
2014-01-19extra::json: add documentation and examplesmusitdev-1/+1
2014-01-19extra::json: add documentation and examplesmusitdev-1/+1
2014-01-19Squashed commit of the following:musitdev-1/+222
commit d00623d60afd460755b749ad5f94935f756f29d2 Author: musitdev <philippe.delrieu@free.fr> Date: Sat Jan 4 22:31:40 2014 +0100 correct last comments. commit ef09d6b6d1eebbd7c713c9dad96ed7bfc19dd884 Author: musitdev <philippe.delrieu@free.fr> Date: Thu Jan 2 20:28:53 2014 +0100 update with the last remarks. commit 46a028fe1fcdc2a7dcdd78a63001793eff614349 Author: musitdev <philippe.delrieu@free.fr> Date: Thu Jan 2 10:17:18 2014 +0100 wrap example code in main function. commit 2472901929bef09786b7aef8ca7c89fbe67d8e3e Author: musitdev <philippe.delrieu@free.fr> Date: Mon Dec 30 19:32:46 2013 +0100 Correct code to compile. commit ed96b2223176781743e984af0e19abcb82150f1f Author: musitdev <philippe.delrieu@free.fr> Date: Thu Dec 5 11:32:28 2013 +0100 Correct the comment based on the PR comment. Change init call to new to reflect last change. commit 38b0390c3533a16f822a6df5f90b907bd8ed6edc Author: musitdev <philippe.delrieu@free.fr> Date: Wed Dec 4 22:34:25 2013 +0100 correct from_utf8_owned call. commit 08bed4c5f4fadf93ec457b605a1a1354323d2f5c Author: musitdev <philippe.delrieu@free.fr> Date: Wed Dec 4 22:12:41 2013 +0100 correct code ''' commit 02fddcbe2ab37fe842872691105bc4c5cff5abb5 Author: musitdev <philippe.delrieu@free.fr> Date: Wed Dec 4 13:25:54 2013 +0100 correct typing error commit b26830b8ddb49f551699e791832ed20640a0fafc Author: musitdev <philippe.delrieu@free.fr> Date: Wed Dec 4 13:18:39 2013 +0100 pass make check commit e87c4f53286122efd0d2364ea45600d4fa4d5744 Author: musitdev <philippe.delrieu@free.fr> Date: Wed Dec 4 10:47:24 2013 +0100 Add Json example and documentation.
2014-01-18auto merge of #11615 : adwhit/rust/master, r=cmrbors-7/+30
This is my first patch so feedback appreciated! Bug when initialising `bitv:Bitv::new(int,bool)` when `bool=true`. It created a `Bitv` with underlying representation `!0u` rather than the actual desired bit layout ( e.g. `11111111` instead of `00001111`). This works OK because a size attribute is included which keeps access to legal bounds. However when using `BitvSet::from_bitv(Bitv)`, we then find that `bitvset.contains(i)` can return true when `i` should not in fact be in the set. ``` let bs = BitvSet::from_bitv(Bitv::new(100, true)); assert!(!bs.contains(&127)) //fails ``` The fix is to create the correct representation by treating various cases separately and using a bitshift `(1<<nbits) - 1` to generate correct number of `1`s where necessary.
2014-01-18Replace old pow_with_uint with the new pow funcFlavio Percoco-1/+1
There was an old and barely used implementation of pow, which expected both parameters to be uint and required more traits to be implemented. Since a new implementation for `pow` landed, I'm proposing to remove this old impl in favor of the new one. The benchmark shows that the new implementation is faster than the one being removed: test num::bench::bench_pow_function ..bench: 9429 ns/iter (+/- 2055) test num::bench::bench_pow_with_uint_function ...bench: 28476 ns/iter (+/- 2202)
2014-01-18Ignore all newline characters in Base64 decoderDmitry Vasiliev-2/+5
Ignore all newline characters in Base64 decoder to make it compatible with other Base64 decoders.
2014-01-18Rename iterators for consistencyPalmer Cox-161/+160
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
2014-01-17handle zero-size allocations correctlyDaniel Micay-5/+3
The `malloc` family of functions may return a null pointer for a zero-size allocation, which should not be interpreted as an out-of-memory error. If the implementation does not return a null pointer, then handling this will result in memory savings for zero-size types. This also switches some code to `malloc_raw` in order to maintain a centralized point for handling out-of-memory in `rt::global_heap`. Closes #11634
2014-01-17auto merge of #11503 : FlaPer87/rust/master, r=huonwbors-8/+8
The patch adds the missing pow method for all the implementations of the Integer trait. This is a small addition that will most likely be improved by the work happening in #10387. Fixes #11499
2014-01-17auto merge of #11598 : alexcrichton/rust/io-export, r=brsonbors-13/+10
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered private modules * Remove with_mem_writer * Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered) cc #11119
2014-01-17Tweak the interface of std::ioAlex Crichton-13/+10
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered private modules * Remove with_mem_writer * Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)
2014-01-17Add a generic power functionFlavio Percoco-8/+8
The patch adds a `pow` function for types implementing `One`, `Mul` and `Clone` trait. The patch also renames f32 and f64 pow into powf in order to still have a way to easily have float powers. It uses llvms intrinsics. The pow implementation for all num types uses the exponentiation by square. Fixes bug #11499
2014-01-17auto merge of #11601 : dguenther/rust/fix_test_summary, r=brsonbors-1/+1
The test run summary currently prints the wrong number of tests run. This PR fixes it by adding a newline to the log output, and also adds support for counting bench runs. Closes #11381
2014-01-17Fixed bug when initialising bitv from bool=trueAlex Whitney-7/+30
2014-01-17auto merge of #11498 : c-a/rust/optimize_vuint_at, r=alexcrichtonbors-23/+79
Use a lookup table, SHIFT_MASK_TABLE, that for every possible four bit prefix holds the number of times the value should be right shifted and what the right shifted value should be masked with. This way we can get rid of the branches which in my testing gives approximately a 2x speedup. Timings on Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz -- Before -- running 5 tests test ebml::tests::test_vuint_at ... ok test ebml::bench::vuint_at_A_aligned ... bench: 494 ns/iter (+/- 3) test ebml::bench::vuint_at_A_unaligned ... bench: 494 ns/iter (+/- 4) test ebml::bench::vuint_at_D_aligned ... bench: 467 ns/iter (+/- 5) test ebml::bench::vuint_at_D_unaligned ... bench: 467 ns/iter (+/- 5) -- After -- running 5 tests test ebml::tests::test_vuint_at ... ok test ebml::bench::vuint_at_A_aligned ... bench: 181 ns/iter (+/- 2) test ebml::bench::vuint_at_A_unaligned ... bench: 192 ns/iter (+/- 1) test ebml::bench::vuint_at_D_aligned ... bench: 181 ns/iter (+/- 3) test ebml::bench::vuint_at_D_unaligned ... bench: 197 ns/iter (+/- 6)