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 7 pull requests #125744

Merged
merged 24 commits into from
May 30, 2024
Merged

Rollup of 7 pull requests #125744

merged 24 commits into from
May 30, 2024

Conversation

fmease
Copy link
Member

@fmease fmease commented May 29, 2024

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

nnethercote and others added 24 commits May 29, 2024 16:24
By default, `x fmt` formats/checks modified files. But it also lets you
choose one or more paths instead.

This adds significant complexity to `x fmt`. Explicit paths are
specified via `WalkBuilder::add` rather than `OverrideBuilder::add`. The
`ignore` library is not simple, and predicting the interactions between
the two mechanisms is difficult.

Here's a particularly interesting case.
- You can request a path P that is excluded by the `ignore` list in the
  `rustfmt.toml`. E.g. `x fmt tests/ui/` or `x fmt tests/ui/bitwise.rs`.
- `x fmt` will add P to the walker (via `WalkBuilder::add`), traverse it
  (paying no attention to the `ignore` list from the `rustfmt.toml`
  file, due to the different mechanism), and call `rustfmt` on every
  `.rs` file within it.
- `rustfmt` will do nothing to those `.rs` files, because it *also*
  reads `rustfmt.toml` and sees that they match the `ignore` list!

It took me *ages* to debug and understand this behaviour. Not good!

`x fmt` even lets you name a path below the current directory. This was
intended to let you do things like `x fmt std` that mirror things like
`x test std`. This works by looking for `std` and finding `library/std`,
and then formatting that. Unfortuantely, this motivating case now gives
an error. When support was added in rust-lang#107944, `library/std` was the only
directory named `std`. Since then, `tests/ui/std` was added, and so `x
fmt std` now gives an error.

In general, explicit paths don't seem particularly useful. The only two
cases `x fmt` really needs are:
- format/check the files I have modified (99% of uses)
- format/check all files

(While respecting the `ignore` list in `rustfmt.toml`, of course.)

So this commit moves to that model. `x fmt` will now give an error if
given an explicit path. `x fmt` now also supports a `--all` option. (And
running with `GITHUB_ACTIONS=true` also causes everything to be
formatted/checked, as before.) Much simpler!
- Precede them all with `fmt` so it's clear where they are coming from.
- Use `error:` and `warning:` when appropriate.
- Print warnings to stderr instead of stdout
Currently, `x fmt` can print two lists of files.
- The untracked files that are skipped. Always done if within a git
  repo.
- The modified files that are formatted.

But if you run with `--all` (or with `GITHUB_ACTIONS=true`) it doesn't
print anything about which files are formatted.

This commit increases consistency.
- The formatted/checked files are now always printed. And it makes it clear why
  a file was formatted, e.g. with "modified".
- It uses the same code for both untracked files and formatted/checked
  files. This means that now if there are a lot of untracked files just
  the number will be printed, which is like the old behaviour for
  modified files.

Example output:
```
fmt: skipped 31 untracked files
fmt: formatted modified file compiler/rustc_mir_transform/src/instsimplify.rs
fmt: formatted modified file compiler/rustc_mir_transform/src/validate.rs
fmt: formatted modified file library/core/src/ptr/metadata.rs
fmt: formatted modified file src/bootstrap/src/core/build_steps/format.rs
```
or (with `--all`):
```
fmt: checked 3148 files
```
It's a weird name, the `fmt_` prefix seems unnecessary.
- Avoid calling `try_wait` followed immediately by `wait`.
- Make the match exhaustive.
- Improve the comment.
…lint, r=jieyouxu

Migrate `run-make/const-prop-lint` to `rmake.rs`

Part of rust-lang#121876.

r? ``@jieyouxu``
…ouxu

Rewrite `fpic`, `simple-dylib` and `issue-37893` `run-make` tests in `rmake.rs` or ui test 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).
…GuillaumeGomez

Streamline `x fmt` and improve its output

- Removes the ability to pass paths to `x fmt`, because it's complicated and not useful, and adds `--all`.
- Improves `x fmt` output.
- Improves `x fmt`'s internal code.

r? ``@GuillaumeGomez``
…=WaffleLapkin

[ACP 362] genericize `ptr::from_raw_parts`

This implements rust-lang/libs-team#362

As such, it can partially undo rust-lang#124795 , letting `slice_from_raw_parts` just call `from_raw_parts` again without re-introducing the unnecessary cast to MIR.

By doing this it also removes a spurious cast from `str::from_raw_parts`.  And I think it does a good job of showing the value of the ACP, since the only thing that needed new turbofishing because of this is inside `ptr::null(_mut)`, but only because `ptr::without_provenance(_mut)` doesn't support pointers to extern types, which it absolutely could (without even changing the implementation).
…ate-data-smoke, r=jieyouxu

Migrate `run-make/crate-data-smoke` to `rmake.rs`

Part of rust-lang#121876.

r? ``@jieyouxu``
…m, r=fmease

Add lang items for `AsyncFn*`, `Future`, `AsyncFnKindHelper`'s associated types

Adds lang items for `AsyncFnOnce::Output`, `AsyncFnOnce::CallOnceFuture`, `AsyncFnMut::CallRefFuture`, and uses them in the new solver. I'm mostly interested in doing this to help accelerate uplifting the new trait solver into a separate crate.

The old solver is kind of spaghetti, so I haven't moved that to use these lang items (i.e. it still uses `item_name`-based comparisons).

update: Also adds lang items for `Future::Output` and `AsyncFnKindHelper::Upvars`.

cc ``@lcnr``
ast: Revert a breaking attribute visiting order change

Fixes rust-lang#124535
Fixes rust-lang#125201
@rustbot rustbot added 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) labels May 29, 2024
@rustbot rustbot added the rollup A PR which is a rollup label May 29, 2024
@fmease
Copy link
Member Author

fmease commented May 29, 2024

@bors r+ rollup=never p=7

@bors
Copy link
Contributor

bors commented May 29, 2024

📌 Commit fdfffc0 has been approved by fmease

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

bors commented May 30, 2024

⌛ Testing commit fdfffc0 with merge caa187f...

@bors
Copy link
Contributor

bors commented May 30, 2024

☀️ Test successful - checks-actions
Approved by: fmease
Pushing caa187f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 30, 2024
@bors bors merged commit caa187f into rust-lang:master May 30, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 30, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#125653 Migrate run-make/const-prop-lint to rmake.rs faff11f3b535f7fa51039f327bcbc19ebea9b94b (link)
#125662 Rewrite fpic, simple-dylib and issue-37893 run-make ce19d18edaa242eb9d6758e9cf1749536037ad5f (link)
#125699 Streamline x fmt and improve its output c6b1ef33fe1b30860aaae0ceba8a640f1e0f2247 (link)
#125701 [ACP 362] genericize ptr::from_raw_parts 1dbd972692d07a3f6613a1fd74507a6b78057e4e (link)
#125723 Migrate run-make/crate-data-smoke to rmake.rs 1c8f516f87479b3c78c417f31e75813b60c3b6ba (link)
#125733 Add lang items for AsyncFn*, Future, `AsyncFnKindHelper… 29f7cce31a2328d0dca2b4c05b942916a40fd5a4 (link)
#125734 ast: Revert a breaking attribute visiting order change b347e52c11f839973a924608667cacf042b68a0f (link)

previous master: 23ea77b8ed

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

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary 1.1%, 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)
2.2% [1.3%, 3.3%] 5
Regressions ❌
(secondary)
2.7% [2.1%, 3.3%] 2
Improvements ✅
(primary)
-4.5% [-4.5%, -4.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.1% [-4.5%, 3.3%] 6

Cycles

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

Binary size

Results (primary 0.1%, secondary 0.1%)

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

Bootstrap: 669.162s -> 667.284s (-0.28%)
Artifact size: 318.80 MiB -> 318.83 MiB (0.01%)

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. 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.

10 participants