Rollup of 6 pull requests#153919
Conversation
- On `const` and `static` point at the type (like we do for let bindings) - On fn calls, point at const parameter in fn definition - On type, point at const parameter in type definition - On array type lengths, explain that array length is always `usize` - On enum variant discriminant, mention `repr`
…ers unless going through the type parameter
```
error[E0308]: mismatched types
--> $DIR/struct-type-parameter-with-default.rs:5:12
|
LL | struct Foo<T = String> {
| ---------- expected this type parameter
LL | x: T = String::new(),
| ^^^^^^^^^^^^^ expected type parameter `T`, found `String`
|
= note: expected type parameter `T`
found struct `String`
= note: the type of default fields referencing type parameters can't be assumed inside the struct defining them
```
``` error[E0382]: use of moved value: `foo` --> $DIR/as-ref-2.rs:10:14 | LL | let foo = Some(Struct); | --- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait LL | let _x: Option<Struct> = foo.map(|s| bar(&s)); | ---------------- `foo` moved due to this method call LL | let _y = foo; | ^^^ value used here after move | note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo` --> $SRC_DIR/core/src/option.rs:LL:COL help: consider calling `.as_ref()` to borrow the value's contents | LL | let _x: Option<Struct> = foo.as_ref().map(|s| bar(&s)); | +++++++++ help: consider calling `.as_mut()` to mutably borrow the value's contents | LL | let _x: Option<Struct> = foo.as_mut().map(|s| bar(&s)); | +++++++++ ```
Unlike `macro_rules!`, macros-2.0 macros have sensible item-like namespacing and visibility by default, which avoids the need for `#[macro_export]` and makes it easier to import the macro. The tradeoff is having to use `#[rustc_macro_transparency = "semiopaque"]` to still get macro-rules hygiene, because macros-2.0 hygiene is too strict here.
The function `check_let_chain` was removed previously, but it was still referenced in a comment in `check_match.rs`. This commit cleans it up.
…match, r=Kivooeo docs: remove stale reference to `check_let_chain` This PR removes a stale reference to `check_let_chain` in the documentation of `compiler/rustc_mir_build/src/thir/pattern/check_match.rs`, as the function was previously removed in rust-lang#146832.
Provide more context on type errors in const context - On `const` and `static` point at the type (like we do for let bindings) - On fn calls, point at const parameter in fn definition - On type, point at const parameter in type definition - On array type lengths, explain that array length is always `usize` - On enum variant discriminant, mention `repr` - On default field value using type parameter, provide more context (Fix rust-lang#147748)
…Titor Turn label into structured suggestion for `.as_ref()` and `.as_mut()` ``` error[E0382]: use of moved value: `foo` --> $DIR/as-ref-2.rs:10:14 | LL | let foo = Some(Struct); | --- move occurs because `foo` has type `Option<Struct>`, which does not implement the `Copy` trait LL | let _x: Option<Struct> = foo.map(|s| bar(&s)); | ---------------- `foo` moved due to this method call LL | let _y = foo; | ^^^ value used here after move | note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo` --> $SRC_DIR/core/src/option.rs:LL:COL help: consider calling `.as_ref()` to borrow the value's contents | LL | let _x: Option<Struct> = foo.as_ref().map(|s| bar(&s)); | +++++++++ help: consider calling `.as_mut()` to mutably borrow the value's contents | LL | let _x: Option<Struct> = foo.as_mut().map(|s| bar(&s)); | +++++++++ ```
Use less `#[macro_use]` in the query system Macro-rules namespacing and import/export is a bit of a nightmare in general. We can tame it a bit by avoiding `#[macro_use]` as much as possible, and instead putting a `pub(crate) use` after the macro-rules declaration to make the macro importable as a normal item. I've split this PR into two commits. The first one should hopefully be uncontroversial, while the second commit takes the extra step of declaring `rustc_with_all_queries!` as a macros-2.0 macro, which gives much nicer import/export behaviour, at the expense of having to specify `#[rustc_macro_transparency = "semiopaque"]` to still have access to macro-rules hygiene, because the default macros-2.0 hygiene is too strict here. There should be no change to compiler behaviour. --- I stumbled into this while investigating some other changes, such as re-exporting `rustc_middle::query::QueryVTable` or moving the big callback macro out of `rustc_middle::query::plumbing`. I think it makes sense to make this change first, to make other module-juggling tasks easier. r? nnethercote (or compiler)
… r=Kivooeo add test for param-env shadowing Subtle somewhat desirable effect of where-bounds shadowing impls
…bby789 compiletest: show rustdoc logs when `--no-capture` This should make rustdoc debug log output actually visible in `./x test tests/rustdoc-json/ --no-capture` invocations. Reported in [#t-infra/bootstrap > Help with &rust-lang#96;./x test --no-capture&rust-lang#96; to get logs.](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Help.20with.20.60.2E.2Fx.20test.20--no-capture.60.20to.20get.20logs.2E/with/579547276). ### Example <details> <summary>Output</summary> ```bash $ RUSTDOC_LOG=rustdoc::formats::cache=trace ./x test ./tests/rustdoc-json/span.rs --force-rerun --no-capture [...] running 1 tests status: exit status: 0 command: cd "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/span" && env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustdoc" "-L" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/span/auxiliary" "-o" "/home/joe/repos/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/span" "--deny" "warnings" "/home/joe/repos/rust/tests/rustdoc-json/span.rs" "-A" "internal_features" "--output-format" "json" "-Zunstable-options" stdout: none --- stderr ------------------------------- 2:rustc DEBUG rustdoc::formats::cache cx.cache.crate_version=None 2:rustc DEBUG rustdoc::formats::cache folding mod (stripped: false) "Some("span")", id DefId(DefId(0:0 ~ span[c5a1])) 2:rustc DEBUG rustdoc::formats::cache folding mod (stripped: false) "Some("bar")", id DefId(DefId(0:3 ~ span[c5a1]::bar)) ------------------------------------------ . test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 177 filtered out; finished in 345.34ms Build completed successfully in 0:00:02 ``` </details>
|
@bors r+ rollup=never p=5 |
This comment has been minimized.
This comment has been minimized.
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 f125037 (parent) -> d27207d (this PR) Test differencesShow 188 test diffsStage 1
Stage 2
Additionally, 182 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard d27207d3d64a1399f90344d6ef3c5743204b3fd3 --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 (d27207d): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary -1.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 479.863s -> 481.726s (0.39%) |
Successful merges:
check_let_chain#153870 (docs: remove stale reference tocheck_let_chain).as_ref()and.as_mut()#153887 (Turn label into structured suggestion for.as_ref()and.as_mut())#[macro_use]in the query system #153897 (Use less#[macro_use]in the query system)--no-capture#153917 (compiletest: show rustdoc logs when--no-capture)r? @ghost
Create a similar rollup