Commit Graph

26498 Commits

Author SHA1 Message Date
bors
8391b71122 auto merge of #12351 : kud1ing/rust/backticks, r=alexcrichton 2014-02-18 05:31:55 -08:00
bors
e4ce8a9689 auto merge of #12314 : huonw/rust/is_utf8_iter, r=kballard
See the commit messages for more details, but this makes `std::str::is_utf8` slightly faster and 100% non-`unsafe` and uses a similar thing to make the first scan of `from_utf8_lossy` 100% safe & faster.
2014-02-18 04:06:48 -08:00
Huon Wilson
a39056e614 std: convert first_non_utf8_byte to use the iterator.
This makes it very slightly faster, especially when the string is valid
UTF-8, and completely removes the use of `unsafe` from the first half.

Before:

    from_utf8_lossy_100_ascii              ... bench:       151 ns/iter (+/- 17)
    from_utf8_lossy_100_invalid            ... bench:       447 ns/iter (+/- 33)
    from_utf8_lossy_100_multibyte          ... bench:       135 ns/iter (+/- 4)
    from_utf8_lossy_invalid                ... bench:       124 ns/iter (+/- 10

After:

    from_utf8_lossy_100_ascii              ... bench:       119 ns/iter (+/- 8)
    from_utf8_lossy_100_invalid            ... bench:       454 ns/iter (+/- 16)
    from_utf8_lossy_100_multibyte          ... bench:       116 ns/iter (+/- 9)
    from_utf8_lossy_invalid                ... bench:       119 ns/iter (+/- 9)
2014-02-18 21:55:53 +11:00
Huon Wilson
a68d10e6ad std::str: safen and optimize is_utf8.
This uses a vector iterator to avoid the necessity for unsafe indexing,
and makes this function slightly faster. Unfortunately #11751 means that
the iterator comes with repeated `null` checks which means the
pure-ASCII case still has room for significant improvement (and the
other cases too, but it's most significant for just ASCII).

Before:

    is_utf8_100_ascii             ... bench:       143 ns/iter (+/- 6)
    is_utf8_100_multibyte         ... bench:       134 ns/iter (+/- 4)

After:

    is_utf8_100_ascii             ... bench:       123 ns/iter (+/- 4)
    is_utf8_100_multibyte         ... bench:       115 ns/iter (+/- 5)
2014-02-18 21:55:53 +11:00
bors
b3ed38f219 auto merge of #12345 : huonw/rust/speeling, r=cmr 2014-02-18 02:51:49 -08:00
bors
1e60084257 auto merge of #12342 : ehsanul/rust/remove-shared-chan-tasks-guide, r=alexcrichton
The code examples are up to date, but the surrounding explanations are not.
2014-02-18 01:36:51 -08:00
bors
b0ce960609 auto merge of #12321 : bjz/rust/remove-real, r=alexcrichton
This is part of the effort to simplify `std::num`, as tracked in issue #10387. It is also a step towards a proper IEEE-754 trait (see #12281).
2014-02-17 22:16:51 -08:00
bors
62d7d0079f auto merge of #12103 : alexcrichton/rust/unix, r=brson
There's a few parts to this PR

* Implement unix pipes in libnative for unix platforms (thanks @Geal!)
* Implement named pipes in libnative for windows (terrible, terrible code)
* Remove `#[cfg(unix)]` from `mod unix` in `std::io::net`. This is a terrible name for what it is, but that's the topic of #12093.

The windows implementation was significantly more complicated than I thought it would be, but it seems to be passing all the tests. now.

Closes #11201
2014-02-17 20:01:52 -08:00
bors
03c5342419 auto merge of #12243 : dguenther/rust/extend-tidy, r=alexcrichton
Extends the license and formatting check to `*.js` files in `src/doc` and `*.sh`, `*.pl`, `*.c`, and `*.h` files in `src/etc`. As best as I could tell, these files should be covered under the Rust project license.

cc @brson: Do any other scripts need a license? I'd like to double-check that this PR closes #4534.
2014-02-17 18:46:48 -08:00
bors
93a2ee807a auto merge of #12232 : kballard/rust/taskbuilder-is-a-builder, r=alexcrichton
Delete all the documentation from std::task that references linked
failure.

Tweak TaskBuilder to be more builder-like. `.name()` is now `.named()` and
`.add_wrapper()` is now `.with_wrapper()`. Remove `.watched()` and
`.unwatched()` as they didn't actually do anything.

Closes #6399.
2014-02-17 17:31:52 -08:00
bors
25147b2644 auto merge of #12146 : gentlefolk/rust/issue-2404, r=alexcrichton
Addresses FIXME described in issue #2404
2014-02-17 16:11:52 -08:00
gentlefolk
37bf97a0f9 Updated metadata::creader::resolve_crate_deps to use the correct span. Clarified error message when an external crate's dependency is missing. Closes #2404. 2014-02-17 18:34:46 -05:00
bors
5736deb90e auto merge of #12352 : alexcrichton/rust/fix-master, r=brson
This deadlock was caused when the channel was closed at just the right time, so
the extra `self.cnt.fetch_add` actually should have preserved the DISCONNECTED
state of the channel. by modifying this the channel entered a state such that
the port would never succeed in dropping.

This also moves the increment of self.steals until after the MAX_STEALS block.
The reason for this is that in 'fn recv()' the steals variable is decremented
immediately after the try_recv(), which could in theory set steals to -1 if it
was previously set to 0 in try_recv().

Closes #12340
2014-02-17 14:16:53 -08:00
Alex Crichton
9c05c1c236 Fix a deadlock in channels, again.
This deadlock was caused when the channel was closed at just the right time, so
the extra `self.cnt.fetch_add` actually should have preserved the DISCONNECTED
state of the channel. by modifying this the channel entered a state such that
the port would never succeed in dropping.

This also moves the increment of self.steals until after the MAX_STEALS block.
The reason for this is that in 'fn recv()' the steals variable is decremented
immediately after the try_recv(), which could in theory set steals to -1 if it
was previously set to 0 in try_recv().

Closes #12340
2014-02-17 13:59:25 -08:00
Huon Wilson
6555b04dd2 Spellcheck library docs. 2014-02-18 08:05:35 +11:00
kud1ing
e22d18dcd0 backticks for syntax elements 2014-02-17 21:48:53 +01:00
bors
47c31831a3 auto merge of #12337 : nick29581/rust/generic_extern, r=alexcrichton
and fix up some formatting.
2014-02-17 09:26:48 -08:00
Derek Guenther
b609d57b02 Added more scripts to tidy check 2014-02-17 10:36:47 -06:00
bors
2bba7233eb auto merge of #12331 : bjz/rust/count-ones, r=alexcrichton
This is inspired by the [function naming in the Julia standard library](http://docs.julialang.org/en/release-0.2/stdlib/base/#Base.count_ones). It seems like a more self-explanatory name, and is more consistent with the accompanying methods, `leading_zeros` and `trailing_zeros`.
2014-02-17 08:06:49 -08:00
bors
88028693b8 auto merge of #12325 : big-guy/rust/doc-fixes, r=alexcrichton
* Change '...your own time' => '...your own type'
* Fix typo in the Vector2D example
2014-02-17 06:11:51 -08:00
bors
57d273f65e auto merge of #12284 : brson/rust/install, r=alexcrichton
Work toward #9876.

This adds `prepare.mk`, which is simply a more heavily-parameterized `install.mk`, then uses `prepare` to implement both `install` and the windows installer (`dist`). Smoke tested on both Linux and Windows.
2014-02-17 03:26:51 -08:00
Ehsanul Hoque
b9c476b6ee Update tasks guide: SharedChan as been removed
The code examples are up to date, but the surrounding explanations are not.
2014-02-17 02:34:07 -08:00
Nick Cameron
8f3f666371 Forbid use of generics with foreign functions. Closes #10353. 2014-02-17 18:52:11 +13:00
Brendan Zabarauskas
79f52cf9ba Rename Bitwise::population_count to Bitwise::count_ones and add Bitwise::count_zeros
These are inspired by the [functions in the Julia standard library](http://docs.julialang.org/en/release-0.2/stdlib/base/#Base.count_ones).
2014-02-17 13:55:06 +11:00
Alex Crichton
a526aa139e Implement named pipes for windows, touch up unix
* Implementation of pipe_win32 filled out for libnative
* Reorganize pipes to be clone-able
* Fix a few file descriptor leaks on error
* Factor out some common code into shared functions
* Make use of the if_ok!() macro for less indentation

Closes #11201
2014-02-16 18:46:01 -08:00
Alex Crichton
94b2d9dc4d Move unix pipes implementation to pipe_unix.rs
The windows named pipes implementation will have almost nothing to do with unix
pipes, so I think it's best if they live in separate files.
2014-02-16 18:45:48 -08:00
Geoffroy Couprie
a226f56600 Implement Unix domain sockets in libnative 2014-02-16 18:45:48 -08:00
Brian Anderson
2b64cb294c Address review feedback 2014-02-16 17:36:43 -08:00
bors
c8489069b4 auto merge of #12085 : alexcrichton/rust/issue-12082, r=brson
This just copies the libuv implementation for libnative which seems reasonable
enough (uid/gid fail on windows).

Closes #12082
2014-02-16 16:46:39 -08:00
Alex Crichton
74b42c646e Upgrade libuv
This notably includes joyent/libuv@6f62d62c in order to fix when processes fail
to spawn on windows
2014-02-16 16:01:03 -08:00
Alex Crichton
553b7e67d7 Allow configuration of uid/gid/detach on processes
This just copies the libuv implementation for libnative which seems reasonable
enough (uid/gid fail on windows).

Closes #12082
2014-02-16 16:01:03 -08:00
Kevin Ballard
01b31af4bb Update clients of the TaskBuilder API 2014-02-16 15:34:02 -08:00
Kevin Ballard
b94daee395 Clean up std::task docs, make TaskBuilder a real builder
Delete all the documentation from std::task that references linked
failure.

Tweak TaskBuilder to be more builder-like. .name() is now .named() and
.add_wrapper() is now .with_wrapper(). Remove .watched() and
.unwatched() as they didn't actually do anything.
2014-02-16 15:34:02 -08:00
bors
425f57477f auto merge of #12319 : SimonSapin/rust/build-symlink, r=alexcrichton 2014-02-16 12:51:40 -08:00
bors
13dc521861 auto merge of #12312 : brson/rust/doc, r=alexcrichton
Only single out std. Put everything else in a consistent list.
2014-02-16 11:36:40 -08:00
Sterling Greene
a6995583e0 Minor documentation fixes in std::fmt
* Change '...your own time' => '...your own type'
* Fix typo in the Vector2D example
2014-02-16 13:43:46 -05:00
Brendan Zabarauskas
876eb931dc Remove Real trait and move methods into Float
This is part of the effort to simplify `std::num`, as tracked in issue #10387.
2014-02-17 02:23:33 +11:00
bors
0ba6d4885f auto merge of #12313 : bjz/rust/tuple, r=huonw
This renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters. It also removes the `CloneableTuple` and `ImmutableTuple` traits.
2014-02-16 07:11:34 -08:00
Brendan Zabarauskas
f450b2b379 Remove CloneableTuple and ImmutableTuple traits
These are adequately covered by the Tuple2 trait.
2014-02-17 00:57:56 +11:00
Brendan Zabarauskas
cf0654c47c Improve naming of tuple getters, and add mutable tuple getter
Renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters.
2014-02-17 00:57:56 +11:00
Simon Sapin
3a66548979 Ignore /build even if it’s a symlink. 2014-02-16 12:41:41 +00:00
Brendan Zabarauskas
2cd7a29013 Merge ImmutableTuple* traits into their respective Tuple* trait 2014-02-16 20:25:28 +11:00
bors
6fe775e2b5 auto merge of #12310 : brson/rust/mkfilecleanup, r=sfackler
Two small fixes
2014-02-16 00:51:33 -08:00
Brian Anderson
58a2b7da07 doc: Reorganize the library index
Only single out std. Put everything else in a consistent list.
2014-02-16 00:21:08 -08:00
Brendan Zabarauskas
6f39eb1a56 Delegate ToStr implementation to Show for tuples 2014-02-16 19:12:28 +11:00
Brendan Zabarauskas
bf6abf8cb3 Implement Show for 1-12 element tuples 2014-02-16 19:12:28 +11:00
bors
b36340b626 auto merge of #12302 : alexcrichton/rust/issue-12295, r=brson
The previous code erroneously assumed that 'steals > cnt' was always true, but
that was a false assumption. The code was altered to decrement steals to a
minimum of 0 instead of taking all of cnt into account.

I didn't include the exact test from #12295 because it could run for quite
awhile, and instead set the threshold for MAX_STEALS to much lower during
testing. I found that this triggered the old bug quite frequently when running
without this fix.

Closes #12295
2014-02-15 23:36:26 -08:00
Brian Anderson
58678dc229 mk: Fix typo, NO_MAKEFILE_DEPS -> NO_MKFILE_DEPS 2014-02-15 23:12:56 -08:00
Brian Anderson
109673f368 mk: Remove check-notidy, check-full, check-test
Mostly useless
2014-02-15 23:11:56 -08:00
bors
5d4fd50af3 auto merge of #12301 : FlaPer87/rust/issue-8893, r=alexcrichton 2014-02-15 22:06:27 -08:00