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 10 pull requests #126374

Merged
merged 31 commits into from
Jun 13, 2024
Merged

Rollup of 10 pull requests #126374

merged 31 commits into from
Jun 13, 2024

Conversation

workingjubilee
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Oneirical and others added 30 commits June 12, 2024 09:44
This is the first time we have a lint with configuration exposed in
`Cargo.toml`.
When this was done, interest was expressed in using this for other cases
in the future.
To this end, we need to make the documentation for the lint
configuration discoverable from the documentation for that lint.
There is now no way to create a TyConst from an integer, so I propose making this method public unless there was a reason for keeping it otherwise.
Previously, the implementation of `Tree::from_enum` incorrectly
treated enums with `Variants::Single` and `Variants::Multiple`
identically. This is incorrect for `Variants::Single` enums,
which delegate their layout to that of a variant with a particular
index (or no variant at all if the enum is empty).

This flaw manifested first as an ICE. `Tree::from_enum` attempted
to compute the tag of variants other than the one at
`Variants::Single`'s `index`, and fell afoul of a sanity-checking
assertion in `compiler/rustc_const_eval/src/interpret/discriminant.rs`.
This assertion is non-load-bearing, and can be removed; the routine
its in is well-behaved even without it.

With the assertion removed, the proximate issue becomes apparent:
calling `Tree::from_variant` on a variant that does not exist is
ill-defined. A sanity check the given variant has
`FieldShapes::Arbitrary` fails, and the analysis is (correctly)
aborted with `Err::NotYetSupported`.

This commit corrects this chain of failures by ensuring that
`Tree::from_variant` is not called on variants that are, as far as
layout is concerned, nonexistent. Specifically, the implementation
of `Tree::from_enum` is now partitioned into three cases:

  1. enums that are uninhabited
  2. enums for which all but one variant is uninhabited
  3. enums with multiple inhabited variants

`Tree::from_variant` is now only invoked in the third case. In the
first case, `Tree::uninhabited()` is produced. In the second case,
the layout is delegated to `Variants::Single`'s index.

Fixes rust-lang#125811
…, r=jieyouxu

Rewrite `symlinked-extern`, `symlinked-rlib` and `symlinked-libraries` `run-make` tests in `rmake.rs` format

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
…=lcnr

Walk into alias-eq nested goals even if normalization fails

Somewhat broken due to the fact that we don't handle aliases well, nor do we handle ambiguities well. Still want to put up this incremental piece, since it improves type errors for projections whose trait refs are not satisfied.

r? lcnr
…=jackh726

Harmonize using root or leaf obligation in trait error reporting

When rust-lang#121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation.

Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation.

This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓

r? ``@estebank``

Fixes rust-lang#126129
…rors

Urls to docs in rust_hir

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
Add test for walking order dependent opaque type behaviour

r? ```@lcnr```

adding the test for your comment here: https://github.com/rust-lang/rust/pull/122366/files#r1521124754
Move `MatchAgainstFreshVars` to old solver

Small change I noticed when trying to uplift the relations to the new trait solver.
docs(rustc): Improve discoverable of Cargo docs

In preparing Cargo's blog post for 1.80, I tried to find the documentation for the lint configuration and I couldn't.  The link is only visible from the lint itself, which isn't where I started, and the side bar, which was collapsed for me.

The first place I went was the docs for `unexpected_cfgs` because this is configuration for that lint.  If using lint configuration were a one off, I could see skipping it here.  However, when we discussed this with at least one T-compiler member, there was interest in using this for other lints in the future.  To that end, it seems like we should be exposing this with the lint itself.

The second place I checked was the `check-cfg` documentation.  This now has a call out for the sub-page.
safe transmute: support `Single` enums

Previously, the implementation of `Tree::from_enum` incorrectly treated enums with `Variants::Single` and `Variants::Multiple` identically. This is incorrect for `Variants::Single` enums, which delegate their layout to that of a variant with a particular index (or no variant at all if the enum is empty).

This flaw manifested first as an ICE. `Tree::from_enum` attempted to compute the tag of variants other than the one at `Variants::Single`'s `index`, and fell afoul of a sanity-checking assertion in `compiler/rustc_const_eval/src/interpret/discriminant.rs`. This assertion is non-load-bearing, and can be removed; the routine its in is well-behaved even without it.

With the assertion removed, the proximate issue becomes apparent: calling `Tree::from_variant` on a variant that does not exist is ill-defined. A sanity check the given variant has `FieldShapes::Arbitrary` fails, and the analysis is (correctly) aborted with `Err::NotYetSupported`.

This commit corrects this chain of failures by ensuring that `Tree::from_variant` is not called on variants that are, as far as layout is concerned, nonexistent. Specifically, the implementation of `Tree::from_enum` is now partitioned into three cases:

  1. enums that are uninhabited
  2. enums for which all but one variant is uninhabited
  3. enums with multiple inhabited variants

`Tree::from_variant` is now only invoked in the third case. In the first case, `Tree::uninhabited()` is produced. In the second case, the layout is delegated to `Variants::Single`'s index.

Fixes rust-lang#125811
Make `try_from_target_usize` method public

There is now no way to create a TyConst from an integer, so I propose making this method public unless there was a reason for keeping it otherwise.
@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler 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 (-Znext-solver) rollup A PR which is a rollup labels Jun 13, 2024
@workingjubilee
Copy link
Member Author

@bors r+ rollup=never p=10

@bors
Copy link
Contributor

bors commented Jun 13, 2024

📌 Commit 3b10998 has been approved by workingjubilee

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

bors commented Jun 13, 2024

⌛ Testing commit 3b10998 with merge 56e112a...

@bors
Copy link
Contributor

bors commented Jun 13, 2024

☀️ Test successful - checks-actions
Approved by: workingjubilee
Pushing 56e112a to master...

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

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#125674 Rewrite symlinked-extern, symlinked-rlib and `symlinked… 9cf759e5bf966f6a9ab10fc7045668d073d87421 (link)
#125688 Walk into alias-eq nested goals even if normalization fails 99e2d07ceeb4c4ab24f5c98179d393b29caaa776 (link)
#126142 Harmonize using root or leaf obligation in trait error repo… b39d04491cfd2c90f0369a977098868c6a417f40 (link)
#126303 Urls to docs in rust_hir 6ac068e330ed0aad6b7e2decf6e343e14196e58f (link)
#126328 Add Option::is_none_or b0c97dc45c648c49752dbd47a25a0a59e58f191e (link)
#126337 Add test for walking order dependent opaque type behaviour dae55bacd6ae155b45effb617b41d8e1d04cb440 (link)
#126353 Move MatchAgainstFreshVars to old solver c36c73bf550caf493501d171a82e12789c5e9826 (link)
#126356 docs(rustc): Improve discoverable of Cargo docs 775f315305f551ac1f339b34fef3fa002ca2f78c (link)
#126358 safe transmute: support Single enums 1681570217dc4652cc4b8549213dd33626a18c4f (link)
#126362 Make try_from_target_usize method public 8ee05180b4336cb8e4e54a1693d09ca3ccdcada4 (link)

previous master: f6b4b71ef1

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 (56e112a): comparison URL.

Overall result: ✅ improvements - 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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.2% [-1.2%, -1.2%] 1
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) -1.2% [-1.2%, -1.2%] 1

Max RSS (memory usage)

Results (secondary 2.7%)

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

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: 671.891s -> 668.917s (-0.44%)
Artifact size: 320.29 MiB -> 319.72 MiB (-0.18%)

@workingjubilee workingjubilee deleted the rollup-tz0utfr branch June 14, 2024 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler 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 (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.