summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-10-23std::rand: seed ISAAC with no transmutes.Huon Wilson-7/+16
Slice transmutes are now (and, really, always were) dangerous, so we avoid them and do the (only?) non-(undefined behaviour in C) pointer cast: casting to *u8.
2013-10-23std::rand: use "nothing up your sleeve numbers" for ISAAC tests.Huon Wilson-18/+18
There's no value in using the "random" numbers, when nothing up your sleeve numbers are perfectly serviceable. http://en.wikipedia.org/wiki/Nothing_up_my_sleeve_number
2013-10-23std::rand: simplify/safe-ify the default Rng.fill_bytes.Huon Wilson-45/+44
The `&[u8]` -> `&[u64]` and `&[u32]` casts were not nice: they ignored alignment requirements and are generally very unsafe.
2013-10-22auto merge of #10020 : mletterle/rust/documentation-fixes, r=thestingerbors-2/+2
I'm planning on doing more updates, but the section in the tutorial stood out at me since the 'rust' tool no longer exists, this should probably be removed to lessen confusion.
2013-10-23std::rand: move Weighted to distributions.Huon Wilson-132/+207
A user constructs the WeightedChoice distribution and then samples from it, which allows it to use binary search internally.
2013-10-23std::rand: lengthen the RNG benchmarks.Huon Wilson-8/+20
This makes them more representative, as the `bh.iter` is a smaller percentage of the total time.
2013-10-23std::rand: optimise & document ziggurat.Huon Wilson-8/+72
Before: test rand::distributions::bench::rand_exp ... bench: 1399 ns/iter (+/- 124) = 571 MB/s test rand::distributions::bench::rand_normal ... bench: 1611 ns/iter (+/- 123) = 496 MB/s After: test rand::distributions::bench::rand_exp ... bench: 712 ns/iter (+/- 43) = 1123 MB/s test rand::distributions::bench::rand_normal ... bench: 1007 ns/iter (+/- 81) = 794 MB/s
2013-10-23std::rand: documentation & references.Huon Wilson-44/+100
Most importantly, links to the papers/references for the core algorithms (the RNG ones & the distribution ones).
2013-10-23std::rand: add distributions::Range for generating [lo, hi).Huon Wilson-39/+274
This reifies the computations required for uniformity done by (the old) `Rng.gen_integer_range` (now Rng.gen_range), so that they can be amortised over many invocations, if it is called in a loop. Also, it makes it correct, but using a trait + impls for each type, rather than trying to coerce `Int` + `u64` to do the right thing. This also makes it more extensible, e.g. big integers could & should implement SampleRange.
2013-10-23std::rand: full exponential & normal distributionsHuon Wilson-20/+116
Complete the implementation of Exp and Normal started by Exp1 and StandardNormal by creating types implementing Sample & IndependentSample with the appropriate parameters.
2013-10-23std::rand: Add RandSample for Sample-ing Rand types directly.Huon Wilson-0/+35
2013-10-23std::rand: add the Sample and IndependentSample traits.Huon Wilson-0/+18
These are a "parameterised" Rand.
2013-10-22Tidy up asm! usage in libstdAlex Crichton-11/+7
2013-10-23Making ai_next field publicreedlepee-1/+1
2013-10-23Removed the file src/libstd/unstable/extfmt.rreedlepee-703/+0
2013-10-23Removed the unnecesary commentsreedlepee-1/+0
2013-10-23Removed unnecessary comments and white spaces as suggestedreedlepee-49/+21
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-422/+217
2013-10-23Making fields in std and extra : private #4386reedlepee-354/+1286
2013-10-23Don't Make str field privatereedlepee-0/+1
2013-10-22Minor grammatical fixes and removed section on 'rust' toolMichael Letterle-2/+2
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-321/+321
Who doesn't like a massive renaming?
2013-10-22auto merge of #10009 : LeoTestard/rust/asm-feature-gated, r=huonwbors-1/+1
Suite of #9991
2013-10-22Activate checking code for ASM feature gate. Fix testsLéo Testard-1/+1
2013-10-21auto merge of #9937 : brson/rust/log_str, r=alexcrichtonbors-18/+13
2013-10-21auto merge of #9936 : madjar/rust/master, r=alexcrichtonbors-6/+0
This should close #9468. I removed the test stating that nested comments should not be implemented. I had a little chicken-and-egg problem because a comment of the std contains "/*", and adding support for nested comment creates a backward incompatibility in that case, so I had to use a dirty hack to get stage1 and stage2 to compile. This part should be revert when this commit lands in a snapshot. This is my first non-typo contribution, so I'm open to any comment.
2013-10-21auto merge of #10000 : cmr/rust/snapshot, r=alexcrichtonbors-3/+0
2013-10-21Add support for nested commentsGeorges Dubus-6/+0
Fixes #9468.
2013-10-21std: Move sys::log_str to repr::repr_to_str. Further work on #2240.Brian Anderson-18/+13
2013-10-21Register snapshotsCorey Richardson-3/+0
2013-10-21fix the new floating point intrinsicsDaniel Micay-2/+2
2013-10-21auto merge of #9986 : thestinger/rust/float, r=cmrbors-0/+20
copysign, ring, nearbyint, round
2013-10-21expose new floating point intrinsicsDaniel Micay-0/+20
copysign, ring, nearbyint, round
2013-10-20Don't allocate a string when calling printlnAlex Crichton-1/+18
Instead use format_args! to pass around a struct to pass along into std::fmt
2013-10-20auto merge of #9812 : HNO3/rust/windows-utf8, r=alexcrichtonbors-5/+96
This fixes #9418 and #9618, and potential problems related to directory walking.
2013-10-20Fix unicode errors on Windows in path_is_dir, path_exists, getcwd and ↵LEE Wondong-5/+96
rust_localtime. This make these functions use wchar_t version of APIs, instead of char version.
2013-10-19auto merge of #9952 : huonw/rust/fmt-doc, r=alexcrichtonbors-14/+14
Cf. the concern raised in https://github.com/mozilla/rust/pull/9938#issuecomment-26648696.
2013-10-19auto merge of #9834 : alexcrichton/rust/morestack, r=brsonbors-67/+412
This commit re-introduces the functionality of __morestack in a way that it was not originally anticipated. Rust does not currently have segmented stacks, rather just large stack segments. We do not detect when these stack segments are overrun currently, but this commit leverages __morestack in order to check this. This commit purges a lot of the old __morestack and stack limit C++ functionality, migrating the necessary chunks to rust. The stack limit is now entirely maintained in rust, and the "main logic bits" of __morestack are now also implemented in rust as well. I put my best effort into validating that this currently builds and runs successfully on osx and linux 32/64 bit, but I was unable to get this working on windows. We never did have unwinding through __morestack frames, and although I tried poking at it for a bit, I was unable to understand why we don't get unwinding right now. A focus of this commit is to implement as much of the logic in rust as possible. This involved some liberal usage of `no_split_stack` in various locations, along with some use of the `asm!` macro (scary). I modified a bit of C++ to stop calling `record_sp_limit` because this is no longer defined in C++, rather in rust. Another consequence of this commit is that `thread_local_storage::{get, set}` must both be flagged with `#[rust_stack]`. I've briefly looked at the implementations on osx/linux/windows to ensure that they're pretty small stacks, and I'm pretty sure that they're definitely less than 20K stacks, so we probably don't have a lot to worry about. Other things worthy of note: * The default stack size is now 4MB instead of 2MB. This is so that when we request 2MB to call a C function you don't immediately overflow because you have consumed any stack at all. * `asm!` is actually pretty cool, maybe we could actually define context switching with it? * I wanted to add links to the internet about all this jazz of storing information in TLS, but I was only able to find a link for the windows implementation. Otherwise my suggestion is just "disassemble on that arch and see what happens" * I put my best effort forward on arm/mips to tweak __morestack correctly, we have no ability to test this so an extra set of eyes would be useful on these spots. * This is all really tricky stuff, so I tried to put as many comments as I thought were necessary, but if anything is still unclear (or I completely forgot to take something into account), I'm willing to write more!
2013-10-19Use __morestack to detect stack overflowAlex Crichton-67/+412
This commit resumes management of the stack boundaries and limits when switching between tasks. This additionally leverages the __morestack function to run code on "stack overflow". The current behavior is to abort the process, but this is probably not the best behavior in the long term (for deails, see the comment I wrote up in the stack exhaustion routine).
2013-10-19std::fmt: fix markdown peculiarity, unicodify some arrows, ` some trait names.Huon Wilson-14/+14
2013-10-19auto merge of #9932 : alexcrichton/rust/better-fmt-errors, r=cmrbors-24/+27
Instead of just saying "unterminated format string" and friends, instead print information about what was expected and what was found. Closes #9931
2013-10-18Try to improve format! error messagesAlex Crichton-24/+27
Instead of just saying "unterminated format string" and friends, instead print information about what was expected and what was found. Closes #9931
2013-10-18auto merge of #9938 : alexcrichton/rust/fmtdox, r=huonwbors-3/+48
Closes #9865 Closes #9808
2013-10-18auto merge of #9919 : alexcrichton/rust/fmt-begone, r=huonwbors-704/+0
It lived a good life, but its time has come. The groundwork is set for the official transition after the next snapshot (removal of XXX2 macros)
2013-10-18Remove the fmt! syntax extensionAlex Crichton-704/+0
It lived a good life, but its time has come. The groundwork is set for the official transition after the next snapshot (removal of XXX2 macros)
2013-10-18Document traits and Default about format! betterAlex Crichton-3/+48
Closes #9865 Closes #9808
2013-10-18auto merge of #9935 : reedlepee123/rust/my_new_branch, r=bstriebors-6/+6
2013-10-19Make fields in std::comm privatechitra-6/+6
2013-10-18Fix an off-by-one in managed::refcountAlex Crichton-1/+12
This fixes a bug I accidentally introduced in #9922
2013-10-18auto merge of #9926 : Kimundi/rust/future_result_bad_sig, r=huonwbors-64/+30