bors [Thu, 30 Mar 2017 06:48:52 +0000 (06:48 +0000)]
Auto merge of #40597 - jseyfried:improve_span_expn_info, r=jseyfried
macros: improve `Span`'s expansion information
This PR improves `Span`'s expansion information. More specifically:
- It refactors AST node span construction to preserve expansion information.
- Today, we only use the underlying tokens' `BytePos`s, throwing away the `ExpnId`s.
- This improves the accuracy of AST nodes' expansion information, fixing #30506.
- It refactors `span.expn_id: ExpnId` to `span.ctxt: SyntaxContext` and removes `ExpnId`.
- This gives all tokens as much hygiene information as `Ident`s.
- This is groundwork for procedural macros 2.0 `TokenStream` API.
- This is also groundwork for declarative macros 2.0, which will need this hygiene information for some non-`Ident` tokens.
- It simplifies processing of spans' expansion information throughout the compiler.
- It fixes #40649.
- It fixes #39450 and fixes part of #23480.
Corey Farwell [Wed, 29 Mar 2017 20:53:32 +0000 (16:53 -0400)]
Rollup merge of #40832 - pftbest:fix_msp430, r=stjepang
libcore: fix compilation on 16bit target (MSP430).
Since PR #40601 has been merged, libcore no longer compiles on MSP430.
The reason is this code in `break_patterns`:
```rust
let mut random = len;
random ^= random << 13;
random ^= random >> 17;
random ^= random << 5;
random &= modulus - 1;
```
It assumes that `len` is at least a 32 bit integer.
As a workaround replace `break_patterns` with an empty function for 16bit targets.
Corey Farwell [Wed, 29 Mar 2017 20:53:31 +0000 (16:53 -0400)]
Rollup merge of #40816 - estebank:issue-38321, r=nikomatsakis
Clarify suggetion for field used as method
Instead of
```rust
error: no method named `src_addr` found for type `&wire::ipv4::Repr` in the current scope
--> src/wire/ipv4.rs:409:34
|
409 | packet.set_src_addr(self.src_addr());
| ^^^^^^^^
|
note: did you mean to write `self.src_addr`?
--> src/wire/ipv4.rs:409:34
|
409 | packet.set_src_addr(self.src_addr());
| ^^^^^^^^
```
present
```rust
error: no method named `src_addr` found for type `&wire::ipv4::Repr` in the current scope
--> src/wire/ipv4.rs:409:34
|
409 | packet.set_src_addr(self.src_addr());
| ^^^^^^^^ field, not a method
|
= help: did you mean to write `self.src_addr` instead of `self.src_addr(...)`?
```
Corey Farwell [Wed, 29 Mar 2017 20:53:30 +0000 (16:53 -0400)]
Rollup merge of #40814 - abonander:issue_39436, r=jseyfried
Rustdoc: memoize `pub use`-reexported macros so they don't appear twice in docs
Closes #39436
Preserves existing behavior for `#[macro_reexport]`. `pub use`'d macros are shown as reexports unless inlined, and also correctly obey `#[doc(hidden)]`.
Corey Farwell [Wed, 29 Mar 2017 20:53:29 +0000 (16:53 -0400)]
Rollup merge of #40780 - aidanhs:aphs-cache-git-modules, r=alexcrichton
Attempt to cache git modules
Partial resolution of #40772, appveyor remains to be done once travis looks like it's working ok.
The approach in this PR is based on the `--reference` flag to `git-clone`/`git-submodule --update` and is a compromise based on the current limitations of the tools we're using.
The ideal would be:
1. have a cached pristine copy of rust-lang/rust master in `$HOME/rustsrc` with all submodules initialised
2. clone the PR branch with `git clone --recurse-submodules --reference $HOME/rustsrc git@github.com:rust-lang/rust.git`
This would (in the nonexistent ideal world) use the pristine copy as an object cache for the top level repo and all submodules, transferring over the network only the changes on the branch. Unfortunately, a) there is no way to manually control the initial clone with travis and b) even if there was, cloned submodules don't use the submodules of the reference as an object cache. So the steps we end up with are:
1. have a cached pristine copy of rust-lang/rust master in `$HOME/rustsrc` with all submodules initialised
2. have a cloned PR branch
3. extract the path of each submodule, and explicitly `git submodule update --init --reference $HOME/rustsrc/$module $module` (i.e. point directly to the location of the pristine submodule repo) for each one
I've also taken some care to make this forward compatible, both for adding and removing submodules.
Corey Farwell [Wed, 29 Mar 2017 12:57:03 +0000 (08:57 -0400)]
Rollup merge of #40720 - mitsuhiko:feature/rev-key, r=BurntSushi
Added core::cmp::Reverse for sort_by_key reverse sorting
I'm not sure if this is the best way to go about proposing this feature but it's pretty useful. It allows you to use `sort_by_key` and return tuples where a single item is then reversed to how it normally sorts.
I quite miss something like this in Rust currently though I'm not sure if this is the best way to implement it.
Corey Farwell [Wed, 29 Mar 2017 03:19:24 +0000 (23:19 -0400)]
Rollup merge of #40838 - lukaramu:std-net-docs, r=GuillaumeGomez
Improve std::net docs
Fixes #29363
Summary:
* Added a _lot_ of missing links, both to other types/methods and to IETF RFCs, and changed occurences of just "RFC" to "IETF RFC"
* Expanded a bunch of top-level docs, specifically the module docs & the docs for `TcpListener`, `TcpStream`, `UdpSocket`, `IpAddr`, `Ipv4Addr`, `Ipv6Addr`, `SocketAddr`, `SocketAddrV4`, `SocketAddrV6`,
* Expanded method docs for `SocketAddrV6`, `AddrParseError`,
* Various edits for clarity, consistency, and accuracy
See the commit descriptions for more detail.
Things not done quite as laid out in the task list in #29363:
* `AddrParseError` still doesn't have examples, but I wasn't quite sure how to do them; other `FromStr` error types don't have any, either
* I didn't link to an IETF RFC in `IpAddr`, but in `Ipv4Addr` and `Ipv6Addr` and linked tho those from `IpAddr`; this seems more appropriate to me
* Similarly, I didn't really exand `SocketAddr`'s docs, but elaborated on `SocketAddrV4` and `SocketAddrV6`'s and linked to them from `SocketAddr`
Theres definitely still room for improvement, but this should be a good first effort :smile:
Corey Farwell [Wed, 29 Mar 2017 03:19:23 +0000 (23:19 -0400)]
Rollup merge of #40731 - sfackler:vec-from-iter-spec, r=aturon
Specialize Vec::from_iter for vec::IntoIter
It's fairly common to expose an API which takes an `IntoIterator` and
immediately collects that into a vector. It's also common to buffer
a bunch of items into a vector and then pass that into one of these
APIs. If the iterator hasn't been advanced, we can make this `from_iter`
simply reassemble the original `Vec` with no actual iteration or
reallocation.
Corey Farwell [Wed, 29 Mar 2017 03:19:22 +0000 (23:19 -0400)]
Rollup merge of #40682 - TigleyM:str_doc, r=steveklabnik
Update docs for std::str
fixes #29375
I noticed there are docs for the `str` primitive type, which contained extensive examples, so my additions give a more general explanation of `&str`. But please let me know if something can be explained more or changed.
Alex Crichton [Mon, 27 Mar 2017 20:24:39 +0000 (15:24 -0500)]
Rollup merge of #40865 - alexcrichton:downgrade-mingw, r=arielb1
appveyor: Downgrade MinGW to 6.2.0
It looks like the 6.3.0 MinGW comes with a gdb which has issues (#40184) that an
attempted workaround (#40777) does not actually fix (#40835). The original
motivation for upgradin MinGW was to fix build flakiness (#40546) due to newer
builds not exhibiting the same bug, so let's hope that 6.2.0 isn't too far back
in time and still contains the fix we need.
Alex Crichton [Mon, 27 Mar 2017 20:24:27 +0000 (15:24 -0500)]
Rollup merge of #40833 - Wallacoloo:doc_to_uppercase_typo, r=steveklabnik
Fix typo in char::to_uppercase documentation
Original documentation appears to have been copied from `char::to_lowercase` in a manner that made it imply that `char::to_uppercase` actually mapped unicode characters to their **lowercase** equivalent.
Alex Crichton [Mon, 27 Mar 2017 20:24:26 +0000 (15:24 -0500)]
Rollup merge of #40832 - pftbest:fix_msp430, r=stjepang
libcore: fix compilation on 16bit target (MSP430).
Since PR #40601 has been merged, libcore no longer compiles on MSP430.
The reason is this code in `break_patterns`:
```rust
let mut random = len;
random ^= random << 13;
random ^= random >> 17;
random ^= random << 5;
random &= modulus - 1;
```
It assumes that `len` is at least a 32 bit integer.
As a workaround replace `break_patterns` with an empty function for 16bit targets.
Alex Crichton [Mon, 27 Mar 2017 20:24:22 +0000 (15:24 -0500)]
Rollup merge of #40819 - donniebishop:master, r=alexcrichton
Link ParseBoolError to from_str method of bool
Referencing task in #29375. Sorry for not opening another branch on my fork for this. Was working on this early this morning and forgot to branch off master
Alex Crichton [Mon, 27 Mar 2017 20:24:18 +0000 (15:24 -0500)]
Rollup merge of #40778 - alexcrichton:update-cargo, r=alexcrichton
Update cargo submodule
I'm not really sure what we want the cadence here to be. We'll at the very least
update the Cargo submodule right before all releases, but otherwise I figured we
could just do it whenever needed or otherwise weekly (or something like that).
In any case, I don't have a super strong particular reason to do this, it's just
been a week or so since the release!
Alex Crichton [Mon, 27 Mar 2017 20:24:15 +0000 (15:24 -0500)]
Rollup merge of #40683 - nikomatsakis:incr-comp-coerce-unsized-info, r=eddyb
on-demand-ify `custom_coerce_unsized_kind` and `inherent-impls`
This "on-demand" task both checks for errors and computes the custom unsized kind, if any. This task is only defined on impls of `CoerceUnsized`; invoking it on any other kind of impl results in a bug. This is just to avoid having an `Option`, could easily be changed.
Alex Crichton [Mon, 27 Mar 2017 20:24:12 +0000 (15:24 -0500)]
Rollup merge of #40516 - alexcrichton:no-cache-handles, r=aturon
std: Don't cache stdio handles on Windows
This alters the stdio code on Windows to always call `GetStdHandle` whenever the
stdio read/write functions are called as this allows us to track changes to the
value over time (such as if a process calls `SetStdHandle` while it's running).
Alex Crichton [Mon, 27 Mar 2017 20:06:56 +0000 (13:06 -0700)]
appveyor: Downgrade MinGW to 6.2.0
It looks like the 6.3.0 MinGW comes with a gdb which has issues (#40184) that an
attempted workaround (#40777) does not actually fix (#40835). The original
motivation for upgradin MinGW was to fix build flakiness (#40546) due to newer
builds not exhibiting the same bug, so let's hope that 6.2.0 isn't too far back
in time and still contains the fix we need.
lukaramu [Mon, 27 Mar 2017 14:38:17 +0000 (16:38 +0200)]
Addressed requested changes for PR #40838
* Fixed spelling ToSocketAddr -> ToSocketAddrs in module docs
(which also fixes a link)
* Added missing "when" before "interacting" in module docs
* Changed SocketAddr's top-level docs to explicitly state what socket
addresses consist of, making them more consistent with SocketAddrV4's
and SocketAddrV6's docs
* Changed "in C" -> "in C's `netinet/in.h`"
* Changed wording in is_ipv4/is_ipv6 methods to ", `false` otherwise"
* Add missing closing ` ``` ` in Ipv6Addr's examples
* Removed "Errors" section in ToSocketAddrs' to_socket_addrs method as it
was rather redundant
bors [Mon, 27 Mar 2017 05:28:32 +0000 (05:28 +0000)]
Auto merge of #40764 - arielb1:range-nodes, r=eddyb
keep the AST node-id when lowering ExprKind::Range
When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.
lukaramu [Sun, 26 Mar 2017 12:13:37 +0000 (14:13 +0200)]
Expanded and added links to std::net::{SocketAddr,SocketAddrV4,SocketAddrV6} docs
Part of #29363
Changed summary sentences of SocketAddr and IpAddr for consistency
Linked to SocketAddrV4 and SocketAddrV6 from SocketAddr, moving explaination
there
Expanded top-level docs for SocketAddrV4 and SocketAddrV6, linking to some
relevant IETF RFCs, and linking back to SocketAddr
Changed some of the method summaries to third person as per RFC 1574; added
links to IETF RFCs where appropriate