summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-11-23Add ctype-likes to AsciiCorey Richardson-0/+68
2013-11-22Add Rc::from_mutSteven Fackler-0/+17
2013-11-22More Mut testsSteven Fackler-0/+9
2013-11-22Strip down Cell functionalitySteven Fackler-59/+3
2013-11-22Change Mut::map to Mut::withSteven Fackler-19/+19
2013-11-22Make MutRef more consistent with &mutSteven Fackler-9/+9
2013-11-22Cell -> Mut switch in commSteven Fackler-20/+24
2013-11-22Move Rc tests away from CellSteven Fackler-7/+7
2013-11-22Remove RcMutSteven Fackler-237/+0
Rc<Mut<T>> should be used instead
2013-11-22Introduce Mut<T> to libstdSteven Fackler-0/+299
Based off of blake2-ppc's work in #9429.
2013-11-22auto merge of #10612 : pnkfelix/rust/remove-cut-and-pasted-rt-fixme, r=pcwaltonbors-1/+0
I cannot tell whether the original comment was unsure about the arithmetic calculations, or if it was unsure about the assumptions being made about the alignment of the current allocation pointer. The arithmetic calculation looks fine to me, though. This technique is documented e.g. in Henry Warren's "Hacker's Delight" (section 3-1). (I am sure one can find it elsewhere too, its not an obscure property.)
2013-11-22The original fixme #2699 was removed back in PR #6053.Felix S. Klock II-1/+0
I cannot tell whether the original comment was unsure about the arithmetic calculations, or if it was unsure about the assumptions being made about the alignment of the current allocation pointer. The arithmetic calculation looks fine to me, though. This technique is documented e.g. in Henry Warren's "Hacker's Delight" (section 3-1). (I am sure one can find it elsewhere too, its not an obscure property.)
2013-11-22auto merge of #10610 : thestinger/rust/breakpoint, r=pnkfelixbors-0/+4
This can be used to grab the attention of a debugger, and unlike `abort` execution can be resumed.
2013-11-22add a breakpoint intrinsic for debuggingDaniel Micay-0/+4
This can be used to grab the attention of a debugger, and unlike `abort` execution can be resumed.
2013-11-22auto merge of #10582 : g3xzh/rust/master, r=cmrbors-2/+70
More new benchmark tests. some of them are benchmarking `starts_with` and `ends_with`. Let me know if I am missing something. Thanks in advance.
2013-11-22Add more benchmark tests to vec.rsg3xzh-2/+70
New benchmark tests in vec.rs: `push`, `starts_with_same_vector`, `starts_with_single_element`, `starts_with_diff_one_element_end`, `ends_with_same_vector`, `ends_with_single_element`, `ends_with_diff_one_element_beginning` and `contains_last_element`
2013-11-21auto merge of #10588 : huonw/rust/un@mutilate-task_rng, r=alexcrichtonbors-30/+43
Replace with some unsafe code by storing a pointer into TLS-owned heap data.
2013-11-22std::rand: move TaskRng off @mut.Huon Wilson-30/+43
Replace with some unsafe code by storing a pointer into TLS-owned heap data.
2013-11-21`std::ptr::read_ptr` now takes `*T` instead of `*mut T`Ziad Hatahet-3/+3
Closes #10579
2013-11-20auto merge of #10576 : thestinger/rust/gc, r=pcwaltonbors-0/+100
This isn't very useful yet, but it does replace most functionality of `@T`. The `Mut<T>` type will make it unnecessary to have a `GcMut<T>` so I haven't included one. Obviously it doesn't work for trait objects but that needs to be figured out for `Rc<T>` too.
2013-11-19add an initial `Gc<T>` stub with the APIDaniel Micay-0/+100
2013-11-19Remove NonCopyable::newSteven Fackler-6/+0
The issue that required it has been fixed.
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-236/+270
2013-11-19auto merge of #10495 : alexcrichton/rust/more-native-io, r=brsonbors-651/+1054
This implements a fair amount of the unimpl() functionality in io::native relating to filesystem operations. I've also modified all io::fs tests to run in both a native and uv environment (so everything is actually tested). There are a few bits of remaining functionality which I was unable to get working: * truncate on windows * change_file_times on windows * lstat on windows I think that change_file_times may just need a better interface, but the other two have large implementations in libuv which I didn't want to tackle trying to copy. I found a `chsize` function to work for truncate on windows, but it doesn't quite seem to be working out.
2013-11-19Implement more native file I/OAlex Crichton-651/+1054
This implements a fair amount of the unimpl() functionality in io::native relating to filesystem operations. I've also modified all io::fs tests to run in both a native and uv environment (so everything is actually tested). There are a two bits of remaining functionality which I was unable to get working: * change_file_times on windows * lstat on windows I think that change_file_times may just need a better interface, but lstat has a large implementation in libuv which I didn't want to tackle trying to copy.
2013-11-19auto merge of #10558 : alexcrichton/rust/faster-stdout, r=pcwalton,pcwaltonbors-0/+2
There are issues with reading stdin when it is actually attached to a pipe, but I have run into no problems in writing to stdout/stderr when they are attached to pipes.
2013-11-19auto merge of #10542 : huonw/rust/open01, r=alexcrichtonbors-39/+122
Provide `Closed01` and `Open01` that generate directly from the closed/open intervals from 0 to 1, in contrast to the plain impls for f32 and f64 which generate the half-open [0,1). Fixes #7755.
2013-11-18auto merge of #10561 : pcwalton/rust/procify, r=alexcrichtonbors-82/+92
r? @alexcrichton
2013-11-18Move runtime files to C instead of C++Alex Crichton-0/+1
Explicitly have the only C++ portion of the runtime be one file with exception handling. All other runtime files must now live in C and be fully defined in C.
2013-11-18Remove the C++ lock_and_signal typeAlex Crichton-94/+90
A the same time this purges all runtime support needed for statically initialized mutexes, moving all users over to the new Mutex type instead.
2013-11-18Implement a native mutex typeAlex Crichton-0/+337
This mutex is built on top of pthreads for unix and the related windows apis on windows. This is a straight port of the lock_and_signal type from C++ to rust. Almost all operations on the type are unsafe, and it's definitely not recommended for general use. Closes #9105
2013-11-18libstd: Change all `~fn()`s to `proc`s in the standard library.Patrick Walton-82/+92
This makes `Cell`s no longer necessary in most cases.
2013-11-18Disable priv in std::comm::Port, etcDiego Ongaro-6/+7
It's useful to allow users to get at the internal std::rc::comm::Port, and other such fields, since they implement important traits like Select.
2013-11-18Allow piped stdout/stderr use uv_tty_tAlex Crichton-0/+2
There are issues with reading stdin when it is actually attached to a pipe, but I have run into no problems in writing to stdout/stderr when they are attached to pipes.
2013-11-18rt: Namespace all C functions under rust_Brian Anderson-8/+8
2013-11-18std::rand: wrappers for floats from [0,1] and (0,1).Huon Wilson-39/+122
Provide `Closed01` and `Open01` that generate directly from the closed/open intervals from 0 to 1, in contrast to the plain impls for f32 and f64 which generate the half-open [0,1). Fixes #7755.
2013-11-17Fixed docs for advance() in Iterator traitAndrei Formiga-6/+3
2013-11-17Fixed uses of get() to unwrap() in doc examples in std::iterAndrei Formiga-28/+28
2013-11-17auto merge of #10466 : alexcrichton/rust/issue-10334, r=cmrbors-102/+157
These commits create a `Buffer` trait in the `io` module which represents an I/O reader which is internally buffered. This abstraction is used to reasonably implement `read_line` and `read_until` along with at least an ok implementation of `read_char` (although I certainly haven't benchmarked `read_char`).
2013-11-16auto merge of #10420 : sanxiyn/rust/path, r=cmrbors-1/+1
Fix #10283.
2013-11-16Implement read_char on the Buffer traitAlex Crichton-0/+43
2013-11-14remove `cast::unsafe_copy`Daniel Micay-8/+0
This is the same functionality as `ptr::read_ptr`.
2013-11-14auto merge of #10428 : toffaletti/rust/try_lock, r=alexcrichtonbors-1/+16
I need try_lock for an algorithm I'm trying to implement in Rust.
2013-11-14test: Fix signal-exit-status on windowsklutzy-0/+1
2013-11-13auto merge of #10457 : alexcrichton/rust/native-io, r=brsonbors-350/+434
This commit re-organizes the io::native module slightly in order to have a working implementation of rtio::IoFactory which uses native implementations. The goal is to seamlessly multiplex among libuv/native implementations wherever necessary. Right now most of the native I/O is unimplemented, but we have existing bindings for file descriptors and processes which have been hooked up. What this means is that you can now invoke println!() from libstd with no local task, no local scheduler, and even without libuv. There's still plenty of work to do on the native I/O factory, but this is the first steps into making it an official portion of the standard library. I don't expect anyone to reach into io::native directly, but rather only std::io primitives will be used. Each std::io interface seamlessly falls back onto the native I/O implementation if the local scheduler doesn't have a libuv one (hurray trait ojects!)
2013-11-13Implement native::IoFactoryAlex Crichton-350/+434
This commit re-organizes the io::native module slightly in order to have a working implementation of rtio::IoFactory which uses native implementations. The goal is to seamlessly multiplex among libuv/native implementations wherever necessary. Right now most of the native I/O is unimplemented, but we have existing bindings for file descriptors and processes which have been hooked up. What this means is that you can now invoke println!() from libstd with no local task, no local scheduler, and even without libuv. There's still plenty of work to do on the native I/O factory, but this is the first steps into making it an official portion of the standard library. I don't expect anyone to reach into io::native directly, but rather only std::io primitives will be used. Each std::io interface seamlessly falls back onto the native I/O implementation if the local scheduler doesn't have a libuv one (hurray trait ojects!)
2013-11-13add rust_trylock_little_lockJason Toffaletti-1/+16
Try to acquire lock and succeed only if lock is not already held. Uses TryEnterCriticalSection or pthread_mutex_trylock.
2013-11-13auto merge of #10451 : zkamsler/rust/buf_writer, r=alexcrichtonbors-10/+99
I implemented BufWriter. I realize the use of conditions are on their way out for IO, but it does raise a condition if a write will not fit in the buffer for now. I also replaced the seek code for MemWriter. It was adding the offset as a uint, which is unsound for negative offsets. It only happened to work because unsigned addition performs the same operation with two's complement, and sizeof(uint) <= sizeof(i64) so there was no (lack of) sign extension. I replaced this with computing an offset as an i64 and clamping to zero. I don't expect anyone will have use BufWriter with a byte buffer greater than 2^63 bytes any time soon. @alexcrichton Closes #10433
2013-11-13Introduce an io::Buffer traitAlex Crichton-102/+114
This trait is meant to abstract whether a reader is actually implemented with an underlying buffer. For all readers which are implemented as such, we can efficiently implement things like read_char, read_line, read_until, etc. There are two required methods for managing the internal buffer, and otherwise read_line and friends can all become default methods. Closes #10334
2013-11-13Implemented BufWriterZach Kamsler-10/+99
Filled in the implementations of Writer and Seek for BufWriter. It raises the io_error condition if a write cannot fit in the buffer. The Seek implementation for MemWriter, which was incorrectly using unsigned arithmatic to add signed offsets, has also been replaced.