Rollup of 19 pull requests
Successful merges:
- #65016 (Always inline `mem::{size_of,align_of}` in debug builds)
- #65197 (Prepare `MutVisitor`s to handle interned projections)
- #65201 (Disable Go and OCaml bindings when building LLVM)
- #65334 (Add long error explanation for E0575)
- #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic)
- #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions)
- #65472 (Use a sharded dep node to dep node index map)
- #65480 (Speed up `LexicalResolve::expansion()`)
- #65493 (Add long error explanation for E0584)
- #65496 (properly document panics in div_euclid and rem_euclid)
- #65498 (Plugins deprecation: don’t suggest simply removing the attribute)
- #65508 (add option to ping llvm ice-breakers to triagebot)
- #65511 (save-analysis: Nest tables when processing impl block definitions)
- #65513 (reorder fmt docs for more clarity)
- #65532 (doc: make BitSet intro more short)
- #65535 (rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.)
- #65540 (show up some extra info when t!() fails)
- #65549 (Fix left/right shift typo in wrapping rotate docs)
- #65552 (Clarify diagnostics when using `~` as a unary op)
Failed merges:
- #65390 (Add long error explanation for E0576)
- #65434 (Add long error explanation for E0577)
- #65471 (Add long error explanation for E0578)
r? @ghost
rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.
While rebasing #59789 I noticed we can do this now. However, it doesn't help much without changing `inferred_outlives_of` to the same type, which I might try next.
reorder fmt docs for more clarity
I adjusted these docs in https://github.com/rust-lang/rust/pull/65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.
save-analysis: Nest tables when processing impl block definitions
Similar to #65353 (which this PR should've been a part of), however in this case we didn't previously nest the tables when processing trait paths in impl block declarations.
Closes#65411
Plugins deprecation: don’t suggest simply removing the attribute
Building Servo with a recent Nightly produces:
```rust
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> components/script/lib.rs:14:1
|
14 | #![plugin(script_plugins)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default
```
First, linking to https://github.com/rust-lang/rust/issues/29597 is not ideal since there is pretty much no discussion there of the deprecation and what can be used instead. This PR changes the link to the deprecation PR which does have more discussion.
Second, the “remove this attribute” suggestion is rather unhelpful. Just because a feature is deprecated doesn’t mean that simply removing its use without a replacement is acceptable.
In the case of custom lint, there is no replacement available. Prefixing a message with “help:” when telling users that they’re screwed honestly feels disrespectful.
This PR also changes the message to be more factual.
properly document panics in div_euclid and rem_euclid
For signed numbers, document that `div_euclid` and `rem_euclid` panic not just when `rhs` is 0, but also when the division overflows.
For unsigned numbers, document that `div_euclid` and `rem_euclid` panic when `rhs` is 0.
Speed up `LexicalResolve::expansion()`
A couple of improvements that speed up `unicode_normalization` by about 4%. The first commit was enabled by the improvements to `BitSet` iteration in #65425.
r? @nikomatsakis
Avoid unnecessary `TokenTree` to `TokenStream` conversions
A `TokenStream` contains any number of `TokenTrees`. Therefore, a single `TokenTree` can be promoted to a `TokenStream`. But doing so costs two allocations: one for the single-element `Vec`, and one for the `Lrc`. (An `IsJoint` value also must be added; the default is `NonJoint`.)
The current code converts `TokenTree`s to `TokenStream`s unnecessarily in a few places. This PR removes some of these unnecessary conversions, both simplifying the code and speeding it up.
r? @petrochenkov
Disable Go and OCaml bindings when building LLVM
Instead of instaling OCaml bindings in a location where installation
will not fail, don't build them in the first place.
Prepare `MutVisitor`s to handle interned projections
The following are all the files where mir's `MutVisitor` is implemented. The `-` there stands for no changes, `visit_place` wasn't making any change on `Place`s. `x` stands for this file was changed to make `visit_place` do whatever it was doing with the base but avoid modifying the projection, instead just create a new one and assign to it.
```
[-] src/librustc_mir/transform/no_landing_pads.rs
[x] src/librustc_mir/transform/promote_consts.rs
[x] src/librustc_mir/transform/generator.rs
[x] src/librustc_mir/transform/erase_regions.rs
[-] src/librustc_mir/transform/instcombine.rs
[x] src/librustc_mir/transform/inline.rs
[x] src/librustc_mir/transform/simplify.rs
[x] src/librustc_mir/util/def_use.rs
[-] src/librustc_mir/transform/const_prop.rs
[-] src/librustc_mir/transform/cleanup_post_borrowck.rs
[x] src/librustc_mir/borrow_check/nll/renumber.rs
[-] src/librustc_mir/transform/copy_prop.rs
```
There is some code repetition, just created the PR so we can start discussing it.
/cc @oli-obk @nikomatsakis
Always inline `mem::{size_of,align_of}` in debug builds
Those two are const fn and do not have any arguments. Inlining
helps reducing generated code size in debug builds.
See also #64996.
Likewise for `NestedMetaItem::tokens()`. Also, add
`MetaItemKind::token_trees_and_joints()`, which `MetaItemKind::tokens()`
now calls.
This avoids some unnecessary `TokenTree` to `TokenStream` conversions,
and removes the need for the clumsy
`TokenStream::append_to_tree_and_joint_vec()`.
The current code has this impl:
```
impl<T: Into<TokenStream>> iter::FromIterator<T> for TokenStream
```
If given an `IntoIterator<Item = TokenTree>`, it will convert each individual
`TokenTree` to a `TokenStream` (at the cost of two allocations: a `Vec`
and an `Lrc`). It will then merge those `TokenStream`s into a single
`TokenStream`. This is inefficient.
This commit changes the impl to this less general one:
```
impl iter::FromIterator<TokenTree> for TokenStream
```
It collects the `TokenTree`s into a single `Vec` first and then converts that
to a `TokenStream` by wrapping it in a single `Lrc`. The previous generality
was unnecessary; no other code needs changing.
This change speeds up several benchmarks by up to 4%.
Rollup of 8 pull requests
Successful merges:
- #65237 (Move debug_map assertions after check for err)
- #65316 (make File::try_clone produce non-inheritable handles on Windows)
- #65319 (InterpCx: make memory field public)
- #65461 (Don't recommend ONCE_INIT in std::sync::Once)
- #65465 (Move syntax::ext to a syntax_expand and refactor some attribute logic)
- #65475 (add example for type_name)
- #65478 (fmt::Write is about string slices, not byte slices)
- #65486 (doc: fix typo in OsStrExt and OsStringExt)
Failed merges:
r? @ghost