OOM can't unwind today, and historically it's been optimized as if it can't
unwind. This accidentally regressed with recent changes to the OOM handler, so
this commit adds in a codegen test to assert that everything gets optimized away
after the OOM function is approrpiately classified as nounwind
Closes#50925
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.
Closes#50840
"crate-ify" paths that begin with a renamed crate
This does two things:
- crate-ify paths that begin with a renamed crate (i.e., add `crate::`) to the front
Fixes https://github.com/rust-lang/rust/issues/50996
I also added tests for a few other scenarios.
r? @alexcrichton
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.
r? @oli-obk
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.
r? @michaelwoerister
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 =).
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!
Closes#50978
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!
Closes#50978
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
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).