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

Automated pull from upstream master #711

Merged
merged 82 commits into from
Jun 21, 2024

Conversation

github-actions[bot]
Copy link
Contributor

This PR pulls the following changes from the upstream repository:

linyihai and others added 30 commits June 5, 2024 19:22
Previously, `Tree::from_enum`'s implementation branched into three disjoint
cases:

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

This branching (incorrectly) did not differentiate between variantful and
variantless uninhabited enums. In both cases, we assumed (and asserted) that
uninhabited enums are zero-sized types. This assumption is false for enums like:

    enum Uninhabited { A(!, u128) }

...which, currently, has the same size as `u128`. This faulty assumption
manifested as the ICE reported in #126460.

In this PR, we revise the first case of `Tree::from_enum` to consider only the
narrow category of "enums that are uninhabited ZSTs". These enums, whose layouts
are described with `Variants::Single { index }`, are special in their layouts
otherwise resemble the `!` type and cannot be descended into like typical enums.
This first case captures uninhabited enums like:

    enum Uninhabited { A(!, !), B(!) }

The second case is revised to consider the broader category of "enums that defer
their layout to one of their variants"; i.e., enums whose layouts are described
with `Variants::Single { index }` and that do have a variant at `index`. This
second case captures uninhabited enums that are not ZSTs, like:

    enum Uninhabited { A(!, u128) }

...which represent their variants with `Variants::Single`.

Finally, the third case is revised to cover the broader category of "enums with
multiple variants", which captures uninhabited, non-ZST enums like:

    enum Uninhabited { A(u8, !), B(!, u32) }

...which represent their variants with `Variants::Multiple`.

This PR also adds a comment requested by RalfJung in his review of #126358 to
`compiler/rustc_const_eval/src/interpret/discriminant.rs`.

Fixes #126460
When set, this flag skips the code that normally extracts coverage spans from
MIR statements and terminators. That sometimes makes it easier to debug branch
coverage and MC/DC coverage, because the coverage output is less noisy.

For internal debugging only. If other code changes would make it hard to keep
supporting this flag, remove it.
This synchronizes the fuchsia test running code with the clang test
runner. This brings with it:

* Improved logging
* Uses the fuchsia image from the SDK version
* Caches the product bundle across test runs
* Strips the binaries to reduce the data sent to the emulator
jieyouxu and others added 12 commits June 19, 2024 01:51
…=estebank,davidtwco

Place tail expression behind terminating scope

This PR implements #123739 so that we can do further experiments in nightly.

A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following.
```rust
match into_async_iter($iter_expr) {
  ref mut iter => match unsafe { Pin::unchecked_new(iter) } {
    ...
  }
}
```
Suggest using a standalone doctest for non-local impl defs

This PR tweaks the lint output of the `non_local_definitions` lint to suggest using a standalone doctest instead of a moving the `impl` def to an impossible place as was already done with `macro_rules!` case in rust-lang/rust#124568.

Fixes #126339
r? ```@fmease```
safe transmute: support non-ZST, variantful, uninhabited enums

Previously, `Tree::from_enum`'s implementation branched into three disjoint cases:

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

This branching (incorrectly) did not differentiate between variantful and variantless uninhabited enums. In both cases, we assumed (and asserted) that uninhabited enums are zero-sized types. This assumption is false for enums like:

    enum Uninhabited { A(!, u128) }

...which, currently, has the same size as `u128`. This faulty assumption manifested as the ICE reported in #126460.

In this PR, we revise the first case of `Tree::from_enum` to consider only the narrow category of "enums that are uninhabited ZSTs". These enums, whose layouts are described with `Variants::Single { index }`, are special in their layouts otherwise resemble the `!` type and cannot be descended into like typical enums. This first case captures uninhabited enums like:

    enum Uninhabited { A(!, !), B(!) }

The second case is revised to consider the broader category of "enums that defer their layout to one of their variants"; i.e., enums whose layouts are described with `Variants::Single { index }` and that do have a variant at `index`. This second case captures uninhabited enums that are not ZSTs, like:

    enum Uninhabited { A(!, u128) }

...which represent their variants with `Variants::Single`.

Finally, the third case is revised to cover the broader category of "enums with multiple variants", which captures uninhabited enums like:

    enum Uninhabited { A(u8, !), B(!, u32) }

...which represent their variants with `Variants::Multiple`.

This PR also adds a comment requested by ````@RalfJung```` in his review of #126358 to `compiler/rustc_const_eval/src/interpret/discriminant.rs`.

Fixes #126460

r? ````@compiler-errors````
Sync fuchsia test runner with clang test runner

This synchronizes the fuchsia test running code with the clang test runner. This brings with it:

* Improved logging
* Uses the fuchsia image from the SDK version
* Caches the product bundle across test runs
* Strips the binaries to reduce the data sent to the emulator

r? ``@tmandry``
hir_typeck: be more conservative in making "note caller chooses ty param" note

In rust-lang/rust#122195 I added a "caller chooses ty for type param" note for when the return expression type a.k.a. found type does not match the expected return type.

#126547 found that this note was confusing when the found return type *contains* the expected type, e.g.

```rs
fn f<T>(t: &T) -> T {
    t
}
```

because the found return type `&T` will *always* be different from the expected return type `T`, so the note was needlessly redundant and confusing.

This PR addresses that by not making the note if the found return type contains the expected return type.

r? ``@fmease`` (since you reviewed the original PR)

Fixes rust-lang/rust#126547
Add `rustc-ice*` to `.gitignore`

I am a bit surprised this wasn't already here but there doesn't seem to be any reason not to add it. This will be nice to cut down on `git {add, diff, etc}` noise when debugging crashes.
…lstrieb

Replace `move||` with `move ||`

Edit from #126631 to revert changes in `tests/ui`.

There are 18 instances of `move||` across 6 files in the repo:
- `compiler/rustc_hir_typeck/src/typeck_root_ctxt.rs`
- `library/core/src/sync/atomic.rs`
- `library/std/src/sync/condvar.rs`
- `library/std/src/sync/mpsc/mod.rs`
- `library/std/src/sync/barrier.rs`
- `library/std/src/thread/local.rs`

I have replaced all such instances with `move ||` instead as it better adheres to modern formatting standards.

Ideally, we would have this automated by rustfmt or some other tool, but I do not have the time to implement such a feature or tool.
Nonetheless, I would encourage any effort invested into such a tool or feature.
Rollup of 10 pull requests

Successful merges:

 - #124135 (delegation: Implement glob delegation)
 - #125078 (fix: break inside async closure has incorrect span for enclosing closure)
 - #125293 (Place tail expression behind terminating scope)
 - #126422 (Suggest using a standalone doctest for non-local impl defs)
 - #126493 (safe transmute: support non-ZST, variantful, uninhabited enums)
 - #126504 (Sync fuchsia test runner with clang test runner)
 - #126558 (hir_typeck: be more conservative in making "note caller chooses ty param" note)
 - #126586 (Add `@badboy` and `@BlackHoleFox` as Mac Catalyst maintainers)
 - #126615 (Add `rustc-ice*` to `.gitignore`)
 - #126632 (Replace `move||` with `move ||`)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is generated by `ferrocene/tools/pull-upstream/pull.sh`.
The list of excluded files is defined in `.gitattributes`.
@github-actions github-actions bot added automation Issue or PR created by an automation backport:never PR that should never be backported labels Jun 19, 2024
@japaric japaric self-assigned this Jun 19, 2024
both run-make tests have been ported to the new rmake framework

the test 'issue-64153' has been renamed and now has the more descriptive
name 'lto-avoid-object-duplication'
Copy link
Contributor

@Dajamante Dajamante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors merge

bors-ferrocene bot added a commit that referenced this pull request Jun 19, 2024
694: Adopt uv for venv purposes r=pietroalbini a=Hoverbear

Adopt `uv` and set up a `venv` so local users don't need to set up a python environment beyond `python`/`pip` (eg, no `boto`, no `pyyaml`, etc).

As a consequence, the way we build our docker images has changed, as they need to have access to `requirements.txt`.

This PR, surprisingly, needs no documentation updates, as it does not impact and customer facing procedures yet.

711: Automated pull from upstream `master` r=Dajamante a=github-actions[bot]


This PR pulls the following changes from the upstream repository:

* `126655`: [Rollup of 10 pull requests](https://www.github.com/rust-lang/rust/issues/126655)
  * `126632`: [Replace `move||` with `move ||`](https://www.github.com/rust-lang/rust/issues/126632)
  * `126615`: [Add `rustc-ice*` to `.gitignore`](https://www.github.com/rust-lang/rust/issues/126615)
  * `126586`: [Add `@badboy` and `@BlackHoleFox` as Mac Catalyst maintainers](https://www.github.com/rust-lang/rust/issues/126586)
  * `126558`: [hir_typeck: be more conservative in making "note caller chooses ty param" note](https://www.github.com/rust-lang/rust/issues/126558)
  * `126504`: [Sync fuchsia test runner with clang test runner](https://www.github.com/rust-lang/rust/issues/126504)
  * `126493`: [safe transmute: support non-ZST, variantful, uninhabited enums](https://www.github.com/rust-lang/rust/issues/126493)
  * `126422`: [Suggest using a standalone doctest for non-local impl defs](https://www.github.com/rust-lang/rust/issues/126422)
  * `125293`: [Place tail expression behind terminating scope](https://www.github.com/rust-lang/rust/issues/125293)
  * `125078`: [fix: break inside async closure has incorrect span for enclosing closure](https://www.github.com/rust-lang/rust/issues/125078)
  * `124135`: [delegation: Implement glob delegation](https://www.github.com/rust-lang/rust/issues/124135)
* `126607`: [Rewrite `separate-link`, `separate-link-fail` and `allocator-shim-circular-deps` `run-make` tests to `ui` or `rmake`](https://www.github.com/rust-lang/rust/issues/126607)
* `126614`: [Uplift next trait solver to `rustc_next_trait_solver`](https://www.github.com/rust-lang/rust/issues/126614)
* `126623`: [Replace all `&DiagCtxt` with a `DiagCtxtHandle<'_>` wrapper type](https://www.github.com/rust-lang/rust/issues/126623)
* `126630`: [Rollup of 5 pull requests](https://www.github.com/rust-lang/rust/issues/126630)
  * `126621`: [More thorough status-quo tests for `#[coverage(..)]`](https://www.github.com/rust-lang/rust/issues/126621)
  * `126587`: [coverage: Add debugging flag `-Zcoverage-options=no-mir-spans`](https://www.github.com/rust-lang/rust/issues/126587)
  * `126583`: [interpret: better error when we ran out of memory](https://www.github.com/rust-lang/rust/issues/126583)
  * `126500`: [Migrate `error-found-staticlib-instead-crate`, `output-filename-conflicts-with-directory`, `output-filename-overwrites-input`, `native-link-modifier-verbatim-rustc` and `native-link-verbatim-linker` `run-make` tests to `rmake.rs` format](https://www.github.com/rust-lang/rust/issues/126500)
  * `125988`: [Migrate `run-make/used` to `rmake.rs`](https://www.github.com/rust-lang/rust/issues/125988)
* `126437`: [Migrate `issue-64153`, `invalid-staticlib` and `no-builtins-lto` `run-make` tests to `rmake`](https://www.github.com/rust-lang/rust/issues/126437)
* `126049`: [Rework `feature(precise_capturing)` to represent `use<...>` as a syntactical bound](https://www.github.com/rust-lang/rust/issues/126049)
* `126330`: [Return opaque type from PanicInfo::message()](https://www.github.com/rust-lang/rust/issues/126330)
* `126591`: [[perf] More span update benchmarking](https://www.github.com/rust-lang/rust/issues/126591)
* `126490`: [Migrate `extern-flag-fun`, `incremental-debugger-visualiser` and `incremental-session-fail` `run-make` tests to `rmake.rs`](https://www.github.com/rust-lang/rust/issues/126490)



Co-authored-by: Ana Hobden <[email protected]>
Co-authored-by: Lin Yihai <[email protected]>
Co-authored-by: Oneirical <[email protected]>
Co-authored-by: Vadim Petrochenkov <[email protected]>
Co-authored-by: Jack Wrenn <[email protected]>
Co-authored-by: Urgau <[email protected]>
Co-authored-by: Guillaume Gomez <[email protected]>
Co-authored-by: Ralf Jung <[email protected]>
Co-authored-by: Mads Marquart <[email protected]>
Co-authored-by: Zalathar <[email protected]>
Co-authored-by: Erick Tryzelaar <[email protected]>
Co-authored-by: Mara Bos <[email protected]>
Co-authored-by: Ding Xiang Fei <[email protected]>
Co-authored-by: Michael Goulet <[email protected]>
@bors-ferrocene
Copy link
Contributor

Build failed (retrying...):

bors-ferrocene bot added a commit that referenced this pull request Jun 19, 2024
711: Automated pull from upstream `master` r=Dajamante a=github-actions[bot]


This PR pulls the following changes from the upstream repository:

* `126655`: [Rollup of 10 pull requests](https://www.github.com/rust-lang/rust/issues/126655)
  * `126632`: [Replace `move||` with `move ||`](https://www.github.com/rust-lang/rust/issues/126632)
  * `126615`: [Add `rustc-ice*` to `.gitignore`](https://www.github.com/rust-lang/rust/issues/126615)
  * `126586`: [Add `@badboy` and `@BlackHoleFox` as Mac Catalyst maintainers](https://www.github.com/rust-lang/rust/issues/126586)
  * `126558`: [hir_typeck: be more conservative in making "note caller chooses ty param" note](https://www.github.com/rust-lang/rust/issues/126558)
  * `126504`: [Sync fuchsia test runner with clang test runner](https://www.github.com/rust-lang/rust/issues/126504)
  * `126493`: [safe transmute: support non-ZST, variantful, uninhabited enums](https://www.github.com/rust-lang/rust/issues/126493)
  * `126422`: [Suggest using a standalone doctest for non-local impl defs](https://www.github.com/rust-lang/rust/issues/126422)
  * `125293`: [Place tail expression behind terminating scope](https://www.github.com/rust-lang/rust/issues/125293)
  * `125078`: [fix: break inside async closure has incorrect span for enclosing closure](https://www.github.com/rust-lang/rust/issues/125078)
  * `124135`: [delegation: Implement glob delegation](https://www.github.com/rust-lang/rust/issues/124135)
* `126607`: [Rewrite `separate-link`, `separate-link-fail` and `allocator-shim-circular-deps` `run-make` tests to `ui` or `rmake`](https://www.github.com/rust-lang/rust/issues/126607)
* `126614`: [Uplift next trait solver to `rustc_next_trait_solver`](https://www.github.com/rust-lang/rust/issues/126614)
* `126623`: [Replace all `&DiagCtxt` with a `DiagCtxtHandle<'_>` wrapper type](https://www.github.com/rust-lang/rust/issues/126623)
* `126630`: [Rollup of 5 pull requests](https://www.github.com/rust-lang/rust/issues/126630)
  * `126621`: [More thorough status-quo tests for `#[coverage(..)]`](https://www.github.com/rust-lang/rust/issues/126621)
  * `126587`: [coverage: Add debugging flag `-Zcoverage-options=no-mir-spans`](https://www.github.com/rust-lang/rust/issues/126587)
  * `126583`: [interpret: better error when we ran out of memory](https://www.github.com/rust-lang/rust/issues/126583)
  * `126500`: [Migrate `error-found-staticlib-instead-crate`, `output-filename-conflicts-with-directory`, `output-filename-overwrites-input`, `native-link-modifier-verbatim-rustc` and `native-link-verbatim-linker` `run-make` tests to `rmake.rs` format](https://www.github.com/rust-lang/rust/issues/126500)
  * `125988`: [Migrate `run-make/used` to `rmake.rs`](https://www.github.com/rust-lang/rust/issues/125988)
* `126437`: [Migrate `issue-64153`, `invalid-staticlib` and `no-builtins-lto` `run-make` tests to `rmake`](https://www.github.com/rust-lang/rust/issues/126437)
* `126049`: [Rework `feature(precise_capturing)` to represent `use<...>` as a syntactical bound](https://www.github.com/rust-lang/rust/issues/126049)
* `126330`: [Return opaque type from PanicInfo::message()](https://www.github.com/rust-lang/rust/issues/126330)
* `126591`: [[perf] More span update benchmarking](https://www.github.com/rust-lang/rust/issues/126591)
* `126490`: [Migrate `extern-flag-fun`, `incremental-debugger-visualiser` and `incremental-session-fail` `run-make` tests to `rmake.rs`](https://www.github.com/rust-lang/rust/issues/126490)



Co-authored-by: Lin Yihai <[email protected]>
Co-authored-by: Oneirical <[email protected]>
Co-authored-by: Vadim Petrochenkov <[email protected]>
Co-authored-by: Jack Wrenn <[email protected]>
Co-authored-by: Urgau <[email protected]>
Co-authored-by: Guillaume Gomez <[email protected]>
Co-authored-by: Ralf Jung <[email protected]>
Co-authored-by: Mads Marquart <[email protected]>
Co-authored-by: Zalathar <[email protected]>
Co-authored-by: Erick Tryzelaar <[email protected]>
Co-authored-by: Mara Bos <[email protected]>
Co-authored-by: Ding Xiang Fei <[email protected]>
Co-authored-by: Michael Goulet <[email protected]>
@bors-ferrocene
Copy link
Contributor

Build failed:

Comment on lines +1 to +5
//@ revisions: edition2021 edition2024
//@ ignore-wasm no panic or subprocess support
//@ [edition2024] compile-flags: -Zunstable-options
//@ [edition2024] edition: 2024
//@ run-pass
Copy link
Member

@Veykril Veykril Jun 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing as this test needs unwinding support and upstream forgot to add a //@ needs-unwind directive

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

submitted rust-lang/rust#126740 upstream

the `tail-expr-lock-poisoning` UI test uses the `panic::catch_unwind`
API so it relies on unwinding being implemented. this test ought not to
run on targets that do not support unwinding. add the `needs-unwind`
attribute to signal this
@Veykril
Copy link
Member

Veykril commented Jun 20, 2024

bors merge

@bors-ferrocene
Copy link
Contributor

🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@tshepang
Copy link
Member

bors retry

@bors-ferrocene
Copy link
Contributor

Build succeeded:

  • full

@bors-ferrocene bors-ferrocene bot merged commit 54f7cbf into main Jun 21, 2024
3 checks passed
@bors-ferrocene bors-ferrocene bot deleted the automation/pull-upstream/01iwitt9 branch June 21, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Issue or PR created by an automation backport:never PR that should never be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.