Rollup of 3 pull requests#156576
Conversation
This adds a hand-written debug format for `TypeTest`s that at least was helpful for me when debugging. It formats an type test using the Unicode turnstile symbol (for "computes") to illustrate that the test encodes a typing rule that, if it holds, produces a conclusion.
It is misnamed, given that it has three fields: `level`, `lint_id`, and `src`. (Presumably the `lint_id` was added later.) This commit renames it as `LevelSpec`. (I also considered `LevelInfo` but that's very generic. `Spec` has pre-existing uses in `LintLevelsProvider::current_specs` and `LintSet::specs` and `ShallowLintLevelMap::specs`.) Related things renamed as well: - `level` -> `level_spec` (where appropriate) - `lint_levels` -> `lint_level_specs` - `get_lint_level` -> `get_lint_level_spec` - `level_and_source` -> `level_spec` - `CodegenLintLevels` -> `CodegenLintLevelSpecs` - `raw_lint_id_level` -> `raw_lint_level_spec` - `lint_level_at_node` -> `lint_level_spec_at_node` - `reveal_actual_level` -> `reveal_actual_level_spec` - `probe_for_lint_level` -> `probe_for_lint_level_spec` This clears up a lot of `Level` vs. `LevelSpec` ambiguity. E.g. no more `level.level` expressions.
The name is misleading because the field contains a `Level` *and* an `Option<LintExpectationId>`. This commit renames it `level_plus` which better communicates that it's more than just a level.
These methods return `Option<(Self, Option<LintExpectationId>)>`. But all the call sites except one don't look at the `Option<LintExpectationId>`. This commit simplifies these methods to not return the `Option<LintExpectationId>`. This means they no longer need to be passed a closure to compute an `AttrId` (which is usually discarded anyway). The commit also renames `from_attr` as `from_opt_symbol`, because it takes an `Option<Symbol>`, not an `Attribute`. These changes simplify all the call sites that don't need the `Option<LintExpectationId>`, and also the one call site that does (in `LintLevelsBuilder::add`): that call site no longer needs to do an awkward destructuring, and can instead build the appropriate `LintExpectationId` directly.
`LevelSpec` has two related fields, `level` and `lint_id`. This commit makes the fields private (and introduces getters) to ensure they are set together using only valid combinations. The commit also introduces `is_allow` and `is_expect` methods because those are useful.
…eGomez feat(rustdoc): stabilize `--emit` flag ### [---> FCP <---](rust-lang#146220 (comment)) ## Stabilization Report: `rustdoc --emit` **Feature:** `rustdoc --emit` **Tracking issue:** rust-lang#83784 **Stabilization PR:** rust-lang#146220 ### What we are stabilizing This stabilizes the `rustdoc --emit` flag, which controls what types of output rustdoc produces. The flag accepts a comma-separated list of the following emit types: - `html-static-files` --- Shared static files with content-hashed filenames for safe caching. - `html-non-static-files` --- Per-crate documentation files with deterministic filenames. - `dep-info[=<path>]` --- A Makefile-compatible `.d` file listing all source files loaded during documentation generation. Same as rustc's dep-info files. When `--emit` is not specified, the default behavior is `--emit=html-static-files,html-non-static-files` (i.e., full HTML documentation output, no dep-info). ### What we are not stabilizing * Interaction between other unstable options, such as `-Zrustdoc-mergeable-info` and `--output-format=doctest` * Available options and the default options when `--emit` not specified. * Extension of per-type emit paths for options currently missing that. ### Motivation #### Cargo The primary consumer is Cargo, which needs `--emit=dep-info=<path>` to precisely track the input dependencies of a rustdoc invocation (see the [`-Zrustdoc-depinfo`] unstable Cargo feature). Without dep-info, Cargo cannot detect changes to files pulled in via `#[path = "..."]` or similar mechanisms and leads to stale documentation in incremental builds. Cargo also uses the selective emission mechanism (`html-static-files` / `html-non-static-files`) when the unstable [`-Zrustdoc-mergeable-info`] feature is active. It skips writing shared static files and search index during per-crate doc generation and defer them to a final merge phase. Under stable usage, Cargo passes all three emit types together. #### docs.rs docs.rs is the other major consumer. It uses selective emission to avoid redundantly copying toolchain-wide static files for every crate, which has historically been a source of breakage. See the tracking rust-lang#83784 and the about page for more <https://docs.rs/about/download>. ### Tests - `tests/run-make/emit-shared-files` --- Verifies selective emission of static vs non-static files. - `tests/run-make/rustdoc-dep-info` --- Verifies dep-info generation, including explicit path and `--out-dir` interaction. - `tests/run-make/rustdoc-scrape-examples-dep-info` --- Verifies dep-info works with scrape-examples. - `tests/run-make/rustdoc-default-output/` --- Verifies `--help` output shows `[html-static-files,html-non-static-files,dep-info]` [`-Zrustdoc-depinfo`]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#rustdoc-depinfo [`-Zrustdoc-mergeable-info`]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#rustdoc-mergeable-info
…esleywiser
Hand-written Debug implementation for `TypeTest`
This adds a hand-written debug format for `TypeTest`s that at least was helpful for me when debugging because I always struggle to remember which component is which. It formats a type test using the Unicode turnstile symbol (for "computes") to illustrate that the test encodes a typing rule that, if it holds, produces a conclusion.
The format is: `TypeTest from {originating span} {bound} ⊢ T: 'lower_bound`, where `T` is the generic type being tested and `lower_bound` is the lower bound. Bounds are formatted as you would expect, but where the region for `'lower_bound` is included in the outlives constraints for context. I resisted the urge to turn `ALL [A, ..., Z]` into `[A ∧ ... ∧ Z]` etc.
## What it looks like
Here's an example of a simple type test from the test suite that says that some type `I/#0` will be lower-bounded (outlive) `?4` iff `'?1: '?4`:
Before:
```
$ RUSTC_LOG="rustc_borrowck::region_infer=debug" rustc +stage1 tests/ui/associated-types/associated-types-eq-3.rs
...
DEBUG rustc_borrowck::region_infer type tests: [
TypeTest {
generic_kind: I/#0,
lower_bound: '?4,
span: tests/ui/associated-types/associated-types-eq-3.rs:21:18: 21:25 (#0),
verify_bound: OutlivedBy(
'?1,
),
},
TypeTest {
generic_kind: I/#0,
lower_bound: '?4,
span: tests/ui/associated-types/associated-types-eq-3.rs:21:18: 21:25 (#0),
verify_bound: OutlivedBy(
'?1,
),
},
]
...
```
After:
```
$ RUSTC_LOG="rustc_borrowck::region_infer=debug" rustc +stage1 tests/ui/associated-types/associated-types-eq-3.rs
...
DEBUG rustc_borrowck::region_infer type tests: [
TypeTest from tests/ui/associated-types/associated-types-eq-3.rs:21:18: 21:25 (#0)['?1: '?4] ⊢ I/#0: '?4,
TypeTest from tests/ui/associated-types/associated-types-eq-3.rs:21:18: 21:25 (#0)['?1: '?4] ⊢ I/#0: '?4,
]
...
```
…Gomez Lint level cleanups Some naming improvements, some type safety improvements, and some simplifications. Details in individual commits. r? @GuillaumeGomez
|
@bors r+ rollup=never p=3 |
This comment has been minimized.
This comment has been minimized.
|
📌 Perf builds for each rolled up PR:
previous master: 480d8520df In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 480d852 (parent) -> 7c3c88f (this PR) Test differencesShow 130 test diffs130 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 7c3c88f42ad444f4688b865591d84660be4ece2f --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (7c3c88f): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 3.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 510.687s -> 510.787s (0.02%) |
Successful merges:
--emitflag #146220 (feat(rustdoc): stabilize--emitflag)TypeTest#153785 (Hand-written Debug implementation forTypeTest)r? @ghost
Create a similar rollup