Auto merge of #101811 - flip1995:clippyup, r=flip1995
Clippy pre beta branch fix
Before beta is branched on Friday, I want to move the `unused_peekable` lint that was added in this release cycle (1.65) to `nursery`. This lint was already reported twice (https://github.com/rust-lang/rust-clippy/issues/9456, https://github.com/rust-lang/rust-clippy/issues/9462) in a short time, so it is probably a good idea to fix it before it hits beta and then stable.
Rollup merge of #101812 - notriddle:notriddle/titles-button, r=GuillaumeGomez
rustdoc: clean up CSS `#titles` using flexbox
This commit allows it to stop manually specifying pixel heights for the tabs on search result pages. There's less messing with manual breakpoints and less complex CSS selectors.
Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk
Compute lint levels by definition
Lint levels are currently computed once for the whole crate. Any code that wants to emit a lint depends on this single `lint_levels(())` query. This query contains the `Span` for each attribute that participates in the lint level tree, so any code that wants to emit a lint basically depends on the spans in all files in the crate.
Contrary to hard errors, we do not clear the incremental session on lints, so this implicit world dependency pessimizes incremental reuse. (And is furthermore invisible for allowed lints.)
This PR completes https://github.com/rust-lang/rust/pull/99634 (thanks for the initial work `@fee1-dead)` and includes it in the dependency graph.
The design is based on 2 queries:
1. `lint_levels_on(HirId) -> FxHashMap<LintId, LevelAndSource>` which accesses the attributes at the given `HirId` and processes them into lint levels. The `TyCtxt` is responsible for probing the HIR tree to find the user-visible level.
2. `lint_expectations(())` which lists all the `#[expect]` attributes in the crate.
This PR also introduces the ability to reconstruct a `HirId` from a `DepNode` by encoding the local part of the `DefPathHash` and the `ItemLocalId` in the two `u64` of the fingerprint. This allows for the dep-graph to directly recompute `lint_levels_on` directly, without having to force the calling query.
Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot
make `mk_attr_id` part of `ParseSess`
Updates #48685
The current `mk_attr_id` uses the `AtomicU32` type, which is not very efficient and adds a lot of lock contention in a parallel environment.
This PR refers to the task list in #48685, uses `mk_attr_id` as a method of the `AttrIdGenerator` struct, and adds a new field `attr_id_generator` to `ParseSess`.
`AttrIdGenerator` uses the `WorkerLocal`, which has two advantages: 1. `Cell` is more efficient than `AtomicU32`, and does not increase any lock contention. 2. We put the index of the work thread in the first few bits of the generated `AttrId`, so that the `AttrId` generated in different threads can be easily guaranteed to be unique.
Auto merge of #101212 - eholk:dyn-star, r=compiler-errors
Initial implementation of dyn*
This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things:
* Introduce `dyn_star` feature flag
* Adds parsing for `dyn* Trait` types
* Defines `dyn* Trait` as a sized type
* Adds support for explicit casts, like `42usize as dyn* Debug`
* Including const evaluation of such casts
* Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope
* Adds codegen for method calls, at least for methods that take `&self`
Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits.
Joint work with `@nikomatsakis` and `@compiler-errors.`
Michael Howell [Wed, 14 Sep 2022 16:45:05 +0000 (09:45 -0700)]
rustdoc: clean up CSS `#titles` using flexbox
This commit allows it to stop manually specifying pixel heights for the tabs
on search result pages. There's less messing with manual breakpoints and
less complex CSS selectors.
Auto merge of #101805 - Dylan-DPC:rollup-mpdlbin, r=Dylan-DPC
Rollup of 6 pull requests
Successful merges:
- #101433 (Emit a note that static bounds from HRTBs are a bug)
- #101684 (smol grammar changes to README.md)
- #101769 (rustdoc: remove redundant CSS `.out-of-band > span.since { position }`)
- #101772 (Also replace the placeholder for the stable_features lint)
- #101773 (rustdoc: remove outdated CSS `.content table` etc)
- #101779 (Update test output for drop tracking)
Rollup merge of #101779 - eholk:drop-tracking-test-output, r=jyn514
Update test output for drop tracking
#97334 has a lot of updates to test outputs that makes the PR larger than it needs to be. This PR pulls those changes out so we can keep the other one as simple as possible.
The `.content table` / `.content td` / `.content tr` family of selectors date back to 4fd061c426902b0904c65e64a3780b21f9ab3afb, when module indexes and other parts of rustdoc used `<table>` tags for layout and content presentation. The `.content td h1, .content td h2` has only been changed since then to tweak the font size in dd5ff428edbc7cd4fa600b81f27bbec28589704f.
It may also have affected a few other tables over the last decade, but they've been gradually replaced with grid layouts and flexbox to make layouts that work better on narrow viewports. For example, 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9.
These rules have no affect on the appearance of docblock tables
---------------------------------------------------------------
.content table {
border-spacing: 0 5px;
}
According to MDN, [border-spacing] only has an effect when `border-collapse` is `separate`. However, `border-collapse: collapse` is set globally for all tables, so this rule does nothing.
Tables with paragraphs in them are impossible without dropping down to raw HTML. Also, the rustdoc stylesheet sets paragraphs to have no top margin anyway, so this rule is a no-op.
Tables with headers in them are impossible without dropping down to raw HTML. This is considered unlikely, especially since it looks weird right now (`.docblock h2` has an underline that is redundant with the table cell's own border).
.content tr:first-child td { border-top: 0; }
This has no effect because of border collapsing.
This rule is removed, because tables look fine without it
---------------------------------------------------------
.content td:first-child { padding-right: 20px; }
By removing this rule, the first cell in each row has the same padding as all other cells in the row.
This rule is kept, and converted to directly target `.docblock`
---------------------------------------------------------------
.content td { vertical-align: top; }
Removing this rule would cause it to be aligned to the middle instead.
Rollup merge of #101769 - notriddle:notriddle/out-of-band-span-since, r=GuillaumeGomez
rustdoc: remove redundant CSS `.out-of-band > span.since { position }`
At the time this CSS was added, it was just `span.since`, because the version info could be rendered in two different ways:
1. `<div class='since'>` was used for associated items like methods. It was absolutely positioned, and the selector in rustdoc.css that targetted it was just `.since`.
2. `<span class='since'>` was introduced in a5a2f2b951ea982a666eaf52b1874d8f1b17290b for page-global version info, so that it could be laid out alongside the `[-]`/`[+]` button. This CSS rule was added to override the absolute position introduced in (1).
The selector was changed in 8fc6e420d16dc882f2047e6ec1b981cac5ef0d14 so that everything could use a `<span>` tag, but the dichotomy of the absolutely-positioned version info for associated items and the static positioned item version info remained.
The absolutely positioned `.since` was changed to one nested below a `<div class="rightside">` container in 5de1391b88007a1d4f7b1517657a86aae352af1e, so the version information is now always statically-positioned, and, as described in the commit message, "their DOM representation is consistent."
Auto merge of #99443 - jam1garner:mips-virt-feature, r=nagisa
Add support for MIPS VZ ISA extension
[Link to relevant LLVM line where virt extension is specified](https://github.com/llvm/llvm-project/blob/83fab8cee9d6b9fa911195c20325b4512a7a22ef/llvm/lib/Target/Mips/Mips.td#L172-L173)
This has been tested on mips-unknown-linux-musl with a target-cpu that is >= MIPS32 5 and `target-features=+virt`. The example was checked in a disassembler to ensure the correct assembly sequence was being generated using the virtualization instructions.
Needed additional work:
* MIPS is missing from [the Rust reference CPU feature lists](https://doc.rust-lang.org/reference/attributes/codegen.html#available-features)
Example docs for later:
```md
#### `mips` or `mips64`
This platform requires that `#[target_feature]` is only applied to [`unsafe`
functions][unsafe function]. This target's feature support is currently unstable
and must be enabled by `#![feature(mips_target_feature)]` ([Issue #44839])
If the above is good I can also submit a PR for that if there's interest in documenting it while it's still unstable. Otherwise that can be dropped, I just wrote it before realizing it was possibly not a good idea.
Auto merge of #101307 - jyn514:simplify-storage, r=cjgillot
Simplify caching and storage for queries
I highly recommend reviewing commit-by-commit; each individual commit is quite small but it can be hard to see looking at the overall diff that the behavior is the same. Each commit depends on the previous.
Auto merge of #101776 - weihanglo:update-cargo, r=ehuss
Update cargo
10 commits in 646e9a0b9ea8354cc409d05f10e8dc752c5de78e..082503982ea0fb7a8fd72210427d43a2e2128a63 2022-09-02 14:29:28 +0000 to 2022-09-13 17:49:38 +0000
- Take priority into account within the pending queue (rust-lang/cargo#11032)
- fix(add): Clarify which version the features are added for (rust-lang/cargo#11075)
- doc: clarify config-relative paths for `--config <path>` (rust-lang/cargo#11079)
- Do not add home bin path to PATH if it's already there (rust-lang/cargo#11023)
- Don't use `for` loop on an `Option` (rust-lang/cargo#11081)
- Remove dead code (rust-lang/cargo#11080)
- Change progress indicator for sparse registries (rust-lang/cargo#11068)
- chore(ci): Ensure intradoc links are valid (rust-lang/cargo#11055)
- Cache index files based on contents hash (rust-lang/cargo#11044)
- fix: specifies the max length for crate name (rust-lang/cargo#11051)
Rollup merge of #101770 - aDotInTheVoid:rdj-index-clone, r=GuillaumeGomez
Rustdoc-Json: Don't loose subitems of foreign traits.
Previously, we'd clone the index, and extend it with foreign traits. But when doing this, traits would render their subitems without them going into the index being used in the output leading to dangling ID's.
Rollup merge of #101266 - LuisCardosoOliveira:translation-rustcsession-pt3, r=davidtwco
translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final
# Description
This is the final part of the rustc_session https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883.
Please only review this [commit](https://github.com/rust-lang/rust/pull/101266/commits/a54534703774bfb9fc344f61d511760a7c43fe94). The other ones are from the PR https://github.com/rust-lang/rust/pull/101041# that is not yet merged.
Weihang Lo [Tue, 13 Sep 2022 20:20:13 +0000 (21:20 +0100)]
Update cargo
10 commits in 646e9a0b9ea8354cc409d05f10e8dc752c5de78e..082503982ea0fb7a8fd72210427d43a2e2128a63
2022-09-02 14:29:28 +0000 to 2022-09-13 17:49:38 +0000
- Take priority into account within the pending queue (rust-lang/cargo#11032)
- fix(add): Clarify which version the features are added for (rust-lang/cargo#11075)
- doc: clarify config-relative paths for `--config <path>` (rust-lang/cargo#11079)
- Do not add home bin path to PATH if it's already there (rust-lang/cargo#11023)
- Don't use `for` loop on an `Option` (rust-lang/cargo#11081)
- Remove dead code (rust-lang/cargo#11080)
- Change progress indicator for sparse registries (rust-lang/cargo#11068)
- chore(ci): Ensure intradoc links are valid (rust-lang/cargo#11055)
- Cache index files based on contents hash (rust-lang/cargo#11044)
- fix: specifies the max length for crate name (rust-lang/cargo#11051)
Michael Howell [Tue, 13 Sep 2022 19:25:32 +0000 (12:25 -0700)]
rustdoc: remove outdated CSS `.content table` etc
The `.content table` / `.content td` / `.content tr` family of selectors date
back to 4fd061c426902b0904c65e64a3780b21f9ab3afb, when module indexes and
other parts of rustdoc used `<table>` tags for layout and content
presentation. The `.content td h1, .content td h2` has only been changed
since then to tweak the font size in dd5ff428edbc7cd4fa600b81f27bbec28589704f.
It may also have affected a few other tables over the last decade, but
they've been gradually replaced with grid layouts and flexbox to make layouts
that work better on narrow viewports. For example, 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9.
These rules have no affect on the appearance of docblock tables
===============================================================
.content table {
border-spacing: 0 5px;
}
According to MDN, [border-spacing] only has an effect when `border-collapse`
is `separate`. However, `border-collapse: collapse` is set globally for all
tables, so this rule does nothing.
Tables with paragraphs in them are impossible without dropping down to raw
HTML. Also, the rustdoc stylesheet sets paragraphs to have no top margin
anyway, so this rule is a no-op.
Tables with headers in them are impossible without dropping down to raw HTML.
This is considered unlikely, especially since it looks weird right now
(`.docblock h2` has an underline that is redundant with the table cell's own
border).
.content tr:first-child td { border-top: 0; }
This has no effect because of border collapsing.
This rule is removed, because tables look fine without it
=========================================================
.content td:first-child { padding-right: 20px; }
By removing this rule, the first cell in each row has the same padding as all
other cells in the row.
This rule is kept, and converted to directly target `.docblock`
===============================================================
.content td { vertical-align: top; }
Removing this rule would cause it to be aligned to the middle instead.
Michael Howell [Tue, 13 Sep 2022 17:23:22 +0000 (10:23 -0700)]
rustdoc: remove redundant CSS `.out-of-band > span.since { position }`
At the time this CSS was added, it was just `span.since`, because the
version info could be rendered in two different ways:
1. `<div class='since'>` was used for associated items like methods. It
was absolutely positioned, and the selector in rustdoc.css that
targetted it was just `.since`.
2. `<span class='since'>` was introduced in a5a2f2b951ea982a666eaf52b1874d8f1b17290b for page-global version info,
so that it could be laid out alongside the `[-]`/`[+]` button. This CSS
rule was added to override the absolute position introduced in (1).
The selector was changed in 8fc6e420d16dc882f2047e6ec1b981cac5ef0d14 so
that everything could use a `<span>` tag, but the dichotomy of the
absolutely-positioned version info for associated items and the static
positioned item version info remained.
The absolutely positioned `.since` was changed to one nested below a
`<div class="rightside">` container in 5de1391b88007a1d4f7b1517657a86aae352af1e, so the version information is now
always statically-positioned, and, as described in the commit message,
"their DOM representation is consistent."
Auto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obk
Make `compare_predicate_entailment` no longer a query
Make `compare_predicate_entailment` so it's no longer a query (again), and splits out the new logic (that equates the return types to infer RPITITs) into its own query. This means that this new query (now called `collect_trait_impl_trait_tys`) is no longer executed for non-RPITIT cases.
This should improve perf (https://github.com/rust-lang/rust/pull/101224#issuecomment-1241682203), though in practice we see that these some crates remain from the primary regressions list on the original report... They are all <= 0.43% regression and seemingly only on the incr-full scenario for all of them.
I am at a loss for what might be causing this regression other than what I fixed here, since we don't introduce much new non-RPITIT logic except for some `def_kind` query calls in some places, for example, like projection. Maybe that's it?
----
Originally this PR was opened to test enabling `cache_on_disk` (62164aaaa11) but that didn't turn out to be very useful (https://github.com/rust-lang/rust/pull/101615#issuecomment-1242403205), so that led me to just split the query (and rename the PR).
Auto merge of #101757 - Dylan-DPC:rollup-wkt6oe9, r=Dylan-DPC
Rollup of 5 pull requests
Successful merges:
- #101602 (Streamline `AttrAnnotatedTokenStream`)
- #101690 (Avoid `Iterator::last`)
- #101700 (A `SubstitutionPart` is not considered a deletion if it replaces nothing with nothing)
- #101745 (Fix typo in concat_bytes documentation)
- #101748 (rustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle`)
Rollup merge of #101690 - kadiwa4:avoid_iterator_last, r=oli-obk
Avoid `Iterator::last`
Adapters like `Filter` and `Map` use the default implementation of `Iterator::last` which is not short-circuiting (and so does `core::str::Split`). The predicate function will be run for every single item of the underlying iterator. I hope that removing those calls to `last` results in slight performance improvements.