Commit Graph

42177 Commits

Author SHA1 Message Date
John Gallagher
833fc273a7 Update documentation for RwLock::try_{read,write}. 2015-05-06 11:47:30 -04:00
John Gallagher
30b883b93f Make RwLock::try_write try to obtain a write lock 2015-05-06 11:47:11 -04:00
Tobias Bucher
29d7fed994 Make overflow behaviour more obvious in the iterator module of libcore
Explicitely spell out behaviour on overflow for `usize`-returning iterator
functions.

Mention that panics are guaranteed if debug assertions are active, otherwise a
wrong result might be returned.
2015-05-06 17:17:48 +02:00
Pascal Hertleif
1d6285ebba Iter Docs: Mention 'reduce' and 'inject' 2015-05-06 15:51:06 +02:00
Paul Banks
81b90bd56f Correct initial guessing game example. Fixes #25147. r? @steveklabnik 2015-05-06 14:00:35 +01:00
Andrei Oprea
45c461c429 Add note about type signature searching to docs 2015-05-06 15:22:35 +03:00
bors
5a83fa271d Auto merge of #25120 - bluss:sliceconcatext, r=alexcrichton
collections: Convert SliceConcatExt to use associated types

Coherence now allows this, we have `SliceConcatExt<T> for [V] where T: Sized + Clone` and` SliceConcatExt<str> for [S]`, these don't conflict because
str is never Sized.
2015-05-06 11:56:15 +00:00
bors
fc45fd99f5 Auto merge of #25117 - jooert:tests, r=alexcrichton 2015-05-06 09:48:58 +00:00
Kelvin Ly
4174aa40f4 Reword with pnkfelix's suggestion 2015-05-06 05:43:05 -04:00
らいどっと
085e1f489b doc: Fix link of repr attribute 2015-05-06 18:11:54 +09:00
Steve Klabnik
fc9bc779d2 Fix explanation of Cargo's behavior
https://github.com/rust-lang/rust/pull/25080/files#r29634986
2015-05-06 04:18:56 -04:00
bors
016cef914b Auto merge of #25062 - michaelsproul:html-error-index, r=alexcrichton
This PR adds a program which uses the JSON output from #24884 to generate a webpage with descriptions of each diagnostic error.

The page is constructed by hand, with calls to `rustdoc`'s markdown renderers where needed. I opted to generate HTML directly as I think it's more flexible than generating a markdown file and feeding it into the `rustdoc` executable. I envision adding the ability to filter errors by their properties (description, no description, used, unused), which is infeasible using the whole-file markdown approach due to the need to wrap each error in a `<div>` (markdown inside tags isn't rendered).

Architecturally, I wasn't sure how to add this generator to the distribution. For the moment I've settled on a separate Rust program in `src/etc/` that gets compiled and run by a custom makefile rule. This approach doesn't seem too hackish, but I'm unsure if my usage of makefile variables is correct, particularly the call to `rustc` (and the `LD_LIBRARY_PATH` weirdness). Other options I considered were:

* Integrate the error-index generator into `rustdoc` so that it gets invoked via a flag and can be built as part of `rustdoc`.
* Add the error-index-generator as a "tool" to the `TOOLS` array, and make use of the facilities for building tools. The main reason I didn't do this was because it seemed like I'd need to add lots of stuff. I'm happy to investigate this further if it's the preferred method.
2015-05-06 07:55:20 +00:00
Johannes Oertel
d55a7e8bc4 Implement append and split_off for BitVec (RFC 509) 2015-05-06 09:29:07 +02:00
bors
6afa669524 Auto merge of #25035 - Stebalien:iter, r=aturon
Specifically, make count, nth, and last call the corresponding methods on the underlying iterator where possible. This way, if the underlying iterator has an optimized count, nth, or last implementations (e.g. slice::Iter), these methods will propagate these optimizations.

Additionally, change Skip::next to take advantage of a potentially optimized nth method on the underlying iterator.

This covers:

* core::iter::Chain: count, last, nth
* core::iter::Enumerate: count, nth
* core::iter::Peekable: count, last, nth
* core::iter::Skip: count, last, next (should call nth), nth
* core::iter::Take: nth
* core::iter::Fuse: count, last, nth

of #24214.
2015-05-06 06:08:27 +00:00
Sean McArthur
5624cfbdda test: update run-pass tests to not use mutable transmuting 2015-05-05 22:26:23 -07:00
Sean McArthur
e136f93d0f std: update select internals to not use mutable transmuting 2015-05-05 22:26:23 -07:00
Sean McArthur
d131f33557 lint: deny transmuting from immutable to mutable, since it's undefined behavior
[breaking-change] Technically breaking, since code that had been using
these transmutes before will no longer compile. However, it was
undefined behavior, so really, it's a good thing. Fixing your code would
require some re-working to use an UnsafeCell instead.

Closes #13146
2015-05-05 22:26:23 -07:00
bors
5b04c16bd6 Auto merge of #24879 - Stebalien:vec_deque, r=alexcrichton
According to rust-lang/rfcs#235, `VecDeque` should have this method (`VecDeque` was called `RingBuf` at the time) but it was never implemented.

I marked this stable since "1.0.0" because it's stable in `Vec`.
2015-05-06 03:33:42 +00:00
Tamir Duberstein
e95241bf28 Don't repeat Attribute in the const names 2015-05-05 22:03:45 -04:00
Tamir Duberstein
5cfa713a1c Use empty() instead of a special const 2015-05-05 22:03:45 -04:00
Tshepang Lekhonkhobe
8227db86eb fix typos caught by codespell 2015-05-06 03:00:13 +02:00
bors
7bd71637ca Auto merge of #25134 - alexcrichton:fix-issue-25072-for-realsies, r=brson
Turns out that a verbatim path was leaking through to gcc via the PATH
environment variable (pointing to the bundled gcc provided by the main
distribution) which was wreaking havoc when gcc itself was run. The fix here is
to just stop passing verbatim paths down by adding more liberal uses of
`fix_windows_verbatim_for_gcc`.

Closes #25072
2015-05-06 00:54:55 +00:00
Hika Hibariya
705f355e53 Fix indentation in the "Strings" chapter 2015-05-06 09:45:30 +09:00
Carol Nichols
9c7d5ae57c Panic if the grammar verifier sees a token it doesn't recognize
To prevent the reference grammar from getting out of sync with the real
grammar, panic if RustLexer.tokens contains an unknown token in a
similar way that verify.rs panics if it encounters an unknown binary
operation token.
2015-05-05 19:47:50 -04:00
Carol Nichols
1ca9ed61d6 Declare other tokens used later in the reference grammar
There were some tokens used in the grammar but not declared. Antlr
doesn't really seem to care and happily uses them, but they appear in
RustLexer.tokens in a potentially-unexpected order.
2015-05-05 19:47:50 -04:00
Carol Nichols
cdb6e1e15f Correct a typo in a declared token in the reference grammar
This appears to not have too much of a detrimental effect, but it
doesn't seem to be what is intended either.

antlr doesn't mind that `PLUS` isn't declared in `tokens` and happily
uses the `PLUS` that appears later in the file, but the generated
RustLexer.tokens had PLUS at the end rather than where it was intended:

NOT=10
TILDE=11
PLUT=12
MINUS=13
...
PLUS=56
2015-05-05 19:47:22 -04:00
Alex Crichton
9b88cd1c69 std: Generalize generics a bit in std::env
Many bounds are currently of the form `T: ?Sized + AsRef<OsStr>` where the
argument is `&T`, but the pattern elsewhere (primarily `std::fs`) has been to
remove the `?Sized` bound and take `T` instead (allowing usage with both
references and owned values). This commit generalizes the possible apis in
`std::env` from `&T` to `T` in this fashion.

The `split_paths` function remains the same as the return value borrows the
input value, so ta borrowed reference is required.
2015-05-05 16:06:21 -07:00
Ruud van Asseldonk
4b8098bb19 test: Update expected compile-fail message for E0282 2015-05-06 01:05:18 +02:00
bors
252b5444da Auto merge of #25129 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24782, #25080, #25112, #25114, #25127
- Failed merges:
2015-05-05 23:05:04 +00:00
Alex Crichton
2dc0e56163 rustc: Fix more verbatim paths leaking to gcc
Turns out that a verbatim path was leaking through to gcc via the PATH
environment variable (pointing to the bundled gcc provided by the main
distribution) which was wreaking havoc when gcc itself was run. The fix here is
to just stop passing verbatim paths down by adding more liberal uses of
`fix_windows_verbatim_for_gcc`.

Closes #25072
2015-05-05 15:21:52 -07:00
Jan Andersson
93c06143df Update with correct output. 2015-05-05 23:19:23 +02:00
Steve Klabnik
d507c38e00 Rollup merge of #25127 - frewsxcv:patch-21, r=pnkfelix 2015-05-05 16:56:02 -04:00
Steve Klabnik
5b1ddeb38f Rollup merge of #25114 - michaelsproul:error-markdown, r=alexcrichton
I've added backticks in a few places to ensure correct highlighting in the HTML output (cf #25062). 

Other changes include:

* Remove use of `1.` and `2.` separated by a code block as this was being rendered as two separate lists beginning at 1.
* Correct the spelling of successful in two places (from "succesful").

Other changes are a result of reflowing text to stay within the 80 character limit.
2015-05-05 16:56:02 -04:00
Steve Klabnik
8aaafeaf79 Rollup merge of #25112 - jsyeo:jsyeo-while-let, r=alexcrichton
The indentation in this example is messed up. The `_ => break,` line was using a tab instead of spaces to indent.
2015-05-05 16:56:01 -04:00
Steve Klabnik
477cf9c606 Rollup merge of #25080 - steveklabnik:guessing_game, r=alexcrichton
This also made me realize that I wasn't using the correct term,
'associated functions', rather than 'static methods'. So I corrected
that in the method syntax chapter.
2015-05-05 16:56:01 -04:00
Steve Klabnik
1eae884f39 Rollup merge of #24782 - steveklabnik:doc_ownership, r=nikomatsakis
Also, as @huonw guessed, move semantics really _does_ make more sense as
a sub-chapter of ownership.
2015-05-05 16:56:01 -04:00
Steve Klabnik
9d512fdd19 TRPL: guessing game
This also made me realize that I wasn't using the correct term,
'associated functions', rather than 'static methods'. So I corrected
that in the method syntax chapter.
2015-05-05 16:54:34 -04:00
Corey Farwell
2741b94daa Indicate code is code-like in diagnostic error message 2015-05-05 16:13:48 -04:00
Steve Klabnik
ab3cb8c5ae TRPL: ownership, borrowing, and lifetimes
Also, as @huonw guessed, move semantics really _does_ make more sense as
a sub-chapter of ownership.
2015-05-05 14:27:31 -04:00
bors
eae692e375 Auto merge of #25009 - alexcrichton:less-buffered-stream, r=aturon
As pointed out in #17136 the semantics of a `BufStream` aren't always what one
expects, and it looks like other [languages like C#][c-sharp] implement a
buffered stream with only one underlying buffer. For now this commit
destabilizes the primitive in the `std::io` module to give us some more time in
figuring out what to do with it.

[c-sharp]: https://msdn.microsoft.com/en-us/library/system.io.bufferedstream%28v=vs.110%29.aspx

[breaking-change]
2015-05-05 18:18:27 +00:00
Steven Allen
3fcbc31489 Optimize iterator adapters.
Specifically, make count, nth, and last call the corresponding methods
on the underlying iterator where possible. This way, if the underlying
iterator has an optimized count, nth, or last implementations (e.g.
slice::Iter), these methods will propagate these optimizations.

Additionally, change Skip::next to take advantage of a potentially
optimized nth method on the underlying iterator.
2015-05-05 14:17:23 -04:00
bors
6cd7486113 Auto merge of #24979 - jooert:test-22471, r=pnkfelix
Closes #22471.
2015-05-05 15:39:02 +00:00
Ulrik Sverdrup
2ca77f1c96 collections: Convert SliceConcatExt to use associated types
Coherence now allows this, we have SliceConcatExt<T> for [V] where T: Sized
+ Clone and SliceConcatExt<str> for [S], these don't conflict because
str is never Sized.
2015-05-05 16:39:33 +02:00
Johannes Oertel
c4693ea1db Add regression tests for #21174
Closes #21174.
2015-05-05 15:57:28 +02:00
Johannes Oertel
29a7d35894 Add regression test for #20862
Closes #20862.
2015-05-05 15:57:28 +02:00
Johannes Oertel
526258c0f8 Add regression test for #20186
Closes #20186.
2015-05-05 15:57:28 +02:00
Johannes Oertel
341fb57b57 Add regression test for #20174
Closes #20174.
2015-05-05 15:57:27 +02:00
Johannes Oertel
d393ff7c47 Add regression test for #20105
Closes #20105.
2015-05-05 15:57:27 +02:00
bors
58b83e7e74 Auto merge of #25101 - alexcrichton:fix-flaky-windows-test, r=nikomatsakis
This test has deadlocked on Windows once or twice now and we've had lots of
problems in the past of threads panicking when the process is being shut down.
One of the two threads in this test is guaranteed to panic because of the
`.unwrap()` on the `send` calls, so just call `recv` on both receivers after the
test executes to ensure that both threads are dying/dead.
2015-05-05 12:55:17 +00:00
Michael Sproul
68f5c8475a Markdown edits for diagnostic errors. 2015-05-05 21:38:06 +10:00