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.
r? `@Manishearth`
Add test for #101743
The issue was closes as we stopped rendering `const`s like this, but if we move back to doing that, make sure we don't accidently generate tags
rustdoc: remove no-op rule `a { background: transparent }`
The background is transparent by default.
It was added in 5a01dbe67b to work around a bug in the JavaScript syntax highlighting engine that rustdoc used at the time.
Tidy will not check coding style in bootstrap/target
`bootstrap/target` may contains the files generated by `rust-analysis`, which we won't want to be checked.
Adding ignore-fuchsia arg to non-applicable compiler ui tests
Adding `ignore-fuchsia` flag to tests involving `std::process::Command` calls, and `execve` calls
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.
Closes https://github.com/rust-lang/rust/issues/95094.
Supersedes https://github.com/rust-lang/rust/pull/99634.
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.
cc `@cjgillot`
The background is transparent by default.
It was added in 5a01dbe67b to work around a bug
in the JavaScript syntax highlighting engine that rustdoc used at the time.
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.`
r? `@bjorn3`
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.
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.
r? `@jyn514`
rustdoc: remove outdated CSS `.content table` etc
# Screenshot before
![image](https://user-images.githubusercontent.com/1593513/189992665-238aab28-d224-4466-901c-6e35e79182fb.png)
# Screenshot after
![image](https://user-images.githubusercontent.com/1593513/189992762-35c8efe4-e980-40bd-b72c-3ae4cfd6f830.png)
# Description
The `.content table` / `.content td` / `.content tr` family of selectors date back to 4fd061c426, 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 dd5ff428ed.
4fd061c426/src/rustdoc_ng/html/static/main.css (L155-L162)
This CSS would have affected:
* search result tables, which were removed in b615c0c854
* module item tables, which were removed in 6020c79dde
* docblock tables from markdown, which still exist
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, 34bd2b845b.
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.
[border-spacing]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing
.content td p:first-child { margin-top: 0; }
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.
.content td h1, .content td h2 { margin-left: 0; font-size: 1.125rem; }
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.
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`.
a5a2f2b951/src/librustdoc/html/static/rustdoc.css (L522-L529)
2. `<span class='since'>` was introduced in a5a2f2b951 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).
a5a2f2b951/src/librustdoc/html/static/rustdoc.css (L637-L641)
The selector was changed in 8fc6e420d1 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 5de1391b88, so the version information is now always statically-positioned, and, as described in the commit message, "their DOM representation is consistent."
Emit a note that static bounds from HRTBs are a bug
This note isn't perfect, but opening this to either 1) land as is or 2) get some feedback on how to improve it
Let r? `@compiler-errors` and cc. `@nikomatsakis`
Add support for MIPS VZ ISA extension
[Link to relevant LLVM line where virt extension is specified](83fab8cee9/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])
[Issue #44839]: https://github.com/rust-lang/rust/issues/44839
Further documentation on these features can be found in the [MIPS Instruction Set
Reference Manual], or elsewhere on [mips.com].
[MIPS Instruction Set Reference Manual]: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-6.06.pdf
[developer.arm.com]: https://www.mips.com/products/architectures/ase/
Feature | Implicitly Enables | Description
---------------|--------------------|-------------------
`fp64` | | 64-bit Floating Point
`msa` | | "MIPS SIMD Architecture"
`virt` | | Virtualization instructions (VZ ASE)
```
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.
Relevant to #44839
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.
r? `@cjgillot`