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 9 pull requests #126332

Merged
merged 26 commits into from
Jun 12, 2024
Merged

Rollup of 9 pull requests #126332

merged 26 commits into from
Jun 12, 2024

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

dpaoliello and others added 26 commits June 5, 2024 11:37
We can check that the vtable is for the right trait very early, and then just pass the type around.
This test extracts a fragment of `issue-84561.rs` that has historically proven
troublesome when trying to modify how spans are extracted from MIR.
This is a modified copy of `tests/mir-opt/coverage/instrument_coverage.rs`.
As more and more of the span refiner's functionality has been pulled out into
separate early passes, it has finally reached the point where we can remove the
rest of the old `SpansRefiner` code, and replace it with a single
modestly-sized function.
Promote `arm64ec-pc-windows-msvc` to tier 2

MCP: <rust-lang/compiler-team#746>

* Update platform support docs
* Add `arm64ec-pc-windows-msvc` as a target to the existing AArch64 Windows build in CI.
* Fix docs build break.
* Add `arm64ec-pc-windows-msvc` to build manifest.

CI build (succeeded, but upload to S3 failed): <https://github.com/rust-lang/rust/actions/runs/9388227822/job/25853013083?pr=126039>
…fcx, r=lcnr

Remove `DebugWithInfcx` machinery

This PR removes `DebugWithInfcx` after having a lot of second thoughts about it due to recent type system uplifting work. We could add it back later if we want, but I don't think the amount of boilerplate in the complier and the existence of (kindof) hacks like `NoInfcx` currently justify the existence of `DebugWithInfcx`, especially since it's not even being used anywhere in the compiler currently.

The motivation for `DebugWithInfcx` is that we want to be able to print infcx-aware information, such as universe information[^1] (though if there are other usages that I'm overlooking, please let me know). I think there are probably more tailored solutions that can specifically be employed in places where this infcx-aware printing is necessary. For example, one way of achieving this is by implementing a custom `FmtPrinter` which overloads `ty_infer_name` (perhaps also extending it to have overrideable stubs for printing placeholders too) to print the `?u.i` name for an infer var. This will necessitate uplifting `Print` from `rustc_middle::ty::print`, but this seems a bit more extensible and reusable than `DebugWithInfcx`.

One of the problems w/ `DebugWithInfcx` is its opt-in-ness. Even if a compiler dev adds a new `debug!(ty)` in a context where there is an `infcx` we can access, they have to *opt-in* to using `DebugWithInfcx` with something like `debug!(infcx.with(ty))`. This feels to me like it risks a lot of boilerplate, and very easy to just forget adding it at all, especially in cases like `#[instrument]`.

A second problem is the `NoInfcx` type itself. It's necessary to have this dummy infcx implementation since we often want to print types outside of the scope of a valid `Infcx`. Right now, `NoInfcx` is only *partially* a valid implementation of `InferCtxtLike`, except for the methods that we specifically need for `DebugWithInfcx`. As I work on uplifting the trait solver, I actually want to add a lot more methods to `InferCtxtLike` and having to add `unreachable!("this should never be called")` stubs for uplifted methods like `next_ty_var` is quite annoying.

In reality, I actually only *really* care about the second problem -- we could, perhaps, instead just try to get rid of `NoInfcx` and just just duplicate `Debug` and `DebugWithInfcx` for most types. If we're okay with duplicating all these implementations (though most of them would just be trivial `#[derive(Debug, DebugWithInfcx)]`), I'd be okay with that too 🤔

r? `@BoxyUwU` `@lcnr` would like to know your thoughts -- happy to discuss this further, mainly trying to bring this problem up

[^1]: Which in my experience is only really necessary when we're debugging things like generalizer bugs.
…s, r=compiler-errors

Provide correct parent for nested anon const

Fixes rust-lang#126147

99% of this PR is just comments explaining what the issue is.

`tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering.

So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results.

Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now)

r? ````@compiler-errors````
…-obk

interpret: dyn trait metadata check: equate traits in a proper way

Hopefully fixes rust-lang/miri#3541... unfortunately we don't have a testcase.

The first commit is just a refactor without functional change.

r? `@oli-obk`
Simplify provider api to improve llvm ir

This PR seeks to resolve the last concern in rust-lang#99301 (comment)

We resolve the issue by moving the type_id to be stored in the `Request` itself rather than being accessed through the `Erased` trait, letting the compiler infer that the value of the type id will not change between lookups.

### LLVM Codegen

**Before**

```
; <provider_test::MyError as core::error::Error>::provide
; Function Attrs: nonlazybind uwtable
define void `@"_ZN61_$LT$provider_test..MyError$u20$as$u20$core..error..Error$GT$7provide17hd9c9de412063aa73E"(ptr` noalias nocapture noundef nonnull readonly align 1 %self, ptr noundef nonnull align 1 %request.0, ptr noalias nocapture noundef readonly align 8 dereferenceable(32) %request.1) unnamed_addr #0 personality ptr `@rust_eh_personality` {
start:
  %0 = getelementptr inbounds i8, ptr %request.1, i64 24
  %self.1.val.i = load ptr, ptr %0, align 8
  %1 = tail call { i64, i64 } %self.1.val.i(ptr noundef nonnull align 1 %request.0), !noalias !15
  %2 = extractvalue { i64, i64 } %1, 0
  %3 = extractvalue { i64, i64 } %1, 1
  %_18.i.i = icmp ne i64 %2, 1101338453689927725
  %_2.i.i = icmp ne i64 %3, 472224167662714873
  %or.cond.i.not.i = select i1 %_18.i.i, i1 true, i1 %_2.i.i
  br i1 %or.cond.i.not.i, label %_ZN4core5error7Request7provide17h8f8125d2543333e0E.exit, label %bb2.i
```

**After**

```
; <provider_test::MyError as provider_test::Error>::provide
; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(argmem: readwrite) uwtable
define void `@"_ZN63_$LT$provider_test..MyError$u20$as$u20$provider_test..Error$GT$7provide17h5bbf091795a6d359E"(ptr` noalias nocapture noundef nonnull readonly align 1 %self, ptr nocapture noundef nonnull align 8 %request.0, ptr noalias nocapture noundef readonly align 8 dereferenceable(24) %request.1) unnamed_addr #2 personality ptr `@rust_eh_personality` {
start:
  %_19.i = load i64, ptr %request.0, align 8, !noalias !3, !noundef !3
  switch i64 %_19.i, label %_ZN13provider_test7Request7provide17heb3ee140962e3b2fE.exit [
    i64 7665305208997882008, label %bb12.i
    i64 7050211241160863540, label %bb12.i3
    i64 9112786072622981063, label %bb12.i11
  ]
```
coverage: Replace the old span refiner with a single function

As more and more of the span refiner's functionality has been pulled out into separate early passes, it has finally reached the point where we can remove the rest of the old `SpansRefiner` code, and replace it with a single modestly-sized function.

~~There should be no change to the resulting coverage mappings, as demonstrated by the lack of changes to test output.~~

There is *almost* no change to the resulting coverage mappings. There are some minor changes to `loop` that on inspection appear to be neutral in terms of accuracy, with the old behaviour being a slightly-horrifying implementation detail of the old code, so I think they're acceptable.

Previous work in this direction includes:
- rust-lang#125921
- rust-lang#121019
- rust-lang#119208
…, r=pnkfelix

No uninitalized report in a pre-returned match arm

This is a attemp to address rust-lang#126133
…zkan

Update `rustc-perf` submodule

To integrate rust-lang/rustc-perf#1926, required for rust-lang#126306.

`@bors` rollup

r? `@onur-ozkan`
… r=RalfJung

Follow up to splitting core's PanicInfo and std's PanicInfo
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc O-linux Operating system: Linux 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. labels Jun 12, 2024
@rustbot rustbot added T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative rollup A PR which is a rollup labels Jun 12, 2024
@GuillaumeGomez
Copy link
Member Author

@bors r+ p=5 rollup=never

@bors
Copy link
Contributor

bors commented Jun 12, 2024

📌 Commit 5d22e7a has been approved by GuillaumeGomez

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 Jun 12, 2024
@bors
Copy link
Contributor

bors commented Jun 12, 2024

⌛ Testing commit 5d22e7a with merge 1d43fbb...

@bors
Copy link
Contributor

bors commented Jun 12, 2024

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 1d43fbb to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 12, 2024
@bors bors merged commit 1d43fbb into rust-lang:master Jun 12, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jun 12, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#126039 Promote arm64ec-pc-windows-msvc to tier 2 2e3ff3bb1fa3109dd7378d9f49d0b4301f07b611 (link)
#126075 Remove DebugWithInfcx machinery 0eb031e2b63b7cfd1148e4b32090b01ec37b0f26 (link)
#126228 Provide correct parent for nested anon const f7ef06b6b5154ab08a1ad18495c239e1f072767a (link)
#126232 interpret: dyn trait metadata check: equate traits in a pro… 6122d9ff41fd8cc9a628c0c53b9c3e9ae107b3b3 (link)
#126242 Simplify provider api to improve llvm ir 581696f734b9663883fdcac37eb8a40eaadfc991 (link)
#126294 coverage: Replace the old span refiner with a single functi… 9bd1c52ff22b86a0cf624efb366fcc03670f777a (link)
#126295 No uninitalized report in a pre-returned match arm b885fa3c5f905242f5bf09ae291795138857d4df (link)
#126312 Update rustc-perf submodule 5a50ec40f959b13e886396b81355a90f4cb74151 (link)
#126322 Follow up to splitting core's PanicInfo and std's PanicInfo 77a28e491d337912fd1c0e8a625e2f846768b290 (link)

previous master: 0285dab54f

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 (1d43fbb): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

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.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.3%, 0.3%] 1

Max RSS (memory usage)

Results (primary -2.4%)

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)
-2.4% [-2.4%, -2.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.4% [-2.4%, -2.4%] 1

Cycles

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

Binary size

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

Bootstrap: 675.959s -> 673.333s (-0.39%)
Artifact size: 320.08 MiB -> 319.77 MiB (-0.10%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. O-linux Operating system: Linux 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-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.