Commit Graph

65 Commits

Author SHA1 Message Date
Michael Goulet 1173204b36 Use style_edition over version 2024-09-22 19:11:28 -04:00
Guillaume Gomez ca52d30a75 Remove `src/gcc` from `rustfmt` checks 2024-09-06 16:01:46 +02:00
bors f8060d282d Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68
Bump bootstrap compiler to new beta

https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-07-30 17:49:08 +00:00
Nicholas Nethercote 118f9350c5 Update `use` declarations formatting options.
As decided in rust-lang/compiler-team#750.

Use declarations are currently wildly inconsistent because rustfmt is
quite unopinionated about how they should be formatted. The
`rustfmt.toml` additions makes rustfmt more opinionated, which avoids
the need for any decision when adding new use declarations to a file.

This commit only updates `rustfmt.toml` and
`compiler/rustc_codegen_cranelift/rustfmt.toml`. The next commit will do
the reformatting.
2024-07-29 08:26:08 +10:00
Mark Rousskov 5eca36d27a step cfg(bootstrap) 2024-07-28 14:46:29 -04:00
Guillaume Gomez 12bedc3e2b Ignore files in cg_gcc example folder 2024-07-17 20:21:52 +02:00
Guillaume Gomez e1852d0a3c Unignore cg_gcc fmt 2024-07-17 20:15:03 +02:00
Michael Goulet bd135e487f Add rustdoc-json support for use<> 2024-07-12 05:24:51 -04:00
Nicholas Nethercote d2ea692e2d Explain why `tests/ui-fulldeps/` is unformatted. 2024-06-04 14:15:45 +10:00
Nicholas Nethercote 758d49e5c8 Explain why `tests/ui/` is unformatted. 2024-06-04 14:15:45 +10:00
Nicholas Nethercote 1be65925d7 Explain why `tests/rustdoc-ui/` is unformatted. 2024-06-04 14:15:44 +10:00
Nicholas Nethercote 50185807d7 rustfmt `tests/rustdoc-js-std/`.
This is trivial, because the directory contains no `.rs` files.
2024-06-04 14:15:29 +10:00
Nicholas Nethercote 9f16362ab4 rustfmt `tests/rustdoc-json/`. 2024-06-04 14:15:19 +10:00
Nicholas Nethercote c6fb703c05 rustfmt `tests/rustdoc-js/`. 2024-06-04 14:15:06 +10:00
Nicholas Nethercote 98d65d62c5 Explain why `tests/rustdoc-gui/` is unformatted. 2024-06-04 14:14:35 +10:00
Nicholas Nethercote e372bf8e33 Explain why `tests/rustdoc/` is unformatted. 2024-06-04 09:53:02 +10:00
Nicholas Nethercote a78e1202dd rustfmt `tests/run-pass-valgrind/`. 2024-06-04 09:53:02 +10:00
Nicholas Nethercote d161d06241 rustfmt `tests/run-make-fulldeps/`.
Note: I inserted blank lines between the items in
`pretty-expanded/input.rs` because it looked better that way.
2024-06-04 09:53:02 +10:00
Nicholas Nethercote 5875f3fff3 Explain why `tests/pretty/` is unformatted. 2024-06-04 09:53:02 +10:00
Nicholas Nethercote c9c80d2c5f rustfmt `tests/mir-opt`.
The only non-obvious changes:
- `building/storage_live_dead_in_statics.rs` has a `#[rustfmt::skip]`
  attribute to avoid reformating a table of data.
- Two `.mir` files have slight changes involving line numbers.
- In `unusual_item_types.rs` an `EMIT_MIR` annotation is moved to
  outside a function, which is the usual spot, because `tidy` complains
  if such a comment is indented.

The commit also tweaks the comments in `rustfmt.toml`.
2024-06-03 14:17:16 +10:00
Nicholas Nethercote 0ea498aa9f Explain why we don't run rustfmt on `tests/incremental/`. 2024-05-31 21:30:22 +10:00
Nicholas Nethercote d71a015d01 Explain why we don't run rustfmt on `tests/debuginfo/`. 2024-05-31 21:30:22 +10:00
Nicholas Nethercote 3079bd96b9 Run rustfmt on `tests/run-make/`.
With the exception of `tests/run-make/translation/test.rs`, which has a
syntax error.

The expected output in `rustdoc-error-lines/rmake.rs`'s required slight
tweaking.

The two `reproducible-build.rs` files need `// ignore-tidy-linelength`
because rustfmt produces lines longer than 100 chars, which tidy doesn't
like, yuk.
2024-05-31 21:30:08 +10:00
Nicholas Nethercote 70bc0c5b20 Explain why we don't run rustfmt on `tests/crashes/`. 2024-05-31 15:56:45 +10:00
Nicholas Nethercote 4fd2003026 Run rustfmt on `tests/coverage-run-rustdoc/`.
There are only two tiny Rust files in this directory, and they are
already formatted correctly.
2024-05-31 15:56:45 +10:00
Nicholas Nethercote e86709c58a Run rustfmt on `tests/coverage/`.
There are no changes to `.rs` files because #125693 recently formatted
them all.
2024-05-31 15:56:45 +10:00
Nicholas Nethercote 780a91786e Run rustfmt on `tests/codegen-units/`. 2024-05-31 15:56:45 +10:00
Nicholas Nethercote 72800d3b89 Run rustfmt on `tests/codegen/`.
Except for `simd-intrinsic/`, which has a lot of files containing
multiple types like `u8x64` which really are better when hand-formatted.

There is a surprising amount of two-space indenting in this directory.

Non-trivial changes:
- `rustfmt::skip` needed in `debug-column.rs` to preserve meaning of the
  test.
- `rustfmt::skip` used in a few places where hand-formatting read more
  nicely: `enum/enum-match.rs`
- Line number adjustments needed for the expected output of
  `debug-column.rs` and `coroutine-debug.rs`.
2024-05-31 15:56:43 +10:00
Nicholas Nethercote b1b18e6031 Run rustfmt on `tests/auxiliary/`.
That directory doesn't contain any Rust files, so it's a trivial change.
2024-05-30 16:15:46 +10:00
Nicholas Nethercote d063c7b6c8 Run rustfmt on `tests/assembly/`. 2024-05-30 16:15:46 +10:00
Nicholas Nethercote 4af4ba2391 List all `tests/` subdirs explicitly in `rustfmt.toml`.
So we can gradually remove the ones where rustfmt can be used.
2024-05-30 16:15:46 +10:00
Nicholas Nethercote f1b0ca08a4 Don't format `tests/run-make/*/rmake.rs`.
It's reasonable to want to, but in the current implementation this
causes multiple problems.

- All the `rmake.rs` files are formatted every time even when they
  haven't changed. This is because they get whitelisted unconditionally
  in the `OverrideBuilder`, before the changed files get added.

- The way `OverrideBuilder` works, if any files gets whitelisted then no
  unmentioned files will get traversed. This is surprising, and means
  that the `rmake.rs` entries broke the use of explicit paths to `x
  fmt`, and also broke `GITHUB_ACTIONS=true git check --fmt`.

The commit removes the `rmake.rs` entries, fixes the formatting of a
couple of files that were misformatted (not previously caught due to the
`GITHUB_ACTIONS` breakage), and bans `!`-prefixed entries in
`rustfmt.toml` because they cause all these problems.
2024-05-28 19:28:46 +10:00
Nicholas Nethercote 4702a1c345 Fix comments.
Some are too long, some aren't complete sentences, some are complete
sentences but don't bother with an upper case letter at the start. All
annoying and hurt readability.
2024-05-28 19:28:21 +10:00
Nicholas Nethercote bcfa67d50d Remove out-of-date comment.
This comment -- "by default we ignore everything in the repository" --
was added in #65939 when rustfmt was first being introduced for this
repository and (briefly) every directory was ignored. Since then lots of
directories have opted in to formatting, so it is no longer true.
2024-05-28 11:05:37 +10:00
Bernardo Meurer Costa e287044149 refactor: add rustc-perf submodule to src/tools
Currently, it's very challenging to perform a sandboxed `opt-dist`
bootstrap because the tool requires `rustc-perf` to be present, but
there is no proper management/tracking of it. Instead, a specific commit
is hardcoded where it is needed, and a non-checksummed zip is fetched
ad-hoc. This happens in two places:

`src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile`:

```dockerfile
ENV PERF_COMMIT 4f313add609f43e928e98132358e8426ed3969ae
RUN curl -LS -o perf.zip https://ci-mirrors.rust-lang.org/rustc/rustc-perf-$PERF_COMMIT.zip && \
    unzip perf.zip && \
    mv rustc-perf-$PERF_COMMIT rustc-perf && \
    rm perf.zip
```

`src/tools/opt-dist/src/main.rs`

```rust
// FIXME: add some mechanism for synchronization of this commit SHA with
// Linux (which builds rustc-perf in a Dockerfile)
// rustc-perf version from 2023-10-22
const PERF_COMMIT: &str = "4f313add609f43e928e98132358e8426ed3969ae";

let url = format!("https://ci-mirrors.rust-lang.org/rustc/rustc-perf-{PERF_COMMIT}.zip");
let client = reqwest::blocking::Client::builder()
    .timeout(Duration::from_secs(60 * 2))
    .connect_timeout(Duration::from_secs(60 * 2))
    .build()?;
let response = retry_action(
    || Ok(client.get(&url).send()?.error_for_status()?.bytes()?.to_vec()),
    "Download rustc-perf archive",
    5,
)?;
```

This causes a few issues:

1. Maintainers need to be careful to bump PERF_COMMIT in both places
   every time
2. In order to run `opt-dist` in a sandbox, you need to provide your own
   `rustc-perf` (https://github.com/rust-lang/rust/pull/125125), but to
   figure out which commit to provide you need to grep the Dockerfile
3. Even if you manage to provide the correct `rustc-perf`, its
   dependencies are not included in the `vendor/` dir created during
   `dist`, so it will fail to build from the published source tarballs
4. It is hard to provide any level of automation around updating the
   `rustc-perf` in use, leading to staleness

Fundamentally, this means `rustc-src` tarballs no longer contain
everything you need to bootstrap Rust, and packagers hoping to leverage
`opt-dist` need to go out of their way to keep track of this "hidden"
dependency on `rustc-perf`.

This change adds rustc-perf as a git submodule, pinned to the current
`PERF_COMMIT` 4f313add609f43e928e98132358e8426ed3969ae. Subsequent
commits ensure the submodule is initialized when necessary, and make use
of it in `opt-dist`.
2024-05-20 14:56:49 +00:00
Urgau f43e3e2023 Fix ignored tests for formatting 2024-05-04 12:37:30 +02:00
Guillaume Gomez 8f47f9773d Allow `fmt` to run on `rmake.rs` test files 2024-05-03 11:05:58 +02:00
bjorn3 8960fe05ad Remove exception for deleted file from rustfmt.toml 2024-03-08 20:46:33 +00:00
klensy 4580f4ab3f rustfmt.toml: don't ignore just any `tests` path, only root one 2024-01-11 14:59:59 +03:00
bjorn3 b7bc8d5cb7 Fix fn_sig_for_fn_abi and the coroutine transform for generators
There were three issues previously:
* The self argument was pinned, despite Iterator::next taking an
  unpinned mutable reference.
* A resume argument was passed, despite Iterator::next not having one.
* The return value was CoroutineState<Item, ()> rather than Option<Item>

While these things just so happened to work with the LLVM backend,
cg_clif does much stricter checks when trying to assign a value to a
place. In addition it can't handle the mismatch between the amount of
arguments specified by the FnAbi and the FnSig.
2023-11-23 20:17:19 +00:00
klensy f3d9248c22 rust-installer and rls no longer submodule, so fix rustfmt.toml 2023-07-04 18:39:48 +03:00
bjorn3 86b7750ada Format the examples directory of cg_clif
Formatting has been enforced in cg_clif's CI for a while now.
2023-06-19 16:54:28 +00:00
Albert Larsan 40ba0e84d5
Change `src/test` to `tests` in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
bjorn3 bffe880cfd Enforce formatting for rustc_codegen_cranelift 2022-01-01 16:52:30 +01:00
Jubilee Young 39cb863253 Expose portable-simd as core::simd
This enables programmers to use a safe alternative to the current
`extern "platform-intrinsics"` API for writing portable SIMD code.
This is `#![feature(portable_simd)]` as tracked in #86656
2021-11-12 16:58:39 -08:00
Antoni Boucher 8841e9e632 Fix tidy 2021-08-12 21:56:23 -04:00
Rich Kadel 79020a8d63 `test tidy` should ignore alternative `build` dir patterns
I need to have multiple `build` directories, such as `build`,
`build-fuchsia`, and `build-test`. But when I'm uploading a change, I
run `./x.py test tidy`, and if I have a `build-something` directory with
Rust sources, I git a bunch of formatting errors.

`rustfmt.toml` only ignores the directory named `build`.

This change extends the patterns to also ignore `build-*` and `*-build`.

As a rustc contributor, I not only build the rust compiler to develop
new features, but I also build alternative "distributions" (using
secondary `*-config.toml` files with different configurations),
including:

* To occasionally rebuild a version of the compiler that `rust-analyzer`
can use to `check` source (which fixes issues in the VS Code UI, so
changing and rebuilding the compiler does not break VS Code editing Rust
code).
* To build custom distributions for Fuchsia
* To build test distributions when working on changes to `bootstrap`
(e.g., when I recently added `rust-demangler` to distributions)
2021-04-24 14:12:22 -07:00
Mark Rousskov d5b760ba62 Bump rustfmt version
Also switches on formatting of the mir build module
2021-02-02 09:09:52 -05:00
Lzu Tao 6bfe27a3e0 Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
bjorn3 cf798c1ec6 Add support for using cg_clif to bootstrap rustc 2020-10-26 09:52:59 +01:00