Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #129202

Merged
merged 12 commits into from
Aug 17, 2024
Merged

Rollup of 6 pull requests #129202

merged 12 commits into from
Aug 17, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

cuviper and others added 12 commits August 16, 2024 12:42
`Either` is wasteful for a one-or-none iterator, especially since `Once`
is already an `option::IntoIter` internally. We don't really need any of
the iterator mechanisms in this case, just a single conditional insert.
This re-lookup of `&hir::Pat` by its ID appears to be an artifact of earlier
complexity that has since been removed from the compiler.
… r=petrochenkov

Emit an error for invalid use of the linkage attribute

fixes rust-lang#128486

Currently, the use of the linkage attribute for Mod, Impl,... is incorrectly permitted. This PR will correct this issue by generating errors, and I've also added some UI test cases for it.

Related: rust-lang#128552.
…eril

mir/pretty: use `Option` instead of `Either<Once, Empty>`

`Either` is wasteful for a one-or-none iterator, especially since `Once`
is already an `option::IntoIter` internally. We don't really need any of
the iterator mechanisms in this case, just a single conditional insert.
…r=compiler-errors

Return correct HirId when finding body owner in diagnostics

Fixes rust-lang#129145
Fixes rust-lang#128810

r? ```@compiler-errors```

```rust
fn generic<const N: u32>() {}

trait Collate<const A: u32> {
    type Pass;
    fn collate(self) -> Self::Pass;
}

impl<const B: u32> Collate<B> for i32 {
    type Pass = ();
    fn collate(self) -> Self::Pass {
        generic::<{ true }>()
        //~^ ERROR: mismatched types
    }
}
```

When type checking the `{ true }` anon const we would error with a type mismatch. This then results in diagnostics code attempting to check whether its due to a type mismatch with the return type. That logic was implemented by walking up the hir until we reached the body owner, except instead of using the `enclosing_body_owner` function it special cased various hir nodes incorrectly resulting in us walking out of the anon const and stopping at `fn collate` instead.

This then resulted in diagnostics logic inside of the anon consts `ParamEnv` attempting to do trait solving involving the `<i32 as Collate<B>>::Pass` type which ICEs because it is in the wrong environment.

I have rewritten this function to just walk up until it hits the `enclosing_body_owner` and made some other changes since I found this pretty hard to read/understand. Hopefully it's easier to understand now, it also makes it more obvious that this is not implemented in a very principled way and is definitely missing cases :)
…r=GuillaumeGomez

rustdoc-json: Clean up serialization and printing.

Somewhat a followup to rust-lang#128963, but makes sense regardless.

- Renames `out_path` to `out_dir` because it's not the path to the JSON, but the directory
  - Also adds a comment explaining `None`
- Renames `write` to `serialize_and_write` because it does both.
  - Also renames the self-profile activity name to be clear this measures both IO cost and serialization CPU cost
  - Expands the timer to cover flushing
- Renames `output` to `output_crate`, to emphasize it's the contents, not the `--output` flag.

r? `@GuillaumeGomez`
…octest-attrs, r=notriddle

Remove useless attributes in merged doctest generated code

I took another look at the generated code for merged doctests and it seems like those attributes are only useful when running `rustc --test`, which isn't the case for merged doctests. Less code generated. \o/

r? `@notriddle`
…rors

Remove a useless ref/id/ref round-trip from `pattern_from_hir`

This re-lookup of `&hir::Pat` by its ID appears to be an artifact of earlier complexity that has since been removed from the compiler.

Merely deleting the let/match results in borrow errors, but sprinkling `'tcx` in the signature allows it to work again, so I suspect that this code's current function is simply to compensate for overly loose lifetimes in the signature. Perhaps it made more sense at a time when HIR lifetimes were not tied to `'tcx`.

I spotted this while working on some more experimental changes, which is why I've extracted it into its own PR.
@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 17, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=6

@bors
Copy link
Contributor

bors commented Aug 17, 2024

📌 Commit 4e6147d has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 17, 2024
@bors
Copy link
Contributor

bors commented Aug 17, 2024

⌛ Testing commit 4e6147d with merge 0f26ee4...

@bors
Copy link
Contributor

bors commented Aug 17, 2024

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 0f26ee4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 17, 2024
@bors bors merged commit 0f26ee4 into rust-lang:master Aug 17, 2024
7 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 17, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#128989 Emit an error for invalid use of the linkage attribute 34a07129511ad5daccacbc3c531ae9de006a1fc5 (link)
#129167 mir/pretty: use Option instead of Either<Once, Empty> ffa3429e3e992255f95a774900ef198bff7c4e0c (link)
#129168 Return correct HirId when finding body owner in diagnostics adbe39da23d44060d00ba63b60fbf8fe85951eaa (link)
#129191 rustdoc-json: Clean up serialization and printing. 2346e6af5fa5d22dcffc64ad59241684749c8dd8 (link)
#129192 Remove useless attributes in merged doctest generated code f6045c91d7339cdb9bfc01d0c11236535214a9fb (link)
#129196 Remove a useless ref/id/ref round-trip from `pattern_from_h… b7feb2d044a7bc2d1da31c1b15e2c5aacb4968b4 (link)

previous master: 9b318d2e93

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0f26ee4): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.1%, 2.2%] 5
Improvements ✅
(primary)
-0.9% [-1.7%, -0.3%] 4
Improvements ✅
(secondary)
-1.4% [-2.2%, -0.6%] 2
All ❌✅ (primary) -0.9% [-1.7%, -0.3%] 4

Max RSS (memory usage)

Results (primary -4.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.3% [-6.9%, -2.1%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -4.3% [-6.9%, -2.1%] 3

Cycles

Results (primary -3.4%, secondary -2.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
-2.9% [-3.9%, -2.4%] 3
All ❌✅ (primary) -3.4% [-3.4%, -3.4%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 750.64s -> 750.326s (-0.04%)
Artifact size: 339.13 MiB -> 339.17 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Aug 17, 2024
@Kobzol
Copy link
Contributor

Kobzol commented Aug 17, 2024

The deep-vector regression looks like noise based on its history, and in the rest it's more improvements than regressions. I don't think that this requires a deeper investigation.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Aug 17, 2024
@matthiaskrgr matthiaskrgr deleted the rollup-wev7uur branch September 1, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.