Commit Graph

42076 Commits

Author SHA1 Message Date
Tamir Duberstein
5cfa713a1c Use empty() instead of a special const 2015-05-05 22:03:45 -04: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
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
bors
6cd7486113 Auto merge of #24979 - jooert:test-22471, r=pnkfelix
Closes #22471.
2015-05-05 15:39:02 +00: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
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
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
Alex Crichton
e6c23bb893 rustc_trans: Fix another windows verbatim path
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 13:18:00 -07:00
bors
9b481f89d1 Auto merge of #25056 - jooert:sometests, r=alexcrichton
Add several regression tests and remove some unnecessary FIXMEs.
2015-05-04 18:59:47 +00:00
Alex Crichton
700cff5262 std: Join threads in select! doctest
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-04 11:31:36 -07:00
Alex Crichton
9b1dd4b35a std: Fix {atime,mtime,ctime}_nsec accessors
These all had a typo where they were accessing the seconds field, not the
nanoseconds field.
2015-05-04 11:21:49 -07:00
Johannes Oertel
e7d052ebd9 Remove several FIXMEs 2015-05-04 20:05:40 +02:00
Joseph Crail
464069a4bf Fix spelling errors in documentation. 2015-05-04 13:21:27 -04:00
bors
70db76602e Auto merge of #25078 - nham:std_net_impl_debug, r=alexcrichton
I'm uncertain whether the 3 implementations in `net2` should unwrap the socket address values. Without unwrapping it looks like this:

```
UdpSocket { addr: Ok(V4(127.0.0.1:34354)), inner: 3 }
TcpListener { addr: Ok(V4(127.0.0.1:9123)), inner: 4 }
TcpStream { addr: Ok(V4(127.0.0.1:9123)), peer: Ok(V4(127.0.0.1:58360)), inner: 5 }
```

One issue is that you can create, e.g. `UdpSocket`s with bad addresses, which means you can't just unwrap in the implementation:

```
#![feature(from_raw_os)]
use std::net::UdpSocket;
use std::os::unix::io::FromRawFd;

let sock: UdpSocket = unsafe { FromRawFd::from_raw_fd(-1) };
println!("{:?}", sock); // prints "UdpSocket { addr: Err(Error { repr: Os(9) }), inner: -1 }"

```

Fixes #23134.
2015-05-04 17:12:19 +00:00
Lee Jeffery
86de427b25 Fix incorrect link in Option documentation. 2015-05-04 17:53:08 +01:00
bors
a979efc2f9 Auto merge of #25082 - shepmaster:inline-docs, r=steveklabnik 2015-05-04 13:16:20 +00:00
Johannes Oertel
c4d81024db Add regression test for #22471
Closes #22471.
2015-05-04 14:03:12 +02:00
Huon Wilson
4b46546af0 Make BitVec::process faster (branch free).
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-04 21:20:10 +10:00
bors
165a8dec9c Auto merge of #25055 - bguiz:patch-2, r=steveklabnik
- I found n error in the book, before contributing the patch to fix it, I had to find where they were hosted
- It took me quite look to find where within the rust-lang *organisation* it was! ... and this should make it easier for the next person in the same position
2015-05-04 09:11:27 +00:00
Felix S. Klock II
c62c908f08 Correct pretty-printing of type Foo<T> where T: Bound = ...;
Fix #25031
2015-05-04 10:21:39 +02:00
bors
1ea9e8db6f Auto merge of #25067 - koute:master, r=alexcrichton
Without the inline annotation this:
    str::from_utf8_unchecked( slice::from_raw_parts( ptr, len ) )
doesn't get inlined which can be pretty brutal performance-wise
when used in an inner loop of a low level string manipulation method.
2015-05-04 07:24:24 +00:00