Commit Graph

257032 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
76acf2617c
Rollup merge of #126234 - Bryanskiy:delegation-no-entry-ice, r=petrochenkov
Delegation: fix ICE on late diagnostics

fixes https://github.com/rust-lang/rust/issues/124342
2024-06-11 09:14:35 +01:00
许杰友 Jieyou Xu (Joe)
81ff9b5770
Rollup merge of #125913 - fmease:early-lints-spruce-up-some-diags, r=Nadrieril
Spruce up the diagnostics of some early lints

Implement the various "*(note to myself) in a follow-up PR we should turn parts of this message into a subdiagnostic (help msg or even struct sugg)*" drive-by comments I left in #124417 during my review.

For context, before #124417, only a few early lints touched/decorated/customized their diagnostic because the former API made it a bit awkward. Likely because of that, things that should've been subdiagnostics were just crammed into the primary message. This PR rectifies this.
2024-06-11 09:14:34 +01:00
bors
aec67e238d Auto merge of #126113 - Kobzol:ci-native-arm-runner, r=jdno
CI: use a native `arm64` runner

Opening to test if we can use a native GitHub ARM runner instead of the self-hosted one.

The CI has finished [successfully](https://github.com/rust-lang/rust/actions/runs/9414573751/job/25933776975?pr=126113). It took 1h 29m, which is longer than the previous duration (~1h 10m). This is expected, since we currently use 8 cores on GitHub, rather than 14 cores which are configured for the self-hosted runner.

try-job: aarch64-gnu
2024-06-11 04:14:57 +00:00
bors
fa1681c9f6 Auto merge of #125910 - scottmcm:single-use-consts, r=saethlin
Add `SingleUseConsts` mir-opt pass

The goal here is to make a pass that can be run in debug builds to simplify the common case of constants that are used just once -- that doesn't need SSA handling and avoids any potential downside of multi-use constants.  In particular, to simplify the `if T::IS_ZST` pattern that's common in the standard library.

By also handling the case of constants that are *never* actually used this fully replaces the `ConstDebugInfo` pass, since it has all the information needed to do that naturally from the traversal it needs to do anyway.

This is roughly a wash on instructions on its own (a couple regressions, a few improvements https://github.com/rust-lang/rust/pull/125910#issuecomment-2144963361), with a bunch of size improvements.  So I'd like to land it as its own PR, then do follow-ups to take more advantage of it (in the inliner, cg_ssa, etc).

r? `@saethlin`
2024-06-11 02:03:12 +00:00
bors
b5b13568fb Auto merge of #126240 - matthiaskrgr:rollup-ks4o2n9, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126063 (Remove some unused crate dependencies.)
 - #126115 (Fix ICE due to `unwrap` in `probe_for_name_many`)
 - #126159 (ScalarInt: size mismatches are a bug, do not delay the panic)
 - #126184 (interpret: do not ICE on padded non-pow2 SIMD vectors)
 - #126191 (Fix `NonZero` doctest inconsistencies)
 - #126211 (migrate tests/run-make/llvm-outputs to use rmake.rs)
 - #126212 (fix: build on haiku)
 - #126215 (Add explanatory note to async block type mismatch error)
 - #126223 (run-make: add `run_in_tmpdir` self-test)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-10 21:21:00 +00:00
bors
d402830c8a Auto merge of #125209 - Kobzol:rfl-ci, r=Mark-Simulacrum
Add Rust for Linux `auto` CI job

This PR adds an `auto` CI job that checks if Rust for Linux (RfL) still compiles with the latest version of the compiler and the standard library. If not, we should ideally ping the RfL ping group.

try-job: rfl
2024-06-10 19:13:10 +00:00
Matthias Krüger
d762ef1d0c
Rollup merge of #126223 - jieyouxu:rmake-run-in-tmpdir-self-test, r=Kobzol
run-make: add `run_in_tmpdir` self-test

Add a basic sanity test for `run_in_tmpdir` to make sure that files (including read-only files) and directories created inside the "scratch" tmpdir are removed after the closure returns.

r? ghost (while i run a try job)

try-job: x86_64-msvc
2024-06-10 21:12:28 +02:00
Matthias Krüger
f0adebc39d
Rollup merge of #126215 - gurry:125737-bad-err-anon-futs, r=lcnr
Add explanatory note to async block type mismatch error

The async block type mismatch error might leave the user wondering as to why it occurred. The new note should give them the needed context.

Changes this diagnostic:
```
error[E0308]: mismatched types
 --> src/main.rs:5:23
  |
2 |     let a = async { 1 };
  |             ----------- the expected `async` block
3 |     let b = async { 2 };
  |             ----------- the found `async` block
4 |
5 |     let bad = vec![a, b];
  |                       ^ expected `async` block, found a different `async` block
  |
  = note: expected `async` block `{async block@src/main.rs:2:13: 2:24}`
             found `async` block `{async block@src/main.rs:3:13: 3:24}`
```

to this:
```
error[E0308]: mismatched types
 --> src/main.rs:5:23
  |
2 |     let a = async { 1 };
  |             ----------- the expected `async` block
3 |     let b = async { 2 };
  |             ----------- the found `async` block
4 |
5 |     let bad = vec![a, b];
  |                       ^ expected `async` block, found a different `async` block
  |
  = note: expected `async` block `{async block@src/main.rs:2:13: 2:24}`
             found `async` block `{async block@src/main.rs:3:13: 3:24}`
  = note: no two async blocks, even if identical, have the same type
  = help: consider pinning your async block and and casting it to a trait object
```

Fixes #125737
2024-06-10 21:12:27 +02:00
Matthias Krüger
b59507874e
Rollup merge of #126212 - SteveLauC:fix/haiku, r=joboet
fix: build on haiku

## What does this PR do

The std is broken on haiku, this PR fixes it.

## To reproduce the issue

```sh
$ cargo +nightly --version
cargo 1.81.0-nightly (b1feb75d0 2024-06-07)

$ cargo new hello
$ cd hello
$ cargo +nightly check -Zbuild-std --target x86_64-unknown-haiku -q
error[E0433]: failed to resolve: use of undeclared crate or module `std`
   --> ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/os.rs:468:13
    |
468 |             std::ptr::null_mut(),
    |             ^^^ use of undeclared crate or module `std`
    |
help: consider importing one of these items
    |
8   + use core::ptr;
    |
8   + use crate::ptr;
    |
help: if you import `ptr`, refer to it directly
    |
468 -             std::ptr::null_mut(),
468 +             ptr::null_mut(),
    |

error[E0433]: failed to resolve: use of undeclared crate or module `std`
   --> ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/os.rs:470:13
    |
470 |             std::ptr::null_mut(),
    |             ^^^ use of undeclared crate or module `std`
    |
help: consider importing one of these items
    |
8   + use core::ptr;
```
2024-06-10 21:12:27 +02:00
Matthias Krüger
61eb29e958
Rollup merge of #126211 - lolbinarycat:llvm-outputs-rmake, r=jieyouxu
migrate tests/run-make/llvm-outputs to use rmake.rs

part of #121876

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-06-10 21:12:26 +02:00
Matthias Krüger
146f4b316e
Rollup merge of #126191 - ivan-shrimp:nonzero_doc, r=scottmcm
Fix `NonZero` doctest inconsistencies

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
`NonZero`'s doctests contain both `?` and `.unwrap()` with no obvious reason for the difference, so this changes all of them to `?`. Also removes an explicit `std::num::NonZero`.
2024-06-10 21:12:26 +02:00
Matthias Krüger
07bb7ca9fa
Rollup merge of #126184 - RalfJung:interpret-simd-nonpow2, r=oli-obk
interpret: do not ICE on padded non-pow2 SIMD vectors

Fixes https://github.com/rust-lang/miri/issues/3458

r? ``@oli-obk``
2024-06-10 21:12:25 +02:00
Matthias Krüger
2d7f7ffba5
Rollup merge of #126159 - RalfJung:scalarint-size-mismatch, r=oli-obk
ScalarInt: size mismatches are a bug, do not delay the panic

Cc [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Why.20are.20ScalarInt.20to.20iN.2FuN.20methods.20fallible.3F)

r? ``@oli-obk``
2024-06-10 21:12:25 +02:00
Matthias Krüger
bcc6fda0ef
Rollup merge of #126115 - gurry:125876-ice-unwrap-probe-many-result, r=compiler-errors
Fix ICE due to `unwrap` in `probe_for_name_many`

Fixes #125876

Now `probe_for_name_many` bubbles up the error returned by `probe_op` instead of calling `unwrap` on it.
2024-06-10 21:12:24 +02:00
Matthias Krüger
1832ee0c4b
Rollup merge of #126063 - nnethercote:rm-unused-crate-deps, r=jackh726
Remove some unused crate dependencies.

I found these by setting the `unused_crate_dependencies` lint temporarily to `Warn`.

r? ``@jackh726``
2024-06-10 21:12:24 +02:00
Bryanskiy
040791a9c5 Delegation: fix ICE on late diagnostics 2024-06-10 19:25:34 +03:00
bors
a3167859f2 Auto merge of #125017 - petrochenkov:upctxt, r=cjgillot
rustc_span: Optimize syntax context updates in spans

By updating inline contexts in place, without touching span interner, when possible.
2024-06-10 15:30:09 +00:00
Jakub Beránek
144760e236
CI: add Rust for Linux auto job 2024-06-10 14:31:21 +02:00
Gurinder Singh
251d2d0d4d Add explanatory note to async block type mismatch error 2024-06-10 17:14:49 +05:30
Ralf Jung
3c57ea0df7 ScalarInt: size mismatches are a bug, do not delay the panic 2024-06-10 13:43:16 +02:00
bors
0de24a5177 Auto merge of #126225 - Kobzol:tidy-update-rustc-perf, r=onur-ozkan
Update `rustc-perf` submodule before running tidy

Since https://github.com/rust-lang/rust/pull/125465, `tidy` checks `src/tools/rustc-perf`, so we need to have it checked out before running `tidy`.

Fixes: https://github.com/rust-lang/rust/issues/126224

r? `@onur-ozkan`
2024-06-10 11:08:16 +00:00
许杰友 Jieyou Xu (Joe)
256387b63e run-make: add run_in_tmpdir self-test 2024-06-10 10:46:36 +00:00
Jakub Beránek
faac70b66e
Update rustc-perf submodule before running tidy 2024-06-10 12:41:52 +02:00
Nicholas Nethercote
29629d0075 Remove some unused crate dependencies.
I found these by setting the `unused_crate_dependencies` lint
temporarily to `Warn`.
2024-06-10 19:55:49 +10:00
binarycat
91f5530b2d migrate tests/run-make/llvm-outputs to use rmake.rs
part of #121876
2024-06-10 05:30:58 -04:00
Scott McMurray
8fbab183d7 Delete ConstDebugInfo pass 2024-06-10 00:06:02 -07:00
Scott McMurray
476f46a8e6 Try keeping a bitset for which locals need debuginfo updates 2024-06-10 00:06:02 -07:00
Scott McMurray
a4d0fc39ba Add SingleUseConsts mir-opt pass 2024-06-10 00:06:02 -07:00
bors
06194cadcd Auto merge of #126206 - Kobzol:disable-libstdc++-version-check, r=Mark-Simulacrum
Remove libstdc++ version check error

This keeps the error message from https://github.com/rust-lang/rust/pull/125411, but removes the `exit(1)` call.

This PR is mostly a hotfix to unblock bootstrap benchmarks in rustc-perf.

However, I think that it might be better to just print a warning, in general. If the ABI version does not match, the build might or might not work locally (as we can see on rustc-perf, where it works even if the reported ABI is 7).

If it does not work (and **if** we can always recognize this during the LLVM wrapper build, instead of having some silent miscompilations), then the user will have to update their libstdc++ anyway, the error does not help them out on its own. So it should be enough to just provide a better error message, without blocking the build.

But I'm not adamant on that, I just want to unblock bootstrap benchmarks until we can find a way to update libstdc++ on the collector machine.

CC `@onur-ozkan`

r? `@Mark-Simulacrum`
2024-06-10 06:20:06 +00:00
Steve Lau
63ec8dd24f fix: build on haiku 2024-06-10 10:38:00 +08:00
bors
d2fb97fcec Auto merge of #126153 - onur-ozkan:fix-rustdoc-issue-with-ci-rustc, r=Mark-Simulacrum
resolve rustdoc incompatibility with `rust.download-rustc=true` + `rust.channel= beta/stable`

Previously, we were unable to use `rust.download-rustc` with the beta or stable
channel settings through `rust.channel` due to breaking rustdoc UI tests.
This was because when using a precompiled nightly compiler from CI, we must use the
channel of precompiled compiler and ignore `rust.channel` from the configuration.

This change addresses that issue in `Builder::doc_rust_lang_org_channel` and allows rustdoc
UI tests to work with the precompiled compiler even if the channel specified in config.toml is
"beta" or "stable".

Blocker for https://github.com/rust-lang/rust/pull/122709
2024-06-10 02:27:43 +00:00
bors
6d94a87275 Auto merge of #107099 - edward-shen:edward-shen/rustdoc-remap-path-prefix, r=GuillaumeGomez
rustdoc: Add support for --remap-path-prefix

Adds `--remap-path-prefix` as an unstable option. This is implemented to mimic the behavior of `rustc`'s `--remap-path-prefix`.

This flag similarly takes in two paths, a prefix to replace and a replacement string.

This is useful for build tools (e.g. Buck) other than cargo that can run doc tests.

cc: `@dtolnay`
2024-06-10 00:07:18 +00:00
Vadim Petrochenkov
d5dd2d8284 rustc_span: Optimize syntax context updates in spans 2024-06-10 02:20:16 +03:00
bors
a70b2ae577 Auto merge of #126205 - jieyouxu:rollup-s64z5ng, r=jieyouxu
Rollup of 4 pull requests

Successful merges:

 - #126172 (Weekly `cargo update`)
 - #126176 (rustdoc-search: use lowercase, non-normalized name for type search)
 - #126190 (Autolabel run-make tests, remind to update tracking issue)
 - #126194 (Migrate more things to `WinError`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-09 21:03:04 +00:00
Jakub Beránek
5349476a03 Remove libstdc++ version check 2024-06-09 22:10:49 +02:00
许杰友 Jieyou Xu (Joe)
60657d36af
Rollup merge of #126194 - ChrisDenton:winerror, r=Mark-Simulacrum
Migrate more things to `WinError`

In `library/std/src/sys/pal/windows`, we prefer to use the `WinError` type in place of using either `io::Result` or `unsafe { GetLastError }`. The latter is unsafe and weakly typed whereas the former is larger and requires unwrapping because it returns an `Option`.

I also fixed up a couple of places where we were unnecessarily defining error constants that are already defined.
2024-06-09 20:54:24 +01:00
许杰友 Jieyou Xu (Joe)
7e643932a5
Rollup merge of #126190 - jieyouxu:run-make-triagebot, r=Nilstrieb,Kobzol
Autolabel run-make tests, remind to update tracking issue

- Autolabel PRs modifying `tests/run-make/` and `src/tools/run-make-support/` with `A-run-make` label.
- Add reminder to update the tracking issue <https://github.com/rust-lang/rust/issues/121876> if applicable when `tests/run-make/` is modified by a PR.

r? `@Kobzol`
2024-06-09 20:54:23 +01:00
许杰友 Jieyou Xu (Joe)
1fb4805341
Rollup merge of #126176 - notriddle:notriddle/fix-type-name-normalize, r=fmease
rustdoc-search: use lowercase, non-normalized name for type search

The type name ID map has underscores in its names, so the query element should have them, too.

Fixes #125993
2024-06-09 20:54:23 +01:00
许杰友 Jieyou Xu (Joe)
cbb986945b
Rollup merge of #126172 - clubby789:cargo-update, r=Mark-Simulacrum
Weekly `cargo update`

Replaces #125562

`r-efi` needs to be bumped in two places.
The `icu4x` dependencies also added a SPDX license identifer, so remove the license checking exception and add `Unicode-3.0` to the list.
2024-06-09 20:54:22 +01:00
onur-ozkan
99c5476edb remove the outdated incompatibility check
This check is no longer needed as rustdoc ui tests works with any
channel + precompiled compiler.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-09 22:49:32 +03:00
onur-ozkan
e61d3b8372 fix Builder::doc_rust_lang_org_channel
Previously, we were unable to use `rust.download-rustc` with the beta or stable
channel settings through `rust.channel` due to breaking rustdoc UI tests.
This was because when using a precompiled nightly compiler from CI, we must use the
channel of precompiled compiler and ignore `rust.channel` from the configuration.

This change addresses that issue in `Builder::doc_rust_lang_org_channel` and allows rustdoc
UI tests to work with the precompiled compiler even if the channel specified in config.toml is
"beta" or "stable".

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-09 22:48:56 +03:00
Michael Howell
8865b8c639 rustdoc-search: use lowercase, non-normalized name for type search
The type name ID map has underscores in its names, so the query
element should have them, too.
2024-06-09 11:56:52 -07:00
bors
503dfcf4e0 Auto merge of #126202 - jieyouxu:rollup-2ixnizz, r=jieyouxu
Rollup of 6 pull requests

Successful merges:

 - #125041 (Enable GVN for `AggregateKind::RawPtr`)
 - #125253 (Add `FRAC_1_SQRT_2PI` constant to f16/f32/f64/f128)
 - #125465 (bootstrap: vendor crates required by opt-dist to collect profiles )
 - #125470 (Add release notes for 1.79.0)
 - #125963 (Remove hard-coded hashes from codegen tests)
 - #126188 (Fix documentation for `impl_common_helpers` in `run-make-support`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-09 18:54:46 +00:00
许杰友 Jieyou Xu (Joe)
a8cba36cbf
Rollup merge of #126188 - Kobzol:runmake-command-docs, r=jieyouxu
Fix documentation for `impl_common_helpers` in `run-make-support`

Forgot to do this in https://github.com/rust-lang/rust/pull/126121.

`@bors` rollup

r? `@jieyouxu`
2024-06-09 19:16:21 +01:00
许杰友 Jieyou Xu (Joe)
3720757d21
Rollup merge of #125963 - workingjubilee:remove-hashes-from-codegen-tests, r=Mark-Simulacrum
Remove hard-coded hashes from codegen tests

This removes hard-coded hashes from the codegen and assembly tests. These use FileCheck, which supports eliding part of the pattern being matched, including by capturing it as a pattern parameter for later matching-on. This is much more appropriate than asking contributors to engage with deliberately-opaque identifier schemes.

In order to reduce the likelihood of error, every hash-coded segment I've touched now expects a certain length. This correctly represents these cases, as our hash outputs have a predetermined amount of entropy attached to them.

This is not done for the UI test suite as those are comparatively easy to simply `--bless`, whereas that would be inappropriate for codegen tests. It is also not done for debuginfo tests as those tests do not support such elision in a correct and useful way.
2024-06-09 19:16:21 +01:00
许杰友 Jieyou Xu (Joe)
74408b1862
Rollup merge of #125470 - cuviper:relnotes-1.79.0, r=Mark-Simulacrum
Add release notes for 1.79.0

cc `@rust-lang/release`
r? `@Mark-Simulacrum`
2024-06-09 19:16:20 +01:00
许杰友 Jieyou Xu (Joe)
4ca52f1869
Rollup merge of #125465 - weihanglo:opt-dist-vendor, r=Mark-Simulacrum
bootstrap: vendor crates required by opt-dist to collect profiles

These are the default package set required by opt-dist to correctly work,
hence for people wanting to build a production grade of rustc in a
sandboxed / air-gapped environment, these need to be vendored.

The size of `rustc-src-nightly.tar.xz` before and after this change:

* Before: 298M
* After: 323M (+8%)

Size change might or might not be a concern.
See the previous discussion: https://github.com/rust-lang/rust/pull/125166#issuecomment-2113626468

Previous efforts on making:

* https://github.com/rust-lang/rust/pull/125125
* https://github.com/rust-lang/rust/pull/125166

---

Note that extra works still need to be done to make it fully vendored.

* The current pinned rustc-perf uses `tempfile::Tempdir` as the working
  directory when collecting profiles from some of these packages.
  This "tmp" working directory usage make it impossible for Cargo to pick
  up the correct vendor sources setting in `.cargo/config.toml` bundled
  in the rustc-src tarball. [^1]
* opt-dist verifies the final built rustc against a subset of rustc test
  suite. However it rolls out its own `config.toml` without setting
  `vendor = true`, and that results in `./vendor/` directory removed.
  [^2]

[^1]: 4f313add60/collector/src/compile/benchmark/mod.rs (L164-L173)
[^2]: 606afbb617/src/tools/opt-dist/src/tests.rs (L62-L77)
2024-06-09 19:16:20 +01:00
许杰友 Jieyou Xu (Joe)
61671a7e34
Rollup merge of #125253 - sunsided:feature/FRAC_1_SQRT_PI, r=Mark-Simulacrum
Add `FRAC_1_SQRT_2PI` constant to f16/f32/f64/f128

This adds the `FRAC_1_SQRT_2PI` to the `f16`, `f32`, `f64` and `f128` as [`1/√(2π)`](https://www.wolframalpha.com/input?i=1%2Fsqrt%282*pi%29). The rationale is that while `FRAC_1_SQRT_PI` already exists, [Gaussian calculations](https://en.wikipedia.org/wiki/Gaussian_function) for random normal distributions require a `1/(σ√(2π))` term, which could then be directly expressed e.g. as `f32::FRAC_1_SQRT_2PI / sigma`.

The actual value is approximately `1/√(2π) = 0.3989422804014326779399460599343818684758586311649346576659258296…`. Truncated/rounded forms were used for the individual types.

---

~~I did not any of the `#[unstable]` attributes since I am not aware of their implications.~~

**Edit:** I applied the stability attributes from the surrounding types according to what seemed most likely correct. I believe the `more_float_constants` feature marker is incorrectly applied, but I wasn't sure how to proceed.
2024-06-09 19:16:19 +01:00
许杰友 Jieyou Xu (Joe)
f000b428bd
Rollup merge of #125041 - scottmcm:gvn-for-from-raw-parts, r=cjgillot
Enable GVN for `AggregateKind::RawPtr`

Looks like I was worried for nothing; this seems like it's much easier than I was originally thinking it would be.
r? `@cjgillot`

This should be useful for `x[..4]`-like things, should those start inlining enough to expose the lengths.
2024-06-09 19:16:19 +01:00
Edward Shen
d9f78cb793
rustdoc: Add support for --remap-path-prefix
Adds --remap-path-prefix as an unstable option. This is implemented to
mimic the behavior of rustc's --remap-path-prefix but with minor
adjustments.

This flag similarly takes in two paths, a prefix to replace and a
replacement string.
2024-06-09 10:34:54 -07:00