Commit Graph

42259 Commits

Author SHA1 Message Date
Kevin Mehall
6c6b20031c Add TCP_* constants for mips/mipsel Linux
PR #24611 added these for other architectures, but missed
the `#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]`
version of the module. The values are the same.
2015-05-05 23:54:45 +00:00
Kevin Mehall
dff7676b7d Fix MIPS build errors in libstd/os/linux/raw.rs 2015-05-05 23:49:23 +00: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
bors
c0100ce846 Auto merge of #25113 - pnkfelix:dropck-itemless-traits, r=huonw
Generalize dropck to ignore item-less traits

Fix #24805.

(This is the reopened + rebased version of PR #24898)
2015-05-05 11:06:35 +00:00
Felix S. Klock II
939e4c9ea9 Guard against overflow in codemap::span_to_lines.
Make `span_to_lines` to return a `Result`.
(This is better than just asserting internally, since it allows caller
to decide if they can recover from the problem.)

Added type alias for `FileLinesResult` returned by `span_to_lines`.

Update embedded unit test to reflect `span_to_lines` signature change.

In diagnostic, catch `Err` from `span_to_lines` and print
`"(internal compiler error: unprintable span)"` instead.

----

There a number of recent issues that report the bug here.  See
e.g. #24761 and #24954.

This change *might* fix them. However, that is not its main goal.
The main goals are:

 1. Make it possible for callers to recover from an error here, and

 2. Insert a more conservative check, in that we are
    also checking that the files match up.
2015-05-05 12:51:09 +02:00
bors
31e3cb7c4e Auto merge of #25111 - Manishearth:rollup, r=Manishearth
r? @Manishearth
2015-05-05 04:47:56 +00:00
Jason Yeo
0476586643 Fix indentation in while-let example 2015-05-05 12:02:18 +08:00
Manish Goregaokar
135502ef00 Rollup merge of #25109 - alexcrichton:fix-doc-crates-io-link, r=steveklabnik
Right now it's all hosted over GitHub pages so https doesn't work, so only link
to the http version.
2015-05-05 09:24:48 +05:30
Manish Goregaokar
dc15a151ef Rollup merge of #25107 - Stebalien:fix-faq, r=steveklabnik
`str`s is messy but string is incorrect.
2015-05-05 09:24:42 +05:30
Manish Goregaokar
60f01b49af Rollup merge of #25105 - tshepang:doc-addr, r=steveklabnik
This did not render as intended:

>This is defined in RFC 5737 - 192.0.2.0/24 (TEST-NET-1) - 198.51.100.0/24 (TEST-NET-2) - 203.0.113.0/24 (TEST-NET-3)

vs.

> This is defined in RFC 5737
- 192.0.2.0/24 (TEST-NET-1)
- 198.51.100.0/24 (TEST-NET-2)
- 203.0.113.0/24 (TEST-NET-3)
2015-05-05 09:24:36 +05:30
Manish Goregaokar
aff0782b23 Rollup merge of #25104 - brson:rustup, r=alexcrichton 2015-05-05 09:24:29 +05:30
Manish Goregaokar
266d4829ea Rollup merge of #25100 - jbcrail:fix-spelling-errors, r=steveklabnik
I corrected several spelling errors in the external documentation.
2015-05-05 09:24:22 +05:30
Manish Goregaokar
4fb22164a2 Rollup merge of #25099 - Eljay:master, r=steveklabnik 2015-05-05 09:24:16 +05:30
Manish Goregaokar
9f50d62200 Rollup merge of #25092 - pnkfelix:fix-pprint-of-type-items-with-where, r=alexcrichton
Correct pretty-printing of `type Foo<T> where T: Bound = ...;`

Fix #25031
2015-05-05 09:24:09 +05:30
Manish Goregaokar
86a858add5 Rollup merge of #25087 - nham:improve_vec_docs, r=Gankro
This commit does two things: it adds an example for indexing vectors, and it changes the \"Examples\" section to use full sentences.

This change was spurred by someone in the #rust IRC channel asking if there was a `.set()` method for changing the `i`-th value of a vector (they had missed that `Vec` implements `IndexMut`, which is easy to do if you're not aware of that trait).
2015-05-05 09:24:03 +05:30
Manish Goregaokar
74130520fb Rollup merge of #25081 - carols10cents:remove-extract-grammar, r=steveklabnik
This script used to be used to [extract the grammar sections from the reference](https://github.com/rust-lang/rust/pull/8585), but there is [now a separate src/doc/grammar.md](https://github.com/rust-lang/rust/pull/22308) that generates grammar.html where the grammar sections that used to be in the reference live, so there is no longer a need to extract the grammar from the reference.

I ❤️ deleting code :) But I totally understand if there's a reason to keep this around that I don't know about :)
2015-05-05 09:23:56 +05:30
Manish Goregaokar
6bb4998c7c Rollup merge of #25079 - alexcrichton:fix-nsec, r=aturon
These all had a typo where they were accessing the seconds field, not the
nanoseconds field.
2015-05-05 09:23:50 +05:30
Manish Goregaokar
a374b905dc Rollup merge of #25074 - killercup:patch-10, r=alexcrichton
Sweeten the two main HashMap/HashSet examples from [here](http://doc.rust-lang.org/std/collections/struct.HashMap.html) and [here](http://doc.rust-lang.org/std/collections/struct.HashSet.html) with some deref and loop sugar.

(I've only tested this using [this playpen][1].)

[1]: https://play.rust-lang.org/?code=fn%20main()%20%7B%0A%20%20%20%20use%20std%3A%3Acollections%3A%3AHashMap%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20type%20inference%20lets%20us%20omit%20an%20explicit%20type%20signature%20(which%0A%20%20%20%20%2F%2F%20would%20be%20%60HashMap%3C%26str%2C%20%26str%3E%60%20in%20this%20example).%0A%20%20%20%20let%20mut%20book_reviews%20%3D%20HashMap%3A%3Anew()%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20review%20some%20books.%0A%20%20%20%20book_reviews.insert(%22Adventures%20of%20Huckleberry%20Finn%22%2C%20%20%20%20%22My%20favorite%20book.%22)%3B%0A%20%20%20%20book_reviews.insert(%22Grimms%27%20Fairy%20Tales%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Masterpiece.%22)%3B%0A%20%20%20%20book_reviews.insert(%22Pride%20and%20Prejudice%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Very%20enjoyable.%22)%3B%0A%20%20%20%20book_reviews.insert(%22The%20Adventures%20of%20Sherlock%20Holmes%22%2C%20%22Eye%20lyked%20it%20alot.%22)%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20check%20for%20a%20specific%20one.%0A%20%20%20%20if%20!book_reviews.contains_key(%26(%22Les%20Mis%C3%A9rables%22))%20%7B%0A%20%20%20%20%20%20%20%20println!(%22We%27ve%20got%20%7B%7D%20reviews%2C%20but%20Les%20Mis%C3%A9rables%20ain%27t%20one.%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20book_reviews.len())%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20oops%2C%20this%20review%20has%20a%20lot%20of%20spelling%20mistakes%2C%20let%27s%20delete%20it.%0A%20%20%20%20book_reviews.remove(%26(%22The%20Adventures%20of%20Sherlock%20Holmes%22))%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20look%20up%20the%20values%20associated%20with%20some%20keys.%0A%20%20%20%20let%20to_find%20%3D%20%5B%22Pride%20and%20Prejudice%22%2C%20%22Alice%27s%20Adventure%20in%20Wonderland%22%5D%3B%0A%20%20%20%20for%20book%20in%20to_find.iter()%20%7B%0A%20%20%20%20%20%20%20%20match%20book_reviews.get(book)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Some(review)%20%3D%3E%20println!(%22%7B%7D%3A%20%7B%7D%22%2C%20*book%2C%20*review)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20None%20%3D%3E%20println!(%22%7B%7D%20is%20unreviewed.%22%2C%20*book)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20iterate%20over%20everything.%0A%20%20%20%20for%20(book%2C%20review)%20in%20book_reviews.iter()%20%7B%0A%20%20%20%20%20%20%20%20println!(%22%7B%7D%3A%20%5C%22%7B%7D%5C%22%22%2C%20*book%2C%20*review)%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%7D
2015-05-05 09:23:43 +05:30
Manish Goregaokar
b8fedad89b Rollup merge of #25068 - bguiz:patch-3, r=steveklabnik
- `File::open` is for opening a file in read-only mode
- `File::create` is for opening a file in write-only mode, which is what we want instead for this example to make sense
2015-05-05 09:23:36 +05:30
Steven Allen
decf395221 Implement retain for vec_deque 2015-05-04 23:04:06 -04:00
bors
0be117e273 Auto merge of #25095 - huonw:faster-bitvec, r=alexcrichton
This makes the `bit::vec::bench::bench_bit_vec_big_union` benchmark go
from `774 ns/iter (+/- 190)` to `602 ns/iter (+/- 5)`.

(There's room for more work here too: if one can guarantee 128-bit
alignment for the vector, the compiler actually optimises `union`,
`intersection` etc. to SIMD instructions, which end up being ~5x faster
that the original version, and 4x faster than the optimised version in
this patch.)
2015-05-05 03:01:29 +00:00
Michael Sproul
b9d484ff8c Error index style tweaks. 2015-05-05 11:17:00 +10:00
bors
435622028f Auto merge of #24652 - achanda:ip-long, r=alexcrichton 2015-05-04 23:31:18 +00:00
Alex Crichton
2c04696978 doc: Cargo documentation doesn't have https
Right now it's all hosted over GitHub pages so https doesn't work, so only link
to the http version.
2015-05-04 16:25:02 -07:00