bors [Thu, 24 May 2018 07:14:21 +0000 (07:14 +0000)]
Auto merge of #50971 - alexcrichton:no-stringify, r=petrochenkov
rustc: Correctly pretty-print macro delimiters
This commit updates the `Mac_` AST structure to keep track of the delimiters
that it originally had for its invocation. This allows us to faithfully
pretty-print macro invocations not using parentheses (e.g. `vec![...]`). This in
turn helps procedural macros due to #43081.
bors [Wed, 23 May 2018 12:24:48 +0000 (12:24 +0000)]
Auto merge of #50866 - michaelwoerister:relocations-in-vec, r=oli-obk
Use different datastructure for MIRI relocations
This PR makes relocations in MIRI used a sorted vector instead of a `BTreeMap` which should make a few common operations more efficient. Let's see if that's true.
bors [Wed, 23 May 2018 09:50:54 +0000 (09:50 +0000)]
Auto merge of #50528 - whitfin:issue-50508, r=michaelwoerister
Remove attribute_cache from CrateMetadata
This PR will fix #50508 by removing the `attribute_cache` from the `CrateMetadata` struct. Seeing as performance was referenced in the original issue, I also cleaned up a `self.entry(node_id);` call which might have occasionally happened redundantly.
bors [Wed, 23 May 2018 07:15:34 +0000 (07:15 +0000)]
Auto merge of #50798 - bobtwinkles:nll_facts_invalidate, r=nikomatsakis
Generate "invalidates" facts when -Znll-facts is passed
Most of the new code is copied directly from the heart of the MIR borrowchecker. I was expecting more fundamental structural changes, hence the copying. This appears to work as it stands, but I'd like to submit a follow-up PR to reduce code duplication. I figured that could wait though, since this is blocking a large amount of work in the borrow check repository and I'm out of time for tonight =).
bors [Wed, 23 May 2018 02:44:08 +0000 (02:44 +0000)]
Auto merge of #50982 - alexcrichton:less-warnings, r=nikomatsakis
rustc: Fix another double-lint issue with `crate::`
This commit fixes another issue in the `absolute_path_not_starting_with_crate`
lint where it warns twice about an import which may contain `self`. It turns out
there were a few more locations that needed updating to use `root_id` and
`root_span` introduced in #50970 and after that it looks to work like a charm!
Alex Crichton [Tue, 22 May 2018 22:34:30 +0000 (15:34 -0700)]
rustc: Fix another double-lint issue with `crate::`
This commit fixes another issue in the `absolute_path_not_starting_with_crate`
lint where it warns twice about an import which may contain `self`. It turns out
there were a few more locations that needed updating to use `root_id` and
`root_span` introduced in #50970 and after that it looks to work like a charm!
Alex Crichton [Tue, 22 May 2018 15:01:21 +0000 (08:01 -0700)]
rustc: Correctly pretty-print macro delimiters
This commit updates the `Mac_` AST structure to keep track of the delimiters
that it originally had for its invocation. This allows us to faithfully
pretty-print macro invocations not using parentheses (e.g. `vec![...]`). This in
turn helps procedural macros due to #43081.
kennytm [Tue, 22 May 2018 16:26:23 +0000 (00:26 +0800)]
Rollup merge of #50963 - nnethercote:coercion-VecDeque1, r=petrochenkov
Right-size the `VecDeque` in `coerce_unsized`.
The default capacity of a VecDeque is 8, which is excessive here. In a
"base incremental" check build of rustc-perf's tuple-stress benchmark,
this decreases total heap allocation by 26%. I couldn't see a clear
speedup, but it can't hurt.
kennytm [Tue, 22 May 2018 16:26:20 +0000 (00:26 +0800)]
Rollup merge of #50952 - steveklabnik:2018-book, r=alexcrichton
Add the 2018 edition of the book to doc.rust-lang.org
The second edition of the book is on its way to the printers, and as such, is frozen. We've forked off the 2018 edition to add new stuff to; this PR now builds it so that people can read it on doc.rust-lang.org.
kennytm [Tue, 22 May 2018 16:26:19 +0000 (00:26 +0800)]
Rollup merge of #50947 - QuietMisdreavus:nice-tabs, r=GuillaumeGomez
rustdoc: set tab width in rust source blocks
cc https://github.com/rust-lang/rust/issues/49155 (fixes it?)
This sets the tab width ([in supported browsers](https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size)) in Rust source blocks to 4 spaces wide (instead of the default 8), to correspond with the style guidelines.
This commit fixes an accidental regression from #50473 where lifetime tokens
produced by procedural macros ended up getting lost in translation in the
compiler and not actually producing parseable code. The issue lies in the fact
that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for
gluing joint tokens together forgot to take this into account so the lifetime
inside of `Ident` was missing the leading tick!
The `glue` implementation here is updated to create a new `Symbol` in these
situations to manufacture a new `Ident` with a leading tick to ensure it parses
correctly.
The original "short form" printing was introduced when `target_feature` was added to the `doc(cfg)` handling. However, it didn't properly propagate the "short form" indicator if the cfg was a combination of multiple conditionals, so the linked issue happened. This changes the handling to use a bool in the original `Html` wrapper, rather than a separate wrapper struct that defers to the original one.
kennytm [Tue, 22 May 2018 16:26:08 +0000 (00:26 +0800)]
Rollup merge of #50849 - est31:visit_closure_args, r=michaelwoerister
CheckLoopVisitor: also visit closure arguments
This turns the ICE #50581 in this code:
```rust
fn main() {
|_: [u8; break]| ();
}
```
from
```
'assertion failed: self.tcx.sess.err_count() > 0', librustc_typeck/check/mod.rs
```
to
```
librustc_mir/hair/cx/expr.rs:543: invalid loop id for break: not inside loop scope
```
which is an ICE as well but at a later stage during compilation and most importantly
fixes of bug #50576 will fix this as well.
As this "only" moves an ICE to a later stage, I didn't add any tests.
Now I have manually verified the default impls of the visitor trait to check whether we have missed any other opportunity to visit more stuff and coudln't find anything (except the missing `break` visit I've fixed in #50829 but that one was already r+'d so I didn't want to push more commits).
The default capacity of a VecDeque is 8, which is excessive here. In a
"base incremental" check build of rustc-perf's tuple-stress benchmark,
this decreases total heap allocation by 26%. I couldn't see a clear
speedup, but it can't hurt.
bors [Tue, 22 May 2018 06:54:34 +0000 (06:54 +0000)]
Auto merge of #50876 - matthewjasper:rollback-trivial-bounds, r=nikomatsakis
Filter global bounds from ParamEnv again.
This PR adds back the filtering of global bounds from ParamEnv as a temporary solution for #50825.
<details>
Long term, the fix seems like it should be changing the priority in `candidate_should_be_dropped_in_favor_of` so that (global) where clauses aren't considered as highly.
bors [Tue, 22 May 2018 04:17:20 +0000 (04:17 +0000)]
Auto merge of #50838 - alexcrichton:token-impls, r=eddyb
rustc: Fix joint-ness of stringified token-streams
This commit fixes `StringReader`'s parsing of tokens which have been stringified
through procedural macros. Whether or not a token tree is joint is defined by
span information, but when working with procedural macros these spans are often
dummy and/or overridden which means that they end up considering all operators
joint if they can!
The fix here is to track the raw source span as opposed to the overridden span.
With this information we can more accurately classify `Punct` structs as either
joint or not.
bors [Mon, 21 May 2018 23:26:32 +0000 (23:26 +0000)]
Auto merge of #49283 - varkor:combining-chars-escape_debug, r=SimonSapin
Escape combining characters in char::Debug
Although combining characters are technically printable, they make little sense to print on their own with `Debug`: it'd be better to escape them like non-printable characters.
This is a breaking change, but I imagine the fact `escape_debug` is rare and almost certainly primarily used for debugging that this is an acceptable change.
Resolves #41922.
bors [Mon, 21 May 2018 21:16:16 +0000 (21:16 +0000)]
Auto merge of #50812 - kennytm:fix-50756-miri-bad-float-behavior, r=oli-obk
Fix issue #50811 (`NaN > NaN` was true).
Fix #50811
Make sure the float comparison output is consistent with the expected behavior when NaN is involved.
----
Note: This PR is a **BREAKING CHANGE**. If you have used `>` or `>=` to compare floats, and make the result as the length of a fixed array type, like:
```rust
use std::f64::NAN;
let x: [u8; (NAN > NAN) as usize] = [1];
```
then the code will no longer compile. Previously, all float comparison involving NaN will just return "Greater", i.e. `NAN > NAN` would wrongly return `true` during const evaluation. If you need to retain the old behavior (why), you may replace `a > b` with `a != a || b != b || a > b`.