summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-08-27Consolidate local_data implementations, and cleanupAlex Crichton-549/+467
This moves all local_data stuff into the `local_data` module and only that module alone. It also removes a fair amount of "super-unsafe" code in favor of just vanilla code generated by the compiler at the same time. Closes #8113
2013-08-27Fix merge falloutAlex Crichton-3/+3
2013-08-27Implement process bindings to libuvAlex Crichton-980/+1011
Closes #6436
2013-08-27Upgrade libuv to the current master + our patchesAlex Crichton-83/+45
There were two main differences with the old libuv and the master version: 1. The uv_last_error function is now gone. The error code returned by each function is the "last error" so now a UvError is just a wrapper around a c_int. 2. The repo no longer includes a makefile, and the build system has change. According to the build directions on joyent/libuv, this now downloads a `gyp` program into the `libuv/build` directory and builds using that. This shouldn't add any dependences on autotools or anything like that. Closes #8407 Closes #6567 Closes #6315
2013-08-27librustc: Fix merge falloutPatrick Walton-19/+19
2013-08-27librustc: Fix problem with cross-crate reexported static methods.Patrick Walton-5/+13
2013-08-27libstd: Fix merge fallout.Patrick Walton-5/+5
2013-08-27librustc: Stop calling `each_path` in coherence.Patrick Walton-3/+3
10% win or so for small crates.
2013-08-27librustc: Fix merge fallout.Patrick Walton-2/+6
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-344/+588
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-27librustc: Remove `&const` and `*const` from the language.Patrick Walton-65/+152
They are still present as part of the borrow check.
2013-08-27Replace HashUtil w/ default method on HashJason Fager-7/+0
2013-08-27auto merge of #8771 : thestinger/rust/repr, r=catamorphismbors-50/+64
2013-08-27reflect: rm unused visit_{var,var_integral,constr}Daniel Micay-23/+0
2013-08-27repr: include mutability qualifier in visit_ptrDaniel Micay-0/+15
2013-08-27repr: print integer/float suffixesDaniel Micay-25/+40
2013-08-27auto merge of #8790 : huonw/rust/unsafearc, r=thestingerbors-75/+70
`UnsafeAtomicRcBox` &rarr; `UnsafeArc` (#7674), and `AtomicRcBoxData` &rarr; `ArcData` to reflect this. Also, the inner pointer of `UnsafeArc` is now `*mut ArcData`, which avoids some transmutes to `~`: i.e. less chance of mistakes.
2013-08-27auto merge of #8581 : FlaPer87/rust/issue/8232, r=bblumbors-19/+68
As for now, rekillable is an unsafe function, instead, it should behave just like unkillable by encapsulating unsafe code within an unsafe block. This patch does that and removes unsafe blocks that were encapsulating rekillable calls throughout rust's libs. Fixes #8232
2013-08-27Trailing spaceFlaper Fesp-1/+1
2013-08-27vec: implement `DeepClone`Daniel Micay-2/+9
2013-08-27auto merge of #8772 : thestinger/rust/option, r=anasazibors-13/+0
Closes #6002 There is consensus that the current implementation should be changed or removed, so removing it seems like the right decision for now.
2013-08-27option: rm implementation of AddDaniel Micay-13/+0
Closes #6002 There is consensus that the current implementation should be changed or removed, so removing it seems like the right decision for now.
2013-08-27auto merge of #8780 : brson/rust/from_elem, r=thestingerbors-4/+30
2013-08-27std: use ArcData rather than c_void in UnsafeArc.Huon Wilson-17/+12
This means that fewer `transmute`s are required, so there is less chance of a `transmute` not having the corresponding `forget` (possibly leading to use-after-free, etc).
2013-08-27Rename UnsafeAtomicRcBox to UnsafeArc. Fixes #7674.Huon Wilson-62/+62
2013-08-27Rebased and replaced yield with descheduleFlaper Fesp-1/+1
2013-08-26auto merge of #8700 : alexcrichton/rust/better-llvm, r=thestingerbors-0/+1
Beforehand, it was unclear whether rust was performing the "recommended set" of optimizations provided by LLVM for code. This commit changes the way we run passes to closely mirror that of clang, which in theory does it correctly. The notable changes include: * Passes are no longer explicitly added one by one. This would be difficult to keep up with as LLVM changes and we don't guaranteed always know the best order in which to run passes * Passes are now managed by LLVM's PassManagerBuilder object. This is then used to populate the various pass managers run. * We now run both a FunctionPassManager and a module-wide PassManager. This is what clang does, and I presume that we *may* see a speed boost from the module-wide passes just having to do less work. I have no measured this. * The codegen pass manager has been extracted to its own separate pass manager to not get mixed up with the other passes * All pass managers now include passes for target-specific data layout and analysis passes Some new features include: * You can now print all passes being run with `-Z print-llvm-passes` * When specifying passes via `--passes`, the passes are now appended to the default list of passes instead of overwriting them. * The output of `--passes list` is now generated by LLVM instead of maintaining a list of passes ourselves * Loop vectorization is turned on by default as an optimization pass and can be disabled with `-Z no-vectorize-loops` All of these "copies" of clang are based off their [source code](http://clang.llvm.org/doxygen/BackendUtil_8cpp_source.html) in case anyone is curious what my source is. I was hoping that this would fix #8665, but this does not help the performance issues found there. Hopefully i'll allow us to tweak passes or see what's going on to try to debug that problem.
2013-08-26Rewrite pass management with LLVMAlex Crichton-0/+1
Beforehand, it was unclear whether rust was performing the "recommended set" of optimizations provided by LLVM for code. This commit changes the way we run passes to closely mirror that of clang, which in theory does it correctly. The notable changes include: * Passes are no longer explicitly added one by one. This would be difficult to keep up with as LLVM changes and we don't guaranteed always know the best order in which to run passes * Passes are now managed by LLVM's PassManagerBuilder object. This is then used to populate the various pass managers run. * We now run both a FunctionPassManager and a module-wide PassManager. This is what clang does, and I presume that we *may* see a speed boost from the module-wide passes just having to do less work. I have no measured this. * The codegen pass manager has been extracted to its own separate pass manager to not get mixed up with the other passes * All pass managers now include passes for target-specific data layout and analysis passes Some new features include: * You can now print all passes being run with `-Z print-llvm-passes` * When specifying passes via `--passes`, the passes are now appended to the default list of passes instead of overwriting them. * The output of `--passes list` is now generated by LLVM instead of maintaining a list of passes ourselves * Loop vectorization is turned on by default as an optimization pass and can be disabled with `-Z no-vectorize-loops`
2013-08-26std: Make vec::from_elem failure-safeBrian Anderson-4/+30
2013-08-26auto merge of #8438 : cmr/rust/default, r=thestingerbors-16/+36
2013-08-26Add a Default trait.Corey Richardson-16/+36
2013-08-27Decrement unkillable counter before failingFlaper Fesp-3/+5
2013-08-27Don't make the runtime exit on illegal callsFlaper Fesp-16/+36
2013-08-27Testing rekillable fails when called from outside an unkillable blockFlaper Fesp-1/+17
2013-08-27Make rekillable consistent with unkillableFlaper Fesp-16/+27
As for now, rekillable is an unsafe function, instead, it should behave just like unkillable by encapsulating unsafe code within an unsafe block. This patch does that and removes unsafe blocks that were encapsulating rekillable calls throughout rust's libs. Fixes #8232
2013-08-26auto merge of #8766 : brson/rust/vecfromfn, r=alexcrichtonbors-4/+8
A recently-enabled test of this is causing valgrind failures.
2013-08-26std: Make vec::from_fn failure-safeBrian Anderson-4/+8
2013-08-26auto merge of #8488 : klutzy/rust/mingw-w64, r=brsonbors-15/+374
This patchset enables rustc to cross-build mingw-w64 outputs. Tested on mingw + mingw-w64 (mingw-builds, win64/seh/win32-threads/gcc-4.8.1). I also patched llvm to support Win64 stack unwinding. https://github.com/klutzy/llvm/commit/ebe22bdbcebc4f8342c4c7c50e3b61fa6c68c1ad I cross-built test/run-pass/smallest-hello-world.rs and confirmed it works. However, I also found something went wrong if I don't have custom `#[start]` routine.
2013-08-26Support Win64 context switchingklutzy-7/+31
This patch saves and restores win64's nonvolatile registers. This patch also saves stack information of thread environment block (TEB), which is at %gs:0x08 and %gs:0x10.
2013-08-26std: Add Win64 supportklutzy-3/+162
Some extern blobs are duplicated without "stdcall" abi, since Win64 does not use any calling convention. (Giving any abi to them causes llvm producing wrong bytecode.)
2013-08-26std: Bind write() on Win64klutzy-5/+15
2013-08-26std: Add Win64 typesklutzy-0/+166
2013-08-26auto merge of #8737 : blake2-ppc/rust/std-str-rsplit, r=huonwbors-73/+305
Make CharSplitIterator double-ended which is simple given that the operation is symmetric, once the split-N feature is factored out into its own adaptor. `.rsplitn_iter()` allows splitting `N` times from the back of a string, so it is a completely new feature. With the double-ended impl, `.split_iter()`, `.line_iter()`, `.word_iter()` all allow picking off elements from either end. `split_options_iter` is removed with the factoring of the split- and split-N- iterators, instead there is `split_terminator_iter`. --- Add benchmarks using `#[bench]` and tune CharSplitIterator a bit after Huon Wilson's suggestions Benchmarks 1-5 do the same split using different implementations of `CharEq`, all splitting an ascii string on ascii space. Benchmarks 6-7 split a unicode string on an ascii char. Before this PR test str::bench::split_iter_ascii ... bench: 166 ns/iter (+/- 2) test str::bench::split_iter_closure ... bench: 113 ns/iter (+/- 1) test str::bench::split_iter_extern_fn ... bench: 286 ns/iter (+/- 7) test str::bench::split_iter_not_ascii ... bench: 114 ns/iter (+/- 4) test str::bench::split_iter_slice ... bench: 220 ns/iter (+/- 12) test str::bench::split_iter_unicode_ascii ... bench: 217 ns/iter (+/- 3) test str::bench::split_iter_unicode_not_ascii ... bench: 248 ns/iter (+/- 3) PR, first commit test str::bench::split_iter_ascii ... bench: 331 ns/iter (+/- 9) test str::bench::split_iter_closure ... bench: 114 ns/iter (+/- 2) test str::bench::split_iter_extern_fn ... bench: 314 ns/iter (+/- 6) test str::bench::split_iter_not_ascii ... bench: 132 ns/iter (+/- 1) test str::bench::split_iter_slice ... bench: 157 ns/iter (+/- 3) test str::bench::split_iter_unicode_ascii ... bench: 502 ns/iter (+/- 64) test str::bench::split_iter_unicode_not_ascii ... bench: 250 ns/iter (+/- 3) PR, final version test str::bench::split_iter_ascii ... bench: 106 ns/iter (+/- 4) test str::bench::split_iter_closure ... bench: 107 ns/iter (+/- 1) test str::bench::split_iter_extern_fn ... bench: 267 ns/iter (+/- 6) test str::bench::split_iter_not_ascii ... bench: 108 ns/iter (+/- 1) test str::bench::split_iter_slice ... bench: 170 ns/iter (+/- 8) test str::bench::split_iter_unicode_ascii ... bench: 128 ns/iter (+/- 5) test str::bench::split_iter_unicode_not_ascii ... bench: 252 ns/iter (+/- 3) --- There are several ways to deal with `CharEq::only_ascii`. It is a performance optimization, so with that in mind, we allow passing bogus char (outside ascii) as long as they don't match. We use a byte value check to make sure we don't split on these (would split substrings in the middle of encoded char). (A more principled way would be to only pass the ascii codepoints to the CharEq when it indicates only_ascii, but that undoes some of the performance optimization.)
2013-08-26std::str: Tune CharSplitIterator after benchmarksblake2-ppc-55/+44
Implement Huon Wilson's suggestions (since the benchmarks agree!). Use `self.sep.matches(byte as char) && byte < 128u8` to match in the only_ascii case so that mistaken matches outside the ascii range can't create invalid substrings. Put the conditional on only_ascii outside the loop.
2013-08-26std::str: bench tests for .split_iter()blake2-ppc-0/+83
2013-08-25Add _opt variants to str byte-conversion functionsKevin Ballard-9/+108
Add _opt variants to from_bytes, from_bytes_owned, and from_bytes_slice. These variants return an Option instead of raising a condition/failing.
2013-08-25auto merge of #8723 : anasazi/rust/temporary-unkillable-io, r=brsonbors-124/+165
Also added a home_for_io_with_sched variant to consolidate some cases. This is a temporary step to resolving #8674.
2013-08-25std::str: Double-ended CharSplitIteratorblake2-ppc-68/+228
Add new methods `.rsplit_iter()` and `.rsplitn_iter()` for &str. Separate out CharSplitIterator and CharSplitNIterator, CharSplitIterator (`split_iter` and `rsplit_iter`) is made double-ended while `splitn_iter` and `rsplitn_iter` (limited to N splits) are not, since these don't have the same symmetry. With CharSplitIterator being double ended, derived iterators like `line_iter` and `word_iter` are too.
2013-08-24auto merge of #8701 : brson/rust/issue-8698, r=thestingerbors-8/+4
2013-08-24auto merge of #8637 : alexcrichton/rust/ifmt-less-hax, r=graydonbors-38/+60
Recent improvements to `&mut Trait` have made this work possible, and it solidifies that `ifmt` doesn't always have to return a string, but rather it's based around writers.