Commit Graph

42810 Commits

Author SHA1 Message Date
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
Carol Nichols
abc0017f3b Remove an obsolete example in a comment 2015-05-04 21:44:22 -04:00
Carol Nichols
77acf7b4ee Use the lowercase version of the box syntax 2015-05-04 21:43:11 -04:00
Carol Nichols
55e7f9b7d6 Changing Vec to Box<[T]> 2015-05-04 21:33:51 -04: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
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
Felix S. Klock II
42cb2de139 Avoid latent (harmless) overflow in core::slice.
This overflow does not cause any problems; it just causes errors to be
signalled when compiling with `-C debug-assertions`.

Fix #24997
2015-05-04 09:57:42 +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
Nick Hamann
51463c3b17 Improve std::vec module documentation.
This changes the std::vec module docs to use full sentences. It also adds an example
for indexing vectors.
2015-05-03 23:47:10 -05:00
bors
6517a0e90e Auto merge of #25047 - sinkuu:vec_intoiter_override, r=alexcrichton
Override methods `count`, `last`, and `nth` in vec::IntoIter.

#24214
2015-05-04 04:05:37 +00:00
bors
45b9a34a7b Auto merge of #25044 - tshepang:doc-addr, r=alexcrichton 2015-05-04 02:19:09 +00:00
Abhishek Chanda
285ab0266c Add functions to convert IPv4 to long and back 2015-05-03 19:08:53 -07:00
Nick Hamann
987eb28eca Add tests for 3 Debug implementations 2015-05-03 20:01:25 -05:00
bors
ce1150b9f0 Auto merge of #25043 - alexcrichton:musl-out-of-stack, r=nikomatsakis
Stack overflow detection does not currently work with MUSL, so this test needs
to be disabled.
2015-05-04 00:31:09 +00:00
Carol Nichols
d3667746d4 Update tests to not use old ~ syntax 2015-05-03 20:16:03 -04:00