Originally, there has been a dedicated pass for renumbering
AST NodeIds to have actual values. This pass had been added by
commit a5ad4c3794.
Then, later, this step was moved to where it resides now,
macro expansion. See commit c86c8d41a2
or PR #36438.
The comment snippet, added by the original commit, has
survived the times without any change, becoming outdated
at removal of the dedicated pass.
Nowadays, grepping for the next_node_id function will show up
multiple places in the compiler that call it, but the main
rewriting that the comment talks about is still done in the
expansion step, inside an innocious looking visit_id function
that's called during macro invocation collection.
Rollup of 15 pull requests
Successful merges:
- #76718 (Move Vec UI tests to unit tests when possible)
- #78093 (Clean up docs for 'as' keyword)
- #78425 (Move f64::NAN ui tests into `library`)
- #78465 (Change as_str → to_string in proc_macro::Ident::span() docs)
- #78584 (Add keyboard handling to the theme picker menu)
- #78716 (Array trait impl comment/doc fixes)
- #78727 ((rustdoc) fix test for trait impl display)
- #78733 (fix a couple of clippy warnings:)
- #78735 (Simplify the implementation of `get_mut` (no unsafe))
- #78738 (Move range in ui test to ops test in library/core)
- #78739 (Fix ICE on type error in async function)
- #78742 (make intern_const_alloc_recursive return error)
- #78756 (Update cargo)
- #78757 (Improve and clean up some intra-doc links)
- #78758 (Fixed typo in comment)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
(rustdoc) fix test for trait impl display
The test checks that parameters and return values with `impl Trait` types are correctly generated in rustdoc's output.
In essence, the previous version of the test checked the absence of values that would never be generated by rustdoc, so it could basically never fail. These values were adjusted to the expected output and are now required to exist in rustdoc's output. See https://github.com/rust-lang/rust/issues/55201#issuecomment-716182474 for a detailed explanation of the reasoning behind the changes.
Note that the output of rustdoc for `impl Trait`s in parameters and return values did not change since the inital test creation, so this PR only modifies the test.
Closes#55201
Add keyboard handling to the theme picker menu
This PR is mostly designed to bring the theme picker closer to feature parity with the menu bar from docs.rs. Though the rustdoc theme picker is technically already usable from the keyboard, it's really weird that arrow keys work on some of the menus, but not all of them, in the exact same page.
Change as_str → to_string in proc_macro::Ident::span() docs
There is no `as_str` function on Ident any more.
Also change it to an intra doc link while we're at it.
Move Vec UI tests to unit tests when possible
Helps with #76268.
I'm moving the tests using `Vec` or `VecDeque`.
````@rustbot```` modify labels: A-testsuite C-cleanup T-libs
Bump actions/checkout to version 2
This was recommended by GitHub Support to try reducing the things that could've caused #78743. I checked the changelog and there should be no practical impact for us (we already set an explicit fetch-depth).
r? `@Mark-Simulacrum`
`crate::` -> `core::`
It looks weird to have `crate::` in the link text and we use the actual
crate name everywhere else.
If anyone is curious, I used this Vim command to update all the links:
%s/\(\s\)\[`crate::\(.*\)`\]/\1[`core::\2`](crate::\2)/g
This was recommended by GitHub Support to try reducing the things that
could've caused #78743. I checked the changelog and there should be no
practical impact for us (we already set an explicit fetch-depth).
Provide diagnostic suggestion in ExprUseVisitor Delegate
The [Delegate trait](981346fc07/compiler/rustc_typeck/src/expr_use_visitor.rs (L28-L38)) currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.
Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.
Eg:
```
let arr : [String; 5];
let [a, ...] = arr;
^^^ E1 ^^^ = ^^E2^^
```
Here `arr` is moved because of the binding created E1. However, when we
point to E1 in diagnostics with the message `arr` was moved, it can be
confusing. Rather we would like to report E2 to the user.
Closes: https://github.com/rust-lang/project-rfc-2229/issues/20
r? `@ghost`
Refactorings in preparation for const value trees
cc #72396
This PR changes the `Scalar::Bits { data: u128, size: u8 }` variant to `Scalar::Bits(ScalarInt)` where `ScalarInt` contains the same information, but is `repr(packed)`. The reason for using a packed struct is to allow enum variant packing to keep the original size of `Scalar` instead of adding another word to its size due to padding.
Other than that the PR just gets rid of all the inspection of the internal fields of `Scalar::Bits` which were frankly scary. These fields have invariants that we need to uphold and we can't do that without making the fields private.
r? `@ghost`
Use reparsed `TokenStream` if we captured any inner attributes
Fixes#78675
We now bail out of `prepend_attrs` if we ended up capturing any inner
attributes (which can happen in several places, due to token capturing
for `macro_rules!` arguments.