Commit Graph

26531 Commits

Author SHA1 Message Date
Huon Wilson
5ec118383b rustc: avoid compiler generated unsafe blocks leaking.
Previously an `unsafe` block created by the compiler (like those in the
formatting macros) would be "ignored" if surrounded by `unsafe`, that
is, the internal unsafety would be being legitimised by the external
block:

    unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } }

And the code in the inner block would be using the outer block, making
it considered used (and the inner one considered unused).

This patch forces the compiler to create a new unsafe context for
compiler generated blocks, so that their internal unsafety doesn't
escape to external blocks.

Fixes #12418.
2014-02-20 23:29:57 +11:00
bors
c4afcf44d2 auto merge of #12339 : alexcrichton/rust/rustdoc-fixes, r=sfackler
Commits have the details
2014-02-19 02:11:48 -08:00
Alex Crichton
429ef870f6 rustdoc: Handle links to reexported items
When building up our path cache, we don't plaster over a path which was
previously inserted if we're inserting a non-public-item thing.

Closes #11678
2014-02-19 01:30:52 -08:00
Alex Crichton
cac9107f38 rustdoc: Clickable links on methods themselves
Useful for getting the link to a method or function.

Closes #10332
2014-02-19 01:10:32 -08:00
Alex Crichton
68d576fd34 rustdoc: Fix json output and input
Turns out a hash map with integer keys isn't serializable to json.

Closes #10115
2014-02-19 01:10:31 -08:00
Alex Crichton
6db37bb147 rustdoc: Highlight methods jumped to
This helps figure out where you actually jumped to, especially if the thing you
jumped to is at the very bottom of the page.

Closes #9905
2014-02-19 01:10:31 -08:00
Alex Crichton
867988c1dc rustdoc: Show macros in documentation
Any macro tagged with #[macro_export] will be showed in the documentation for
that module. This also documents all the existing macros inside of std::macros.

Closes #3163
cc #5605
Closes #9954
2014-02-19 01:10:31 -08:00
Alex Crichton
f0cb0ebc66 rustdoc: Fixup links to enum variants
Pages aren't emitted for enum variants, so whenever we're linking to an enum
variant instead link to the parent enum instead.

Closes #12289
2014-02-19 01:10:31 -08:00
bors
9f68f793d4 auto merge of #12364 : Armavica/rust/mk-tips, r=alexcrichton
The command `make tips` did not work properly because of a flaw in the regexp parsing Makefile.in for documentation (`SHOW_DOCS`). I fixed it and also added a note about `make clean` in the build documentation (`make help`).
2014-02-19 00:56:51 -08:00
bors
74f3e0474b auto merge of #12361 : sfackler/rust/rustdoc-test-extern, r=alexcrichton 2014-02-18 22:16:47 -08:00
Steven Fackler
0658913616 rustdoc: Only inject extern crates if not present 2014-02-18 20:42:29 -08:00
bors
cae5999a54 auto merge of #12317 : huonw/rust/utf16, r=alexcrichton
Iterators! Use them (in `is_utf16`), create them (in `utf16_items`).

Handle errors gracefully (`from_utf16_lossy`) and `from_utf16` returning `Option<~str>` instead of failing.

Add a pile of tests.
2014-02-18 19:26:50 -08:00
Huon Wilson
c9b4538bab str: add a function for truncating a vector of u16 at NUL.
Many of the functions interacting with Windows APIs allocate a vector of
0's and do not retrieve a length directly from the API call, and so need
to be sure to remove the unmodified junk at the end of the vector.
2014-02-19 14:09:16 +11:00
bors
a25f447835 auto merge of #12245 : nick29581/rust/priv2, r=alexcrichton
closes #4110
2014-02-18 18:11:48 -08:00
Nick Cameron
df1686dbf1 Make priavcy checking aware that a use directive can point to two defintions (namespaces) with different privacy. Closes #4110 2014-02-19 14:47:10 +13:00
bors
ee8f45ef95 auto merge of #12359 : alexcrichton/rust/update-compiler-rt, r=luqmana
Closes #12356
2014-02-18 13:41:49 -08:00
bors
aa06bf4f12 auto merge of #12357 : chromatic/rust/gh_11976_fail_bounds_check_str, r=alexcrichton
Fixes #11976.
2014-02-18 12:21:45 -08:00
bors
a886549772 auto merge of #12336 : kballard/rust/mutexarc-no-freeze, r=alexcrichton
With Rc no longer trying to statically prevent cycles (and thus no
longer using the Freeze bound), it seems appropriate to remove that
restriction from MutexArc as well.

Closes #9251.
2014-02-18 10:16:48 -08:00
bors
54bccc5862 auto merge of #12330 : nick29581/rust/glue, r=huonw
closes #3290
2014-02-18 08:56:51 -08:00
bors
517e38997d auto merge of #12354 : alexcrichton/rust/fix-rustuv-segfault, r=cmr
The details can be found in the comments I added to the test, but the gist of it
is that capturing output injects rescheduling a green task on failure, which
wasn't desired for the test in question.

cc #12340
2014-02-18 06:46:55 -08:00
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
Virgile Andreani
54f710fd2d mk: Talk about make clean in the build help 2014-02-18 11:55:34 +01:00
Virgile Andreani
ece12d8da6 mk: Fix the regexp of SHOW_DOCS
The tag marks were missing, and `make tips` didn't work.
2014-02-18 11:53:23 +01: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
Alex Crichton
2b7e33396f Update compiler-rt
Closes #12356
2014-02-17 19:58:47 -08:00
chromatic
96102b3945 Made fail_bounds_check more careful with strings.
Fixes GH #11976.
2014-02-17 19:35:59 -08:00
Nick Cameron
8334915a6c Test ordering of glue_drop and glue_takew in self-re-assignment. Closes #3290. 2014-02-18 16:17:10 +13: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
Alex Crichton
fd2ed71dcc Fix a segfault in the rustuv tests
The details can be found in the comments I added to the test, but the gist of it
is that capturing output injects rescheduling a green task on failure, which
wasn't desired for the test in question.

cc #12340
2014-02-17 14:41:33 -08: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
Kevin Ballard
449c34a0e5 Remove the compile-fail test that's now obsolete 2014-02-17 10:03:52 -08: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
Huon Wilson
4f841ee150 std: make str::from_utf16 return an Option.
The rest of the codebase is moving toward avoiding `fail!` so we do it
here too!
2014-02-18 00:00:38 +11:00
Huon Wilson
35b1b62ddf std: decode even numbered non-BMP planes in the UTF-16 decoder.
Fixes #12318.
2014-02-17 23:53:49 +11:00
Huon Wilson
a96cea4f5a str: provide lossy UTF-16 support.
This replaces the iterator with one that handles lone surrogates
gracefully and uses that to implement `from_utf16_lossy` which replaces
invalid `u16`s with U+FFFD.
2014-02-17 23:53:49 +11:00