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 8 pull requests #132343

Closed
wants to merge 26 commits into from

Conversation

workingjubilee
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

nnethercote and others added 26 commits October 28, 2024 14:12
By using `token_descr`, as is done for many other errors, we can get
slightly better descriptions in error messages, e.g.
"macro expansion ignores token `let` and any following" becomes
"macro expansion ignores keyword `let` and any tokens following".

This will be more important once invisible delimiters start being
mentioned in error messages -- without this commit, that leads to error
messages such as "error at ``" because invisible delimiters are
pretty printed as an empty string.
Much like the previous commit.

I think the removal of "the token" in each message is fine here. There
are many more error messages that mention tokens without saying "the
token" than those that do say it.
Chaofan and Kai will be passing over maintainership for the target over to David Tenty and Chris Cambly.
The initial naming of "Abi" was an awful mistake, conveying wrong ideas
about how psABIs worked and even more about what the enum meant.
It was only meant to represent the way the value would be described to
a codegen backend as it was lowered to that intermediate representation.
It was never meant to mean anything about the actual psABI handling!
The conflation is because LLVM typically will associate a certain form
with a certain ABI, but even that does not hold when the special cases
that actually exist arise, plus the IR annotations that modify the ABI.

Reframe `rustc_abi::Abi` as the `BackendRepr` of the type, and rename
`BackendRepr::Aggregate` as `BackendRepr::Memory`. Unfortunately, due to
the persistent misunderstandings, this too is now incorrect:
- Scattered ABI-relevant code is entangled with BackendRepr
- We do not always pre-compute a correct BackendRepr that reflects how
  we "actually" want this value to be handled, so we leave the backend
  interface to also inject various special-cases here
- In some cases `BackendRepr::Memory` is a "real" aggregate, but in
  others it is in fact using memory, and in some cases it is a scalar!

Our rustc-to-backend lowering code handles this sort of thing right now.
That will eventually be addressed by lifting duplicated lowering code
to either rustc_codegen_ssa or rustc_target as appropriate.
This is a standard pattern:
```
MyAnalysis.into_engine(tcx, body).iterate_to_fixpoint()
```
`into_engine` and `iterate_to_fixpoint` are always called in pairs, but
sometimes with a builder-style `pass_name` call between them. But a
builder-style interface is overkill here. This has been bugging me a for
a while.

This commit:
- Merges `Engine::new` and `Engine::iterate_to_fixpoint`. This removes
  the need for `Engine` to have fields, leaving it as a trivial type
  that the next commit will remove.
- Renames `Analysis::into_engine` as `Analysis::iterate_to_fixpoint`,
  gives it an extra argument for the optional pass name, and makes it
  call `Engine::iterate_to_fixpoint` instead of `Engine::new`.

This turns the pattern from above into this:
```
MyAnalysis.iterate_to_fixpoint(tcx, body, None)
```
which is shorter at every call site, and there's less plumbing required
to support it.
It's no longer needed. `Engine::iterate_to_fixpoint` can be inlined into
`Analysis::iterate_to_fixpoint` and removed. The commit also renames
`engine.rs` as `results.rs`.
…=Nadrieril

Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains

fixes rust-lang#128661

Is there any preference where the test goes? There looks to be several places it could fit.
TypingMode: merge intercrate, reveal, and defining_opaque_types

This adds `TypingMode` and uses it in most places. We do not yet remove `Reveal` from `param_env`s. This and other future work as tracked in rust-lang#132279 and via `FIXME`s.

Fetching the `TypingMode` of the `InferCtxt` asserts that the `TypingMode` agrees with `ParamEnv::reveal` to make sure we don't introduce any subtle bugs here. This will be unnecessary once `ParamEnv::reveal` no longer exists.

As the `TypingMode` is now a part of the query input, I've merged the coherence and non-coherence caches for the new solver. I've also enabled the local `infcx` cache during coherence by clearing the cache when forking it with a different `TypingMode`.

#### `TypingMode::from_param_env`

I am using this even in cases where I know that the `param_env` will always be `Reveal::UserFacing`. This is to make it easier to correctly refactor this code in the future, any time we use `Reveal::UserFacing` in a body while not defining its opaque types is incorrect and should use a `TypingMode` which only reveals opaques defined by that body instead, cc rust-lang#124598

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

Rename `rustc_abi::Abi` to `BackendRepr`

Remove the confabulation of `rustc_abi::Abi` with what "ABI" actually means by renaming it to `BackendRepr`, and rename `Abi::Aggregate` to `BackendRepr::Memory`. The type never actually represented how things are passed, as that has to have `PassMode` considered, at minimum, but rather it just is how we represented some things to the backend. This conflation arose because LLVM, the primary backend at the time, would lower certain IR forms using certain ABIs. Even that only somewhat was true, as it broke down when one ventured significantly afield of what is described by the System V AMD64 ABI either by using different architectures, ABI-modifying IR annotations, the same architecture **with different ISA extensions enabled**, or other... unexpected delights.

Unfortunately both names are still somewhat of a misnomer right now, as people have written code for years based on this misunderstanding. Still, their original names are even moreso, and for better or worse, this backend code hasn't received as much maintenance as the rest of the compiler, lately. Actually arriving at a correct end-state will simply require us to disentangle a lot of code in order to fix, much of it pointlessly repeated in several places. Thus this is not an "actual fix", just a way to deflect further misunderstandings.
…ainters, r=workingjubilee

powerpc64-ibm-aix: update maintainters

Chaofan (``@ecnelises)`` and Kai (``@bzEq)`` will be passing over maintainership for the target over to David Tenty (``@daltenty)`` and Chris Cambly (``@gilamn5tr)``
…ners, r=compiler-errors

Point to Fuchsia team in platform support docs

This consolidates our docs into a single source of truth for the current Fuchsia maintainers.

r? ``@tmandry``
…r=estebank

Use `token_descr` more in error messages

This is the first two commits from rust-lang#124141, put into their own PR to get things rolling. Commit messages have the details.

r? `@estebank`
cc `@petrochenkov`
Remove `Engine`

It's just unnecessary plumbing. Removing it results in less code, and simpler code.

r? `@cjgillot`
…rrors

cg_llvm: Consistently use safe wrapper function `set_section`

Follow-up to rust-lang#131962 and rust-lang#132260 (comment).

To avoid too much scope creep, I've deliberately kept the changes to `LLVMRustGetSliceFromObjectDataByName` as minimal as possible.
@rustbot rustbot added 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Oct 30, 2024
@rustbot rustbot added the rollup A PR which is a rollup label Oct 30, 2024
@workingjubilee
Copy link
Member Author

@bors r+ rollup=never p=8

@bors
Copy link
Contributor

bors commented Oct 30, 2024

📌 Commit f44726a 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 Oct 30, 2024
@bors
Copy link
Contributor

bors commented Oct 30, 2024

⌛ Testing commit f44726a with merge 16840e9...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 30, 2024
…kingjubilee

Rollup of 8 pull requests

Successful merges:

 - rust-lang#129394 (Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains)
 - rust-lang#131856 (TypingMode: merge intercrate, reveal, and defining_opaque_types)
 - rust-lang#132246 (Rename `rustc_abi::Abi` to `BackendRepr`)
 - rust-lang#132322 (powerpc64-ibm-aix: update maintainters)
 - rust-lang#132327 (Point to Fuchsia team in platform support docs)
 - rust-lang#132332 (Use `token_descr` more in error messages)
 - rust-lang#132338 (Remove `Engine`)
 - rust-lang#132340 (cg_llvm: Consistently use safe wrapper function `set_section`)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-apple failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

failures:

---- [ui] tests/ui/abi/c-zst.rs#other stdout ----
Saved the actual stderr to "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/ui/abi/c-zst.other/c-zst.other.stderr"


9                                abi: $SOME_ALIGN,
10                                pref: $SOME_ALIGN,
-                            abi: Aggregate {
+                            abi: Memory {
13                                sized: true,
14                            },
14                            },
15                            fields: Arbitrary {

36                            abi: $SOME_ALIGN,
37                            pref: $SOME_ALIGN,
-                        abi: Aggregate {
+                        abi: Memory {
40                            sized: true,
41                        },
41                        },
42                        fields: Arbitrary {


The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args abi/c-zst.rs`

error in revision `other`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage2/bin/rustc" "/Users/runner/work/rust/rust/tests/ui/abi/c-zst.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/Users/runner/.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/Users/runner/work/rust/rust/vendor" "--sysroot" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage2" "--target=aarch64-apple-darwin" "--cfg" "other" "--check-cfg" "cfg(FALSE,other,other_linux,x86_64_pc_windows_gnu,s390x_linux,sparc64_linux,powerpc_linux)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/ui/abi/c-zst.other" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/native/rust-test-helpers"
--- stderr -------------------------------
--- stderr -------------------------------
error: fn_abi_of(pass_zst) = FnAbi {
               ArgAbi {
                   layout: TyAndLayout {
                       ty: (),
                       layout: Layout {
                       layout: Layout {
                           size: Size(0 bytes),
                           align: AbiAndPrefAlign {
                               abi: Align(1 bytes),
                               pref: Align(8 bytes),
                           abi: Memory {
                               sized: true,
                           },
                           fields: Arbitrary {
---
                   },
                   mode: Ignore,
               },
           ],
           ret: ArgAbi {
               layout: TyAndLayout {
                   ty: (),
                   layout: Layout {
                       size: Size(0 bytes),
                       align: AbiAndPrefAlign {
                           abi: Align(1 bytes),
                           pref: Align(8 bytes),
                       abi: Memory {
                           sized: true,
                       },
                       fields: Arbitrary {
---
                   },
               },
               mode: Ignore,
           },
           c_variadic: false,
           fixed_count: 1,
           conv: C,
           can_unwind: false,
  --> /Users/runner/work/rust/rust/tests/ui/abi/c-zst.rs:27:1
   |
   |
LL | extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi

error: aborting due to 1 previous error
------------------------------------------

@bors
Copy link
Contributor

bors commented Oct 30, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 30, 2024
@workingjubilee workingjubilee deleted the rollup-wmows2a branch October 30, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup 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. 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.

10 participants