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.
Closes#50840
Codegen issues commonly only manifest under specific circumstances,
e.g. if multiple codegen units are used and ThinLTO is enabled.
However, these configuration are threaded, making the use of LLVM
debugging facilities hard, as output is interleaved.
This patch adds a -Z no-parallel-llvm flag, which allows disabling
parallelization of codegen and linking, while otherwise preserving
behavior with regard to codegen units and LTO.
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.
Micro-optimization on PR#50697
We should stop iterating through the indices in the `init_path_map` once we've already found a match for the local.
r? @nikomatsakis or @pnkfelix
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.
rustc: Fix procedural macros generating lifetime tokens
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.
Closes#50942
rustdoc: use "short form" doc(cfg) printing even when combined with other conditionals
Fixes https://github.com/rust-lang/rust/issues/49334
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.
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.
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.
a722296b6e/src/librustc/traits/select.rs (L2017-L2022)
</details>
r? @nikomatsakis
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.
Closes#50700