Commit Graph

258658 Commits

Author SHA1 Message Date
David Carlier bd9ce3e074
std::unix::os::home_dir: fallback's optimisation.
we're using a guaranteed initialised field on success.
2024-06-23 08:22:51 +01:00
Jubilee Young 43a6b018a2 compiler: Mention C-unwind in C-variadic error 2024-06-22 23:30:31 -07:00
Nicholas Nethercote e2aa38e6ab Rework pattern and expression nonterminal kinds.
Merge `PatParam`/`PatWithOr`, and `Expr`/`Expr2021`, for a few reasons.

- It's conceptually nice, because the two pattern kinds and the two
  expression kinds are very similar.

- With expressions in particular, there are several places where both
  expression kinds get the same treatment.

- It removes one unreachable match arm.

- Most importantly, for #124141 I will need to introduce a new type
  `MetaVarKind` that is very similar to `NonterminalKind`, but records a
  couple of extra fields for expression metavars. It's nicer to have a
  single `MetaVarKind::Expr` expression variant to hold those extra
  fields instead of duplicating them across two variants
  `MetaVarKind::{Expr,Expr2021}`. And then it makes sense for patterns
  to be treated the same way, and for `NonterminalKind` to also be
  treated the same way.

I also clarified the comments, because I have long found them a little
hard to understand.
2024-06-23 15:57:24 +10:00
Jubilee Young 0d8f734172 compiler: Fix arm32 asm issues by hierarchically sorting reg classes 2024-06-22 21:39:58 -07:00
bors d4cc01c2f2 Auto merge of #126715 - Rejyr:migrate-readelf-rmake, r=jieyouxu
Migrate `relro-levels`, `static-pie` to `rmake`

Part of #121876.

r? `@jieyouxu`

try-job: aarch64-gnu
try-job: arm-android
try-job: armhf-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: dist-various-1
try-job: test-various
2024-06-23 03:43:25 +00:00
Mathilda 57cb0e23d9 Support absolute `PATHS` in `x.py test [PATHS]` 2024-06-22 23:33:52 -04:00
surechen e8b5ba1111 For [E0308]: mismatched types, when expr is in an arm's body, not add semicolon ';' at the end of it.
fixes #126222
2024-06-23 10:19:02 +08:00
Zalathar 16cf2682ee Try to clarify the confusingly-named `RustDev` and `RustcDev` steps 2024-06-23 11:31:21 +10:00
bors acb62737ac Auto merge of #126842 - calebcartwright:sync-from-rustfmt-24-06, r=calebcartwright
rustfmt subtree update

r? ghost
2024-06-23 00:42:26 +00:00
github-actions 990535723d cargo update
Locking 9 packages to latest compatible versions
    Updating clap_complete v4.5.5 -> v4.5.6
    Updating displaydoc v0.2.4 -> v0.2.5
    Removing icu_collections v1.5.0
    Removing icu_normalizer v1.5.0
    Removing icu_normalizer_data v1.5.0
    Removing icu_properties v1.5.0
    Removing icu_properties_data v1.5.0
 Downgrading idna v1.0.0 -> v0.5.0 (latest: v1.0.1)
    Updating lazy_static v1.4.0 -> v1.5.0
    Updating miniz_oxide v0.7.3 -> v0.7.4
    Updating proc-macro2 v1.0.85 -> v1.0.86
    Updating syn v2.0.66 -> v2.0.67
      Adding unicode-bidi v0.3.15
    Updating url v2.5.1 -> v2.5.2
    Removing utf16_iter v1.0.5
    Removing utf8_iter v1.0.4
    Removing write16 v1.0.0
note: pass `--verbose` to see 85 unchanged dependencies behind latest
2024-06-23 00:18:08 +00:00
Jerry Wang 75a9379c0f
(wip) Migrate `branch-protection-check-IBT` to `rmake` 2024-06-22 20:18:02 -04:00
Jerry Wang a19077d0f3
Enable cross compilation on `run-make/relro-levels` 2024-06-22 19:44:51 -04:00
Jubilee Young 26dccadb47 Allow "C-unwind" fn to have C variadics 2024-06-22 15:14:14 -07:00
Nicholas Nethercote 70fa67c0b2 Tweak some ugly formatting. 2024-06-23 08:13:41 +10:00
Nicholas Nethercote 470b0e9c3c Import `NonterminalKind` in `compiler/rustc_expand/src/mbe/quoted.rs`.
So we can omit the `token::` qualifier, which gives more space to some
cramped code.
2024-06-23 08:11:54 +10:00
Caleb Cartwright ffad9842bd update rustfmt version 2024-06-22 16:22:00 -05:00
Caleb Cartwright 53608bece0 fix bad merge conflict resolution 2024-06-22 16:21:14 -05:00
bors 3cb521a434 Auto merge of #126761 - GuillaumeGomez:unsafe_extern_blocks, r=spastorino
rustdoc: Add support for `missing_unsafe_on_extern` feature

Follow-up of https://github.com/rust-lang/rust/pull/124482.

Not sure if the `safe` keyword is supposed to be displayed or not though? For now I didn't add it in the generated doc, only `unsafe` as usual.

cc `@spastorino`
r? `@fmease`
2024-06-22 20:59:00 +00:00
Michael Goulet 97b7874a3c Fix rustfmt 2024-06-22 15:41:51 -05:00
Caleb Cartwright fc2cca942f Merge commit 'e4944185ae09c99f59b460e358909f329010ea9c' into sync-from-rustfmt-24-06 2024-06-22 15:33:45 -05:00
bors a0f01c3c10 Auto merge of #126838 - matthiaskrgr:rollup-qkop22o, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #126140 (Rename `std::fs::try_exists` to  `std::fs::exists` and stabilize fs_try_exists)
 - #126318 (Add a `x perf` command for integrating bootstrap with `rustc-perf`)
 - #126552 (Remove use of const traits (and `feature(effects)`) from stdlib)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-22 18:48:10 +00:00
Jerry Wang c69770d730
Migrate `static-pie` scripts to `rmake` 2024-06-22 14:15:23 -04:00
Jerry Wang f90d4e4371
Migrate `static-pie` to `rmake` 2024-06-22 14:15:22 -04:00
Jerry Wang e16f492e42
Migrate `relro-levels` to `rmake` 2024-06-22 14:15:22 -04:00
Jerry Wang 5a66a796fc
Add `stdin` to `run_make_support::command::Command` 2024-06-22 14:15:22 -04:00
Matthias Krüger dc9a08f535
Rollup merge of #126552 - fee1-dead-contrib:rmfx, r=compiler-errors
Remove use of const traits (and `feature(effects)`) from stdlib

The current uses are already unsound because they are using non-const impls in const contexts. We can reintroduce them by reverting the commit in this PR, after #120639 lands.

Also, make `effects` an incomplete feature.

cc `@rust-lang/project-const-traits`
r? `@compiler-errors`
2024-06-22 19:33:56 +02:00
Matthias Krüger 162120b4fa
Rollup merge of #126318 - Kobzol:bootstrap-perf, r=onur-ozkan
Add a `x perf` command for integrating bootstrap with `rustc-perf`

This PR adds a new `x perf` command to bootstrap. The idea is to let rustc developers profile (`profile_local`) and benchmark (`bench_local`) a stage1/stage2 compiler directly from within `rust`.

Before, if you wanted to use `rustc-perf`, you had to clone it, set it up, copy the `rustc` sysroot after every change to `rust` etc. This is an attempt to automate that.

I opened this PR mostly for discussion. My idea is to offer an interface that looks something like this (a random sample of commands):
```bash
x perf --stage 2 profile eprintln
x perf --stage1 profile cachegrind
x perf benchmark --id baseline
x perf benchmark --id after-edit
x perf cmp baseline after-edit
```

In this PR, I'd like to only implement the simplest case (`profile_local (eprintln)`), because that only requires a single sysroot (you don't compare anything), and it's relatively easy to set up. Also, I'd like to avoid forcing developers to deal with the rustc-perf UI, so more complex use-cases (like benchmarking two sysroots and comparing the results) should probably wait for https://github.com/rust-lang/rustc-perf/issues/1734 (which is hopefully coming along soon-ish).

I'm not sure if it's better to do this in bootstrap directly, or if I should create some shim tool that will receive a `rustc` sysroot, and offer a simplified CLI on top of `rustc-perf`.

## Why is a separate CLI needed?
We definitely need to add some support to bootstrap to automate preparing `rustc-perf` and the `rustc` sysroot, but in theory after that we could just let people invoke `rustc-perf` manually. While that is definitely possible, you'd need to manually figure out where is your sysroot located, which seems annoying to me. The `rustc-perf` CLI is also relatively complex, and for this use-case it makes sense to only use a subset of it. So I thought that it would be better to offer a simplified interface on top of it that would make life easier for contributors. But maybe it's not worth it.

CC `@onur-ozkan`
2024-06-22 19:33:56 +02:00
Matthias Krüger f3ced9d540
Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=Amanieu
Rename `std::fs::try_exists` to  `std::fs::exists` and stabilize fs_try_exists

FCP completed in tracking issue.

Tracking issue: https://github.com/rust-lang/rust/issues/83186

Closes https://github.com/rust-lang/rust/issues/83186

Stabilized API:

```rust
mod fs {
    pub fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool>;
}
```
2024-06-22 19:33:55 +02:00
bjorn3 8d1f5b30ef Avoid a couple of unnecessary EarlyDiagCtxt uses 2024-06-22 17:06:47 +00:00
bjorn3 e3ffbbd226 Ensure run_compiler always aborts on errors
Before if the closure passed to run_compiler emitted an error without
calling abort_if_errors and no diagnostics have been stashed,
run_compiler would return normally as if no error had occured.
2024-06-22 17:06:47 +00:00
bjorn3 7332e79d5f Inline write_dep_info query 2024-06-22 17:06:47 +00:00
Vadim Petrochenkov 0a265957dd delegation: Do not crash on qpaths without a trait 2024-06-22 19:57:19 +03:00
bors f944afe380 Auto merge of #116113 - kpreid:arcmut, r=dtolnay
Generalize `{Rc,Arc}::make_mut()` to unsized types.

* `{Rc,Arc}::make_mut()` now accept any type implementing the new unstable trait `core::clone::CloneToUninit`.
* `CloneToUninit` is implemented for `T: Clone` and for `[T] where T: Clone`.
* `CloneToUninit` is a generalization of the existing internal trait `alloc::alloc::WriteCloneIntoRaw`.
* New feature gate: `clone_to_uninit`

This allows performing `make_mut()` on `Rc<[T]>` and `Arc<[T]>`, which was not previously possible.

---

Previous PR description, now obsolete:

>  Add `{Rc, Arc}::make_mut_slice()`
>
> These functions behave identically to `make_mut()`, but operate on `Arc<[T]>` instead of `Arc<T>`.
>
> This allows performing the operation on slices, which was not previously possible because `make_mut()` requires `T: Clone` (and slices, being `!Sized`, do not and currently cannot implement `Clone`).
>
> Feature gate: `make_mut_slice`

try-job: test-various
2024-06-22 16:35:29 +00:00
bjorn3 391bdb3c12 Clarify visibility of several rustc_interface passes 2024-06-22 15:44:36 +00:00
bjorn3 d8c9dd4172 Move has_errors_or_delayed_bugs check into start_codegen 2024-06-22 15:44:36 +00:00
bjorn3 e2aadc296d Call check_for_rustc_errors_attr from start_codegen 2024-06-22 15:44:36 +00:00
bjorn3 c8380cbe6a Move almost all code from Queries::global_ctxt into passes::create_global_ctxt 2024-06-22 15:44:33 +00:00
Ralf Jung 763e3131cc don't ICE when encountering an extern type field during validation 2024-06-22 17:39:01 +02:00
Jerry Wang 6db3289de7
Add more flags for `llvm-readobj` 2024-06-22 11:24:59 -04:00
Kevin Reid 88c3db57e4 Generalize `{Rc,Arc}::make_mut()` to unsized types.
This requires introducing a new internal type `RcUninit` (and
`ArcUninit`), which can own an `RcBox<T>` without requiring it to be
initialized, sized, or a slice. This is similar to `UniqueRc`, but
`UniqueRc` doesn't support the allocator parameter, and there is no
`UniqueArc`.
2024-06-22 08:08:00 -07:00
Kevin Reid a9a4830d25 Replace `WriteCloneIntoRaw` with `CloneToUninit`. 2024-06-22 08:08:00 -07:00
Kevin Reid ec201b8650 Add `core::clone::CloneToUninit`.
This trait allows cloning DSTs, but is unsafe to implement and use
because it writes to possibly-uninitialized memory which must be of the
correct size, and must initialize that memory.

It is only implemented for `T: Clone` and `[T] where T: Clone`, but
additional implementations could be provided for specific `dyn Trait`
or custom-DST types.
2024-06-22 08:08:00 -07:00
Deadbeef 81da6a6d40 Make `effects` an incomplete feature 2024-06-22 14:11:11 +00:00
Ralf Jung 093799693a make unsized_fn_params an internal feature 2024-06-22 15:34:50 +02:00
bors ac47dbad50 Auto merge of #126824 - GuillaumeGomez:rollup-sybv8o7, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #126555 (Add `f16` inline ASM support for 32-bit ARM)
 - #126686 (Add `#[rustc_dump_{predicates,item_bounds}]`)
 - #126723 (Fix `...` in multline code-skips in suggestions)
 - #126731 (Bootstrap command refactoring: refactor `BootstrapCommand` (step 1))
 - #126823 (Migrate `run-make/inline-always-many-cgu` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-22 13:05:31 +00:00
bors 70e9582f4c Auto merge of #17475 - lnicola:changelog-title, r=lnicola
minor: Remove Changelog: XXX title from Github release notes

Fixes #16455
Closes #17165
2024-06-22 11:57:52 +00:00
Laurențiu Nicola 0744b36d53 Remove Changelog: XXX title from Github release notes 2024-06-22 14:55:23 +03:00
Guillaume Gomez d265538016
Rollup merge of #126823 - GuillaumeGomez:migrate-run-make-inline-always-many-cgu, r=Kobzol
Migrate `run-make/inline-always-many-cgu` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-06-22 12:57:21 +02:00
Guillaume Gomez 25bcc7d130
Rollup merge of #126731 - Kobzol:bootstrap-cmd-refactor, r=onur-ozkan
Bootstrap command refactoring: refactor `BootstrapCommand` (step 1)

This PR is a first step towards https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap.

It refactors `BoostrapCommand` to get it closer to a state where it is an actual command wrapper that can be routed through a central place of command execution, and also to make the distinction between printing output vs handling output programatically clearer (since now it's a mess).

The existing usages of `BootstrapCommand` are complicated primarily because of different ways of handling output. There are commands that:
1) Want to eagerly print stdout/stderr of the executed command, plus print an error message if the command fails (output mode `PrintAll`). Note that this error message attempts to print stdout/stderr of the command when `-v` is enabled, but that will always be empty, since this mode uses `.status()` and not `.output()`.
2) Want to eagerly print stdout/stderr of the executed command, but do not print any additional error message if it fails (output mode `PrintOutput`)
3) Want to capture stdout/stderr of the executed command, but print an error message if it fails (output mode `PrintFailure`). This means that the user wants to either ignore the output or handle it programatically, but that's not obvious from the name.

The difference between 1) and 2) (unless explicitly specified) is determined dynamically based on the bootstrap verbosity level.

It is very difficult for me to wrap my head around all these modes. I think that in a future PR, we should split these axes into e.g. this:
1) Do I want to handle the output programmatically or print it to the terminal? This should be a separate axis, true/false. (Note that "hiding the output" essentially just means saying that I handle it programmatically, and then I ignore the output).
2) Do I want to print a message if the command fails? Yes/No/Based on verbosity (which would be the default).

Then there is also the failure mode, but that is relatively simple to handle, the command execution will just shutdown bootstrap (either eagerly or late) when the command fails.

Note that this is just a first refactoring steps, there are a lot of other things to be done, so some things might not look "final" yet. The next steps are (not necessarily in this order):
- Remove `run` and `run_cmd` and implement everything in terms of `run_tracked` and rename `run_tracked` to `run`
- Implement the refactoring specified above (change how output modes work)
- Modify `BootstrapCmd` so that it stores `Command` instead of `&mut Command` and remove all the annoying `BootstrapCmd::from` by changing `Command::new` to `BootstrapCmd::new`
- Refactor the rest of command executions not currently using `BootstrapCmd` that can access Builder to use the correct output and failure modes. This will include passing Builder to additional places.
- Handle the most complex cases, such as output streaming. That will probably need to be handled separately.
- Refactor the rest of commands that cannot access builder (e.g. `Config::parse`) by introducing a new command context that will be passed to these places, and then stored in `Builder`. Move certain fields (such as `fail_fast`) from `Builder` to the command context.
- Handle the co-operation of `Builder`, `Build`, `Config` and command context. There are some fields and logic used during command execution that are distributed amongst `Builder/Build/Config`, so it will require some refactoring to make it work if the execution will happen on a separate place (in the command context).
- Refactor logging of commands, so that it is either logged to a file or printed in a nice hierarchical way that cooperates with the `Step` debug hierarchical output.
- Implement profiling of commands (add command durations to the command log, print a log of slowest commands and their execution counts at the end of bootstrap execution, perhaps store command executions to `metrics.json`).
- Implement caching of commands.
- Implement testing of commands through snapshot tests/mocking.

Best reviewed commit by commit.

r? ``@onur-ozkan``
2024-06-22 12:57:20 +02:00
Guillaume Gomez 399c5cabdd
Rollup merge of #126723 - estebank:dot-dot-dot, r=Nadrieril
Fix `...` in multline code-skips in suggestions

When we have long code skips, we write `...` in the line number gutter.

For suggestions, we were "centering" the `...` with the line, but that was inconsistent with what we do in every other case *and* off-center.
2024-06-22 12:57:19 +02:00