]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #10082 : brson/rust/gyp, r=huonw
bors [Sat, 26 Oct 2013 04:09:37 +0000 (21:09 -0700)]
auto merge of #10082 : brson/rust/gyp, r=huonw

The upstream repo has been offline for hours. A single point of failure is plenty.

10 years agoPoint gyp submodule toward github
Brian Anderson [Sat, 26 Oct 2013 03:22:07 +0000 (20:22 -0700)]
Point gyp submodule toward github

10 years agoauto merge of #10067 : sanxiyn/rust/addr-of-bot, r=thestinger
bors [Fri, 25 Oct 2013 19:56:20 +0000 (12:56 -0700)]
auto merge of #10067 : sanxiyn/rust/addr-of-bot, r=thestinger

Fix #5500.

10 years agoauto merge of #10066 : sanxiyn/rust/mut-ptr-clone, r=thestinger
bors [Fri, 25 Oct 2013 18:46:11 +0000 (11:46 -0700)]
auto merge of #10066 : sanxiyn/rust/mut-ptr-clone, r=thestinger

10 years agoauto merge of #10060 : alexcrichton/rust/cached-stdout, r=brson
bors [Fri, 25 Oct 2013 17:36:09 +0000 (10:36 -0700)]
auto merge of #10060 : alexcrichton/rust/cached-stdout, r=brson

Almost all languages provide some form of buffering of the stdout stream, and
this commit adds this feature for rust. A handle to stdout is lazily initialized
in the Task structure as a buffered owned Writer trait object. The buffer
behavior depends on where stdout is directed to. Like C, this line-buffers the
stream when the output goes to a terminal (flushes on newlines), and also like C
this uses a fixed-size buffer when output is not directed at a terminal.

We may decide the fixed-size buffering is overkill, but it certainly does reduce
write syscall counts when piping output elsewhere. This is a *huge* benefit to
any code using logging macros or the printing macros. Formatting emits calls to
`write` very frequently, and to have each of them backed by a write syscall was
very expensive.

In a local benchmark of printing 10000 lines of "what" to stdout, I got the
following timings:

  when |  terminal   |  redirected
----------|---------------|--------
before |  0.575s     |   0.525s
after  |  0.197s     |   0.013s
  C    |  0.019s     |   0.004s

I can also confirm that we're buffering the output appropriately in both
situtations. We're still far slower than C, but I believe much of that has to do
with the "homing" that all tasks due, we're still performing an order of
magnitude more write syscalls than C does.

10 years agoCache and buffer stdout per-task for printing
Alex Crichton [Fri, 25 Oct 2013 00:30:36 +0000 (17:30 -0700)]
Cache and buffer stdout per-task for printing

Almost all languages provide some form of buffering of the stdout stream, and
this commit adds this feature for rust. A handle to stdout is lazily initialized
in the Task structure as a buffered owned Writer trait object. The buffer
behavior depends on where stdout is directed to. Like C, this line-buffers the
stream when the output goes to a terminal (flushes on newlines), and also like C
this uses a fixed-size buffer when output is not directed at a terminal.

We may decide the fixed-size buffering is overkill, but it certainly does reduce
write syscall counts when piping output elsewhere. This is a *huge* benefit to
any code using logging macros or the printing macros. Formatting emits calls to
`write` very frequently, and to have each of them backed by a write syscall was
very expensive.

In a local benchmark of printing 10000 lines of "what" to stdout, I got the
following timings:

  when |  terminal   |  redirected
----------------------------------
before |  0.575s     |   0.525s
after  |  0.197s     |   0.013s
  C    |  0.019s     |   0.004s

I can also confirm that we're buffering the output appropriately in both
situtations. We're still far slower than C, but I believe much of that has to do
with the "homing" that all tasks due, we're still performing an order of
magnitude more write syscalls than C does.

10 years agoAllow taking address of bottom
Seo Sanghyeon [Fri, 25 Oct 2013 10:15:29 +0000 (19:15 +0900)]
Allow taking address of bottom

10 years agoImplement Clone trait for mutable unsafe pointers
Seo Sanghyeon [Fri, 25 Oct 2013 09:43:55 +0000 (18:43 +0900)]
Implement Clone trait for mutable unsafe pointers

10 years agoauto merge of #10054 : alexcrichton/rust/basic-event-loop, r=brson
bors [Fri, 25 Oct 2013 07:46:11 +0000 (00:46 -0700)]
auto merge of #10054 : alexcrichton/rust/basic-event-loop, r=brson

This is more progress towards #9128 and all its related tree of issues. This implements a new `BasicLoop` on top of pthreads synchronization primitives (wrapped in `LittleLock`). This also removes the wonky `callback_ms` function from the interface of the event loop.

After #9901 is taking forever to land, I'm going to try to do all this runtime work in much smaller chunks than before. Right now this will not work unless #9901 lands first, but I'm close to landing it (hopefully), and I wanted to go ahead and get this reviewed before throwing it at bors later on down the road.

This "pausible idle callback" is also a bit of a weird idea, but it wasn't as difficult to implement as callback_ms so I'm more semi-ok with it.

10 years agoImplement a basic event loop built on LittleLock
Alex Crichton [Tue, 22 Oct 2013 22:00:37 +0000 (15:00 -0700)]
Implement a basic event loop built on LittleLock

It's not guaranteed that there will always be an event loop to run, and this
implementation will serve as an incredibly basic one which does not provide any
I/O, but allows the scheduler to still run.

cc #9128

10 years agoauto merge of #10061 : thestinger/rust/rustc, r=alexcrichton
bors [Fri, 25 Oct 2013 06:36:10 +0000 (23:36 -0700)]
auto merge of #10061 : thestinger/rust/rustc, r=alexcrichton

10 years agoremove some dead trans code
Daniel Micay [Fri, 25 Oct 2013 01:58:47 +0000 (21:58 -0400)]
remove some dead trans code

10 years agoauto merge of #10059 : thestinger/rust/glue, r=pcwalton
bors [Fri, 25 Oct 2013 01:56:05 +0000 (18:56 -0700)]
auto merge of #10059 : thestinger/rust/glue, r=pcwalton

Closes #10045

10 years agostop trying to outsmart LLVM inline heuristics
Daniel Micay [Fri, 25 Oct 2013 00:41:23 +0000 (20:41 -0400)]
stop trying to outsmart LLVM inline heuristics

Closes #10045

10 years agoauto merge of #10055 : pcwalton/rust/arc-clone-inline, r=alexcrichton
bors [Fri, 25 Oct 2013 00:36:07 +0000 (17:36 -0700)]
auto merge of #10055 : pcwalton/rust/arc-clone-inline, r=alexcrichton

r? @thestinger

10 years agoRemove the 'callback_ms' function from EventLoop
Alex Crichton [Thu, 24 Oct 2013 18:30:35 +0000 (11:30 -0700)]
Remove the 'callback_ms' function from EventLoop

This is a peculiar function to require event loops to implement, and it's only
used in one spot during tests right now. Instead, a possibly more robust apis
for timers should be used rather than requiring all event loops to implement a
curious-looking function.

10 years agoFix a bug with the scheduler and destructor order
Alex Crichton [Tue, 22 Oct 2013 21:59:21 +0000 (14:59 -0700)]
Fix a bug with the scheduler and destructor order

The PausibleIdleCallback must have some handle into the event loop, and because
struct destructors are run in order of top-to-bottom in order of fields, this
meant that the event loop was getting destroyed before the idle callback was
getting destroyed.

I can't confirm that this fixes a problem in how we use libuv, but it does
semantically fix a problem for usage with other event loops.

10 years agoauto merge of #9901 : alexcrichton/rust/unix-sockets, r=brson
bors [Thu, 24 Oct 2013 21:26:15 +0000 (14:26 -0700)]
auto merge of #9901 : alexcrichton/rust/unix-sockets, r=brson

Large topics:

* Implemented `rt::io::net::unix`. We've got an implementation backed by "named pipes" for windows for free from libuv, so I'm not sure if these should be `cfg(unix)` or whether they'd be better placed in `rt::io::pipe` (which is currently kinda useless), or to leave in `unix`. Regardless, we probably shouldn't deny windows of functionality which it certainly has.
* Fully implemented `net::addrinfo`, or at least fully implemented in the sense of making the best attempt to wrap libuv's `getaddrinfo` api
* Moved standard I/O to a libuv TTY instead of just a plain old file descriptor. I found that this interacted better when closing stdin, and it has the added bonus of getting things like terminal dimentions (someone should make a progress bar now!)
* Migrate to `~Trait` instead of a typedef'd object where possible. There are only two more types which are blocked on this, and those are traits which have a method which takes by-value self (there's an open issue on this)
* Drop `rt::io::support::PathLike` in favor of just `ToCStr`. We recently had a lot of Path work done, but it still wasn't getting passed down to libuv (there was an intermediate string conversion), and this allows true paths to work all the way down to libuv (and anything else that can become a C string).
* Removes `extra::fileinput` and `extra::io_util`

Closes #9895
Closes #9975
Closes #8330
Closes #6850 (ported lots of libraries away from std::io)
cc #4248 (implemented unix/dns)
cc #9128 (made everything truly trait objects)

10 years agoAnother round of test fixes and merge conflicts
Alex Crichton [Tue, 22 Oct 2013 16:36:30 +0000 (09:36 -0700)]
Another round of test fixes and merge conflicts

10 years agoBring io::signal up to date with changes to rt::rtio
Alex Crichton [Tue, 22 Oct 2013 15:51:44 +0000 (08:51 -0700)]
Bring io::signal up to date with changes to rt::rtio

10 years agowrapping libuv signal for use in Rust
Do Nhat Minh [Thu, 19 Sep 2013 04:03:50 +0000 (12:03 +0800)]
wrapping libuv signal for use in Rust
descriptive names
easier-to-use api
reorganize and document

10 years agoFixing some tests, adding some pipes
Alex Crichton [Tue, 22 Oct 2013 15:41:05 +0000 (08:41 -0700)]
Fixing some tests, adding some pipes

This adds constructors to pipe streams in the new runtime to take ownership of
file descriptors, and also fixes a few tests relating to the std::run changes
(new errors are raised on io_error and one test is xfail'd).

10 years agoMigrate std::run to libuv processes
Alex Crichton [Tue, 22 Oct 2013 06:44:11 +0000 (23:44 -0700)]
Migrate std::run to libuv processes

10 years agoRemove std::io once and for all!
Alex Crichton [Tue, 22 Oct 2013 06:06:12 +0000 (23:06 -0700)]
Remove std::io once and for all!

10 years agoRemove std::io from ebml
Alex Crichton [Tue, 22 Oct 2013 00:11:42 +0000 (17:11 -0700)]
Remove std::io from ebml

10 years agoTest fixes and merge conflicts
Alex Crichton [Fri, 18 Oct 2013 04:08:48 +0000 (21:08 -0700)]
Test fixes and merge conflicts

10 years agoMove stdin to using libuv's pipes instead of a tty
Alex Crichton [Fri, 18 Oct 2013 21:01:22 +0000 (14:01 -0700)]
Move stdin to using libuv's pipes instead of a tty

I was seeing a lot of weird behavior with stdin behaving as a tty, and it
doesn't really quite make sense, so instead this moves to using libuv's pipes
instead (which make more sense for stdin specifically).

This prevents piping input to rustc hanging forever.

10 years agoRemove io::read_error
Alex Crichton [Fri, 18 Oct 2013 18:52:23 +0000 (11:52 -0700)]
Remove io::read_error

The general idea is to remove conditions completely from I/O, so in the meantime
remove the read_error condition to mean the same thing as the io_error condition.

10 years agoStop logging task failure to task loggers
Alex Crichton [Fri, 18 Oct 2013 01:51:32 +0000 (18:51 -0700)]
Stop logging task failure to task loggers

The isn't an ideal patch, and the comment why is in the code. Basically uvio
uses task::unkillable which touches the kill flag for a task, and if the task is
failing due to mismangement of the kill flag, then there will be serious
problems when the task tries to print that it's failing.

10 years agoRemove even more of std::io
Alex Crichton [Mon, 14 Oct 2013 01:48:47 +0000 (18:48 -0700)]
Remove even more of std::io

Big fish fried here:

    extra::json
    most of the compiler
    extra::io_util removed
    extra::fileinput removed

Fish left to fry

    extra::ebml

10 years agoMove as much I/O as possible off of native::io
Alex Crichton [Fri, 18 Oct 2013 00:04:51 +0000 (17:04 -0700)]
Move as much I/O as possible off of native::io

When uv's TTY I/O is used for the stdio streams, the file descriptors are put
into a non-blocking mode. This means that other concurrent writes to the same
stream can fail with EAGAIN or EWOULDBLOCK. By all I/O to event-loop I/O, we
avoid this error.

There is one location which cannot move, which is the runtime's dumb_println
function. This was implemented to handle the EAGAIN and EWOULDBLOCK errors and
simply retry again and again.

10 years agoMigrate the last typedefs to ~Trait in rtio
Alex Crichton [Thu, 17 Oct 2013 19:13:29 +0000 (12:13 -0700)]
Migrate the last typedefs to ~Trait in rtio

There are no longer any remnants of typedefs, and everything is now built on
true trait objects.

10 years agoDon't attempt to export uv functions directly
Alex Crichton [Thu, 17 Oct 2013 18:28:05 +0000 (11:28 -0700)]
Don't attempt to export uv functions directly

10 years agoRemove IoFactoryObject for ~IoFactory
Alex Crichton [Thu, 17 Oct 2013 00:05:28 +0000 (17:05 -0700)]
Remove IoFactoryObject for ~IoFactory

This involved changing a fair amount of code, rooted in how we access the local
IoFactory instance. I added a helper method to the rtio module to access the
optional local IoFactory. This is different than before in which it was assumed
that a local IoFactory was *always* present. Now, a separate io_error is raised
when an IoFactory is not present, yet I/O is requested.

10 years agoRemove rt::io::support
Alex Crichton [Wed, 16 Oct 2013 23:48:30 +0000 (16:48 -0700)]
Remove rt::io::support

This removes the PathLike trait associated with this "support module". This is
yet another "container of bytes" trait, so I didn't want to duplicate what
already exists throughout libstd. In actuality, we're going to pass of C strings
to the libuv APIs, so instead the arguments are now bound with the 'ToCStr'
trait instead.

Additionally, a layer of complexity was removed by immediately converting these
type-generic parameters into CStrings to get handed off to libuv apis.

10 years agoMigrate Rtio objects to true trait objects
Alex Crichton [Wed, 16 Oct 2013 21:48:05 +0000 (14:48 -0700)]
Migrate Rtio objects to true trait objects

This moves as many as I could over to ~Trait instead of ~Typedef. The only
remaining one is the IoFactoryObject which should be coming soon...

10 years agoMove rt::io::stdio from FileStream to a TTY
Alex Crichton [Wed, 16 Oct 2013 18:47:12 +0000 (11:47 -0700)]
Move rt::io::stdio from FileStream to a TTY

We get a little more functionality from libuv for these kinds of streams (things
like terminal dimentions), and it also appears to more gracefully handle the
stream being a window. Beforehand, if you used stdio and hit CTRL+d on a
process, libuv would continually return 0-length successful reads instead of
interpreting that the stream was closed.

I was hoping to be able to write tests for this, but currently the testing
infrastructure doesn't allow tests with a stdin and a stdout, but this has been
manually tested! (not that it means much)

10 years agoRemove unbound pipes from io::pipe
Alex Crichton [Wed, 16 Oct 2013 18:39:51 +0000 (11:39 -0700)]
Remove unbound pipes from io::pipe

This isn't necessary for creating processes (or at least not right now), and
it inherently attempts to expose implementation details.

10 years agoAddress a few XXX comments throughout the runtime
Alex Crichton [Wed, 16 Oct 2013 03:55:50 +0000 (20:55 -0700)]
Address a few XXX comments throughout the runtime

* Implement Seek for Option<Seek>
* Remove outdated comment for io::process
* De-pub a component which didn't need to be pub

10 years agoFinish implementing io::net::addrinfo
Alex Crichton [Wed, 16 Oct 2013 03:37:39 +0000 (20:37 -0700)]
Finish implementing io::net::addrinfo

This fills in the `hints` structure and exposes libuv's full functionality for
doing dns lookups.

10 years agoImplement io::net::unix
Alex Crichton [Wed, 16 Oct 2013 02:44:08 +0000 (19:44 -0700)]
Implement io::net::unix

10 years agolibextra: Make arc::get and arc::new inline too.
Patrick Walton [Thu, 24 Oct 2013 20:50:21 +0000 (13:50 -0700)]
libextra: Make arc::get and arc::new inline too.

Should be a 2x improvement in a Servo test case.

10 years agolibextra: Make arc clone inline
Patrick Walton [Thu, 24 Oct 2013 20:21:49 +0000 (13:21 -0700)]
libextra: Make arc clone inline

10 years agoauto merge of #10007 : Kimundi/rust/add_docs_01, r=cmr
bors [Thu, 24 Oct 2013 20:01:18 +0000 (13:01 -0700)]
auto merge of #10007 : Kimundi/rust/add_docs_01, r=cmr

Additionally:
- Sorted the prelude reexports
- Removed unused import warning in std::mem and cleaned it up too

(I was bored :ghost: )

10 years agoCleaned, documented, wrote tests for up std::bool
Marvin Löbel [Mon, 21 Oct 2013 19:41:32 +0000 (21:41 +0200)]
Cleaned, documented, wrote tests for up std::bool
Removed unused import warning in std::mem and cleaned it up too

Removed is_true and is_false from std::bool

Removed freestanding functions in std::bool

10 years agoauto merge of #10042 : thestinger/rust/fail, r=sanxiyn
bors [Thu, 24 Oct 2013 12:11:06 +0000 (05:11 -0700)]
auto merge of #10042 : thestinger/rust/fail, r=sanxiyn

Closes #10023

10 years agoauto merge of #10040 : thestinger/rust/frame_address, r=alexcrichton
bors [Thu, 24 Oct 2013 04:46:03 +0000 (21:46 -0700)]
auto merge of #10040 : thestinger/rust/frame_address, r=alexcrichton

Closes #10001

10 years agodrop unused `frame_address` intrinsic
Daniel Micay [Thu, 24 Oct 2013 01:15:14 +0000 (21:15 -0400)]
drop unused `frame_address` intrinsic

Closes #10001

10 years agomark some functions as returning !
Daniel Micay [Thu, 24 Oct 2013 02:22:59 +0000 (22:22 -0400)]
mark some functions as returning !

Closes #10023

10 years agoauto merge of #10032 : thestinger/rust/snapshot, r=huonw
bors [Wed, 23 Oct 2013 22:11:07 +0000 (15:11 -0700)]
auto merge of #10032 : thestinger/rust/snapshot, r=huonw

10 years agoregister snapshots
Daniel Micay [Wed, 23 Oct 2013 08:49:18 +0000 (04:49 -0400)]
register snapshots

10 years agoauto merge of #10022 : hatahet/rust/master, r=alexcrichton
bors [Wed, 23 Oct 2013 18:36:13 +0000 (11:36 -0700)]
auto merge of #10022 : hatahet/rust/master, r=alexcrichton

Fixes #9958

10 years agoMade uv_stat_t.{st_dev, st_ino} public, #9958
Ziad Hatahet [Wed, 23 Oct 2013 18:16:35 +0000 (11:16 -0700)]
Made uv_stat_t.{st_dev, st_ino} public, #9958

10 years agoMerge remote-tracking branch 'upstream/master'
Ziad Hatahet [Wed, 23 Oct 2013 17:09:06 +0000 (10:09 -0700)]
Merge remote-tracking branch 'upstream/master'

10 years agoauto merge of #10034 : sfackler/rust/time, r=alexcrichton
bors [Wed, 23 Oct 2013 16:41:14 +0000 (09:41 -0700)]
auto merge of #10034 : sfackler/rust/time, r=alexcrichton

These are supposed to be raw C-like structs mirroring time.h's struct tm
and struct timespec.

10 years agoRe-make time struct fields public
Steven Fackler [Wed, 23 Oct 2013 16:06:31 +0000 (09:06 -0700)]
Re-make time struct fields public

These are supposed to be raw C-like structs mirroring time.h's struct tm
and struct timespec.

10 years agoauto merge of #9810 : huonw/rust/rand3, r=alexcrichton
bors [Wed, 23 Oct 2013 15:31:21 +0000 (08:31 -0700)]
auto merge of #9810 : huonw/rust/rand3, r=alexcrichton

- Adds the `Sample` and `IndependentSample` traits for generating numbers where there are parameters (e.g. a list of elements to draw from, or the mean/variance of a normal distribution). The former takes `&mut self` and the latter takes `&self` (this is the only difference).
- Adds proper `Normal` and `Exp`-onential distributions
- Adds `Range` which generates `[lo, hi)` generically & properly (via a new trait) replacing the incorrect behaviour of `Rng.gen_integer_range` (this has become `Rng.gen_range` for convenience, it's far more efficient to use `Range` itself)
- Move the `Weighted` struct from `std::rand` to `std::rand::distributions` & improve it
- optimisations and docs

10 years agoauto merge of #10027 : catamorphism/rust/testcases-2013-10-22, r=catamorphism
bors [Wed, 23 Oct 2013 09:06:12 +0000 (02:06 -0700)]
auto merge of #10027 : catamorphism/rust/testcases-2013-10-22, r=catamorphism

10 years agoauto merge of #10021 : alexcrichton/rust/asm-now-analyzed-correctly, r=luqmana
bors [Wed, 23 Oct 2013 07:01:23 +0000 (00:01 -0700)]
auto merge of #10021 : alexcrichton/rust/asm-now-analyzed-correctly, r=luqmana

We got a snapshot, taking care of a note to myself.

10 years agoauto merge of #10015 : huonw/rust/minor-fixes, r=alexcrichton
bors [Wed, 23 Oct 2013 05:51:10 +0000 (22:51 -0700)]
auto merge of #10015 : huonw/rust/minor-fixes, r=alexcrichton

- Use ["nothing up my sleeve numbers"](http://en.wikipedia.org/wiki/Nothing_up_my_sleeve_number) for the ISAAC tests.
- Replace the default implementation of `Rng.fill_bytes` with something that doesn't try to do bad things with `transmute` and vectors just for the sake of a little speed.
- Replace the transmutes used to seed the ISAAC RNGs with calls into `vec::raw`.

10 years agotestsuite: Test cases, all except issue-5216 xfailed
Tim Chevalier [Wed, 23 Oct 2013 04:04:15 +0000 (21:04 -0700)]
testsuite: Test cases, all except issue-5216 xfailed

10 years agoauto merge of #9654 : catamorphism/rust/rustpkg-c-dependencies, r=brson
bors [Wed, 23 Oct 2013 03:56:05 +0000 (20:56 -0700)]
auto merge of #9654 : catamorphism/rust/rustpkg-c-dependencies, r=brson

r? @brson api::install_pkg now accepts an argument that's a list of
(kind, path) dependency pairs. This allows custom package scripts to
declare C dependencies, as is demonstrated in
rustpkg::tests::test_c_dependency_ok.

Closes #6403

10 years agorustpkg: Support arbitrary dependencies in the install API
Tim Chevalier [Tue, 1 Oct 2013 05:39:50 +0000 (22:39 -0700)]
rustpkg: Support arbitrary dependencies in the install API

api::install_pkg now accepts an argument that's a list of
(kind, path) dependency pairs. This allows custom package scripts to
declare C dependencies, as is demonstrated in
rustpkg::tests::test_c_dependency_ok.

Closes #6403

10 years agoauto merge of #9989 : luqmana/rust/mut-everywhere, r=alexcrichton
bors [Wed, 23 Oct 2013 02:46:09 +0000 (19:46 -0700)]
auto merge of #9989 : luqmana/rust/mut-everywhere, r=alexcrichton

10 years agoUpdate the manual.
Luqman Aden [Wed, 23 Oct 2013 01:37:42 +0000 (21:37 -0400)]
Update the manual.

10 years agoRemove thread-blocking call to `libc::stat` in `Path::stat`
Ziad Hatahet [Wed, 23 Oct 2013 01:25:07 +0000 (18:25 -0700)]
Remove thread-blocking call to `libc::stat` in `Path::stat`

Fixes #9958

10 years agoAdd tests for uniq & by-value self in mut slot.
Luqman Aden [Mon, 21 Oct 2013 07:50:09 +0000 (03:50 -0400)]
Add tests for uniq & by-value self in mut slot.

10 years agolibsyntax/librustc: Allow specifying mut on ~self.
Luqman Aden [Sun, 20 Oct 2013 06:34:01 +0000 (02:34 -0400)]
libsyntax/librustc: Allow specifying mut on ~self.

10 years agolibsyntax/librustc: Allow specifying mut on by-value self.
Luqman Aden [Sun, 20 Oct 2013 05:55:23 +0000 (01:55 -0400)]
libsyntax/librustc: Allow specifying mut on by-value self.

10 years agostd::rand: seed ISAAC with no transmutes.
Huon Wilson [Tue, 22 Oct 2013 12:11:17 +0000 (23:11 +1100)]
std::rand: seed ISAAC with no transmutes.

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.

10 years agostd::rand: use "nothing up your sleeve numbers" for ISAAC tests.
Huon Wilson [Tue, 22 Oct 2013 11:49:51 +0000 (22:49 +1100)]
std::rand: use "nothing up your sleeve numbers" for ISAAC tests.

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

10 years agostd::rand: simplify/safe-ify the default Rng.fill_bytes.
Huon Wilson [Tue, 22 Oct 2013 07:28:49 +0000 (18:28 +1100)]
std::rand: simplify/safe-ify the default Rng.fill_bytes.

The `&[u8]` -> `&[u64]` and `&[u32]` casts were not nice: they ignored
alignment requirements and are generally very unsafe.

10 years agoauto merge of #10020 : mletterle/rust/documentation-fixes, r=thestinger
bors [Wed, 23 Oct 2013 00:06:09 +0000 (17:06 -0700)]
auto merge of #10020 : mletterle/rust/documentation-fixes, r=thestinger

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.

10 years agostd::rand: move Weighted to distributions.
Huon Wilson [Fri, 11 Oct 2013 15:15:22 +0000 (02:15 +1100)]
std::rand: move Weighted to distributions.

A user constructs the WeightedChoice distribution and then samples from
it, which allows it to use binary search internally.

10 years agostd::rand: lengthen the RNG benchmarks.
Huon Wilson [Fri, 11 Oct 2013 11:09:06 +0000 (22:09 +1100)]
std::rand: lengthen the RNG benchmarks.

This makes them more representative, as the `bh.iter` is a smaller
percentage of the total time.

10 years agostd::rand: optimise & document ziggurat.
Huon Wilson [Fri, 11 Oct 2013 08:38:32 +0000 (19:38 +1100)]
std::rand: optimise & document ziggurat.

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

10 years agostd::rand: documentation & references.
Huon Wilson [Fri, 11 Oct 2013 06:25:40 +0000 (17:25 +1100)]
std::rand: documentation & references.

Most importantly, links to the papers/references for the core
algorithms (the RNG ones & the distribution ones).

10 years agostd::rand: add distributions::Range for generating [lo, hi).
Huon Wilson [Thu, 10 Oct 2013 09:18:07 +0000 (20:18 +1100)]
std::rand: add distributions::Range for generating [lo, hi).

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.

10 years agostd::rand: full exponential & normal distributions
Huon Wilson [Thu, 10 Oct 2013 09:16:06 +0000 (20:16 +1100)]
std::rand: full exponential & normal distributions

Complete the implementation of Exp and Normal started by Exp1 and
StandardNormal by creating types implementing Sample & IndependentSample
with the appropriate parameters.

10 years agostd::rand: Add RandSample for Sample-ing Rand types directly.
Huon Wilson [Thu, 10 Oct 2013 03:30:34 +0000 (14:30 +1100)]
std::rand: Add RandSample for Sample-ing Rand types directly.

10 years agostd::rand: add the Sample and IndependentSample traits.
Huon Wilson [Thu, 10 Oct 2013 02:59:55 +0000 (13:59 +1100)]
std::rand: add the Sample and IndependentSample traits.

These are a "parameterised" Rand.

10 years agoTidy up asm! usage in libstd
Alex Crichton [Mon, 21 Oct 2013 21:16:38 +0000 (14:16 -0700)]
Tidy up asm! usage in libstd

10 years agoauto merge of #9969 : reedlepee123/rust/priv_fields, r=bstrie
bors [Tue, 22 Oct 2013 22:31:26 +0000 (15:31 -0700)]
auto merge of #9969 : reedlepee123/rust/priv_fields, r=bstrie

10 years agoMaking ai_next field public
reedlepee [Tue, 22 Oct 2013 21:55:10 +0000 (03:25 +0530)]
Making ai_next field public

10 years agoauto merge of #10013 : bdash/rust/mavericks-unwinding, r=alexcrichton
bors [Tue, 22 Oct 2013 20:46:25 +0000 (13:46 -0700)]
auto merge of #10013 : bdash/rust/mavericks-unwinding, r=alexcrichton

OS X 10.9's linker has a bug that results in it failing to preserve
DWARF unwind information when passed the -no_compact_unwind flag.
This flag is passed on OS X because the unwind information for
__morestack cannot be represented by the compact unwind format.

We can work around this problem by using a more targeted approach
to disabling compact unwind information. The OS X linker looks for
a particular pattern in the DWARF unwind information and will not
attempt to convert the unwind information to the compact format.
The pattern in question is the return address register being saved
twice to the same location.

Fixes #6849.

10 years agoRemoved the file src/libstd/unstable/extfmt.r
reedlepee [Tue, 22 Oct 2013 19:51:03 +0000 (01:21 +0530)]
Removed the file src/libstd/unstable/extfmt.r

10 years agoRemoved the unnecesary comments
reedlepee [Sun, 20 Oct 2013 07:17:35 +0000 (12:47 +0530)]
Removed the unnecesary comments

10 years agoRemoved unnecessary comments and white spaces as suggested
reedlepee [Sun, 20 Oct 2013 05:51:30 +0000 (11:21 +0530)]
Removed unnecessary comments and white spaces as suggested

10 years agoRemoved Unnecessary comments and white spaces #4386
reedlepee [Sun, 20 Oct 2013 03:26:42 +0000 (08:56 +0530)]
Removed Unnecessary comments and white spaces  #4386

10 years agoMaking fields in std and extra : private #4386
reedlepee [Sun, 20 Oct 2013 00:33:09 +0000 (06:03 +0530)]
Making fields in std and extra : private  #4386

10 years agoDon't Make str field private
reedlepee [Fri, 18 Oct 2013 22:36:18 +0000 (04:06 +0530)]
Don't Make str field private

10 years agoauto merge of #9923 : thestinger/rust/managed_boxes, r=brson
bors [Tue, 22 Oct 2013 18:51:23 +0000 (11:51 -0700)]
auto merge of #9923 : thestinger/rust/managed_boxes, r=brson

I'll flip this on after doing a snapshot. This syntax may or may not
stay around, and managed boxes are currently not very useful. They have
the same overall performance characteristics as `std::rc::Rc`, but are
significantly slower, allocate larger boxes and hold onto the memory
beyond when it is needed due to lacking move semantics.

There are currently two useful aspects of the type:

* the dereference sugar, which we should implement for `Rc`
* the annihilator freeing cycles at the end of the task

10 years agoMinor grammatical fixes and removed section on 'rust' tool
Michael Letterle [Tue, 22 Oct 2013 01:23:00 +0000 (21:23 -0400)]
Minor grammatical fixes and removed section on 'rust' tool

10 years agoadd feature gate for managed boxes
Daniel Micay [Fri, 18 Oct 2013 05:14:47 +0000 (01:14 -0400)]
add feature gate for managed boxes

I'll flip this on after doing a snapshot. This syntax may or may not
stay around, and managed boxes are currently not very useful. They have
the same overall performance characteristics as `std::rc::Rc`, but are
significantly slower, allocate larger boxes and hold onto the memory
beyond when it is needed due to lacking move semantics.

There are currently two useful aspects of the type:

* the dereference sugar, which we should implement for `Rc`
* the annihilator freeing cycles at the end of the task

10 years agoauto merge of #10006 : alexcrichton/rust/another-massive-rename, r=brson
bors [Tue, 22 Oct 2013 16:24:48 +0000 (09:24 -0700)]
auto merge of #10006 : alexcrichton/rust/another-massive-rename, r=brson

Drop the `2` suffix on all of them, updating all code in the process of doing so. This is a completely automated change, and it's dependent on the snapshots going through.

10 years agoauto merge of #10002 : catamorphism/rust/bug-report-docs, r=alexcrichton
bors [Tue, 22 Oct 2013 15:11:52 +0000 (08:11 -0700)]
auto merge of #10002 : catamorphism/rust/bug-report-docs, r=alexcrichton

r? @alexcrichton And also reference the bug report HOWTO in CONTRIBUTING.md

10 years agoRemove old logging from the tutorial
Alex Crichton [Tue, 22 Oct 2013 15:10:34 +0000 (08:10 -0700)]
Remove old logging from the tutorial

10 years agoRemove the now-duplicate logging macros
Alex Crichton [Mon, 21 Oct 2013 20:09:28 +0000 (13:09 -0700)]
Remove the now-duplicate logging macros

10 years agoDrop the '2' suffix from logging macros
Alex Crichton [Mon, 21 Oct 2013 20:08:31 +0000 (13:08 -0700)]
Drop the '2' suffix from logging macros

Who doesn't like a massive renaming?

10 years agoauto merge of #10009 : LeoTestard/rust/asm-feature-gated, r=huonw
bors [Tue, 22 Oct 2013 11:46:22 +0000 (04:46 -0700)]
auto merge of #10009 : LeoTestard/rust/asm-feature-gated, r=huonw

Suite of #9991