Commit Graph

42091 Commits

Author SHA1 Message Date
Manish Goregaokar
8dc6e16933 Add support for registering attributes with rustc in plugins
This lets plugin authors opt attributes out of the `custom_attribute`
and `unused_attribute` checks.
2015-05-07 13:41:20 +05:30
bors
fc45fd99f5 Auto merge of #25117 - jooert:tests, r=alexcrichton 2015-05-06 09:48:58 +00: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
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
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
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
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
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
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
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
Steven Allen
b630cd74dc Strings and vectors are not built-in types.
strs messy but string is something else...
2015-05-04 17:38:10 -04:00
Tshepang Lekhonkhobe
93055587a2 doc: fix markup 2015-05-04 23:07:35 +02:00
bors
f49a98431b Auto merge of #25103 - alexcrichton:issue-25072, r=brson
This was one last spot where directories were being leaked through with
arguments of the form `\\?\` which neither `ld.exe` nor `gcc.exe` does
understands so the prefix needed to be stripped.

Closes #25072
2015-05-04 20:48:49 +00:00
Brian Anderson
2de6515de8 doc: rustup.sh doesn't require sudo 2015-05-04 13:23:27 -07:00