summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-06-02ptr: split out borrowed pointer utilitiesDaniel Micay-48/+64
The ptr module is intended to be for raw pointers. Closes #3111
2013-06-02Add a get_mut method to accompany the get method.gareth-0/+9
2013-06-01auto merge of #6896 : nickdesaulniers/rust/issue4501, r=brsonbors-10/+10
review? @brson
2013-06-01auto merge of #6815 : kballard/rust/hashmap-insert_or_modify_with, r=ericktbors-36/+35
`std::hashmap::HashMap.insert_or_update_with()` is basically the opposite of `find_or_insert_with()`. It inserts a given key-value pair if the key does not already exist, or replaces the existing value with the output of the passed function if it does. This is useful because replicating this with existing functionality is awkward, especially with the current borrow-checker. In my own project I have code that looks like if match map.find_mut(&key) { None => { true } Some(x) => { *x += 1; false } } { map.insert(key, 0); } and it took several iterations to make it look this good. The new function turns this into map.insert_or_update_with(key, 0, |_,x| *x += 1);
2013-06-01Swap return value of pipes::init Fixes #4501Nick Desaulniers-10/+10
2013-06-01Add new function hashmap.insert_or_update_with()Kevin Ballard-0/+15
fn insert_or_update_with<'a>(&'a mut self, k: K, f: &fn(&K, &mut V)) -> &'a V
2013-06-01Refactor some hashmap code into a new private function mangle()Kevin Ballard-37/+21
Add new private hashmap function fn mangle(&mut self, k: K, not_found: &fn(&K) -> V, found: &fn(&K, &mut V)) -> uint Rewrite find_or_insert() and find_or_insert_with() on top of mangle(). Also take the opportunity to change the return type of find_or_insert() and find_or_insert_with() to &'a mut V. This fixes #6394.
2013-06-01Fix vec::each* return valuesJed Davis-2/+19
2013-06-01std: fix run tests when symlink is in the rust checkout pathErick Tryzelaar-6/+12
2013-06-01Remove all uses of `pub impl`. rs=stylePatrick Walton-306/+329
2013-05-31auto merge of #6851 : alexcrichton/rust/bugfixes, r=pcwaltonbors-3/+19
Closes #5090 by using the excellent new generic deriving code Promotes the unreachable code attribute to a lint attribute (instead of always being a warning) Fixes some edge cases when creating hashmaps/hashsets and also when consuming them. (fixes #5998)
2013-05-31auto merge of #6876 : cmr/rust/from_elem_opts, r=Aatchbors-3/+15
borrowck 1.85x speedup on libstd
2013-06-01Optimize vec::from_elem with manual inlining (borrowck 1.85x speedup on libstd)Corey Richardson-3/+15
2013-05-31auto merge of #6729 : bstrie/rust/ascstr, r=Aatchbors-23/+40
Formerly this was a free function rather than a method. I've left it in place for now, although redefined it so that it just calls the method.
2013-05-31auto merge of #6864 : thestinger/rust/bool, r=pcwaltonbors-49/+38
2013-05-31bool: rm functions duplicating methodsDaniel Micay-49/+38
2013-05-31Add as_c_str method on stringsBen Striegel-23/+40
2013-05-31ptr: replace unnecessary unsafe codeDaniel Micay-58/+18
2013-05-31mv the raw pointer {swap,replace}_ptr to std::ptrDaniel Micay-42/+43
2013-05-31auto merge of #6853 : bblum/rust/sized, r=pcwaltonbors-1/+6
r? @nikomatsakis @pcwalton
2013-05-31auto merge of #6833 : fdr/rust/fix-warnings, r=Aatchbors-20/+13
Fix a laundry list of warnings involving unused imports that glutted up compilation output. There are more, but there seems to be some false positives (where 'remedy' appears to break the build), but this particular set of fixes seems safe.
2013-05-30auto merge of #6841 : steveklabnik/rust/range_docs, r=thestingerbors-3/+12
2013-05-30Fix a bug with HashMap::consumeAlex Crichton-3/+19
2013-05-30Add 'Sized' builtin kind; doesn't do anything yetBen Blum-1/+6
2013-05-30Add example for uint::range_step.Steve Klabnik-3/+12
2013-05-30Remove unnecessary 'use' formsDaniel Farina-20/+13
Fix a laundry list of warnings involving unused imports that glutted up compilation output. There are more, but there seems to be some false positives (where 'remedy' appears to break the build), but this particular set of fixes seems safe.
2013-05-30Remove copy bindings from patterns.Niko Matsakis-23/+23
2013-05-30Remove a bunch of unnecessary allocations and copiesBjörn Steinbrink-3/+2
2013-05-30libextra: Require documentation by defaultAlex Crichton-0/+2
2013-05-30Require documentation by default for libstdAlex Crichton-69/+699
Adds documentation for various things that I understand. Adds #[allow(missing_doc)] for lots of things that I don't understand.
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-111/+162
2013-05-29librustc: Redo the unsafe checker and make unsafe methods not callable from ↵Patrick Walton-43/+61
safe code
2013-05-29auto merge of #6803 : Thiez/rust/native_fmax_fmin, r=brsonbors-4/+19
Calls to the libc versions of fmin and fmax were relatively slow (perhaps because they could not be inlined?). This pull request provides f32 and f64 with fmin and fmax written in Rust, and shows a significant speed increase on my system; I used https://github.com/thiez/rustray as my benchmark, with --opt-level 3 it brings the ray-tracing time down from 10.8 seconds to about 9.2, which seemed significant to me. r?
2013-05-29Changed to a more efficient implementation.Matthijs Hofstra-16/+4
2013-05-29Replaced calls to external fmin/fmax by a Rust implementation.Matthijs Hofstra-4/+31
2013-05-29Fix vec::mut_slicejune0cho-3/+3
2013-05-28auto merge of #6780 : june0cho/rust/issue5984, r=brsonbors-2/+9
Fix #5984. Also, I found a problem on type inference and left a comment.
2013-05-28auto merge of #6740 : Aatch/rust/atomic-types, r=brsonbors-68/+118
This is a follow up to #6732. Makes everything a little more sound. r? @brson
2013-05-28Silence various warnings throughout test modulesAlex Crichton-90/+90
2013-05-28auto merge of #6771 : thestinger/rust/highlight, r=luqmanabors-98/+140
This works with pandoc linked against highlighting-kate >= 0.5.3.8. It seems to just be a no-op with earlier versions, because I successfully ran this through `try`. This also fixes some consistency issues (like making `Example`/`Examples` always a header and always using three tildes).
2013-05-28core::vec is missing methods for mutable slicesJunyoung Cho-2/+9
2013-05-27auto merge of #6724 : thestinger/rust/swap_fast, r=thestingerbors-25/+116
Passing higher alignment values gives the optimization passes more freedom since it can copy in larger chunks. This change results in rustc outputting the same post-optimization IR as clang for swaps and most copies excluding the lack of information about padding. Code snippet: ```rust #[inline(never)] fn swap<T>(x: &mut T, y: &mut T) { util::swap(x, y); } ``` Original IR (for `int`): ```llvm define internal fastcc void @_ZN9swap_283417_a71830ca3ed2d65d3_00E(i64*, i64*) #1 { static_allocas: %2 = icmp eq i64* %0, %1 br i1 %2, label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit, label %3 ; <label>:3 ; preds = %static_allocas %4 = load i64* %0, align 1 %5 = load i64* %1, align 1 store i64 %5, i64* %0, align 1 store i64 %4, i64* %1, align 1 br label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit _ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit: ; preds = %3, %static_allocas ret void } ``` After #6710: ```llvm define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 { static_allocas: %2 = load i64* %0, align 1 %3 = load i64* %1, align 1 store i64 %3, i64* %0, align 1 store i64 %2, i64* %1, align 1 ret void } ``` After this change: ```llvm define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 { static_allocas: %2 = load i64* %0, align 8 %3 = load i64* %1, align 8 store i64 %3, i64* %0, align 8 store i64 %2, i64* %1, align 8 ret void } ``` Another example: ```rust #[inline(never)] fn set<T>(x: &mut T, y: T) { *x = y; } ``` Before, with `(int, int)` (align 1): ```llvm define internal fastcc void @_ZN8set_282517_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 { static_allocas: %2 = bitcast { i64, i64 }* %1 to i8* %3 = bitcast { i64, i64 }* %0 to i8* tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 1, i1 false) ret void } ``` After, with `(int, int)` (align 8): ```llvm define internal fastcc void @_ZN8set_282617_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 { static_allocas: %2 = bitcast { i64, i64 }* %1 to i8* %3 = bitcast { i64, i64 }* %0 to i8* tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 8, i1 false) ret void } ```
2013-05-27fix casts on 32-bitDaniel Micay-2/+2
2013-05-27auto merge of #6703 : sanxiyn/rust/allocation-lint, r=sanxiynbors-5/+5
Fix #6145. In particular, handle operator overloading.
2013-05-27syntax highlight code examples in docstringsDaniel Micay-98/+140
2013-05-28Remove unnecessary allocations flagged by lintSeo Sanghyeon-5/+5
2013-05-27Get rid of no-longer-needed #[doc(hidden)] attributes.Lindsey Kuper-11/+2
There were several old `#[doc(hidden)]` attributes in libstd and libextra, left over from when rustdoc didn't hide private definitions, tagged with `FIXME #3538`. Since #3538 is now closed, I removed the `#[doc(hidden)]` attributes as well as the FIXMEs, but I left `#[doc(hidden)]` in libstd/task/spawn.rs and libstd/task/rt.rs since those two are apparently `pub`, as well as in libextra/std.rc since std/extra is `pub`.
2013-05-27auto merge of #6763 : steveklabnik/rust/core_to_std, r=thestingerbors-20/+20
When I submitted #6748 yesterday, I used the old name. r? @thestinger
2013-05-27Fix docs to use std instead of core.Steve Klabnik-20/+20
When I submitted #6748 yesterday, I used the old name.
2013-05-27Rename unwrap_input/unwrap_output as suggested bygareth-11/+11
@brson. Also fix a few documentation bugs.