Commit graph

280665 commits

Author SHA1 Message Date
jyn
df94005f1d Don't apply editorconfig to llvm
They use 2 spaces by default, not 4.
2025-02-09 16:21:14 -05:00
bors
124cc92199 Auto merge of #136751 - bjorn3:update_rustfmt, r=Mark-Simulacrum
Update bootstrap compiler and rustfmt

The rustfmt version we previously used formats things differently from what the latest nightly rustfmt does. This causes issues for subtrees that get formatted both in-tree and in their own repo. Updating the rustfmt used in-tree solves those issues. Also bumped the bootstrap compiler as the stage0 update command always updates both at the same
time.
2025-02-09 15:44:16 +00:00
bors
a26e97be88 Auto merge of #136754 - Urgau:rollup-qlkhjqr, r=Urgau
Rollup of 5 pull requests

Successful merges:

 - #134679 (Windows: remove readonly files)
 - #136213 (Allow Rust to use a number of libc filesystem calls)
 - #136530 (Implement `x perf` directly in bootstrap)
 - #136601 (Detect (non-raw) borrows of null ZST pointers in CheckNull)
 - #136659 (Pick the max DWARF version when LTO'ing modules with different versions )

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-09 12:54:26 +00:00
bors
1ff21350fd Auto merge of #136762 - workingjubilee:rollup-23fn0nl, r=workingjubilee
Rollup of 8 pull requests

Successful merges:

 - #136397 (Add a comment pointing to ICE-136223)
 - #136686 (Clean up `HashMap` and `HashSet` docs.)
 - #136706 (compiler: mostly-finish `rustc_abi` updates)
 - #136710 (Document `Sum::sum` returns additive identities for `[]`)
 - #136724 (Make `AsyncFnOnce`, `AsyncFnMut`, `AsyncFn` non-`#[fundamental]`)
 - #136727 (Have a break from review rotation)
 - #136730 (transmutability: fix ICE when passing wrong ADT to ASSUME)
 - #136736 (Small resolve refactor)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-09 10:08:04 +00:00
Jubilee
45289b74fa
Rollup merge of #136736 - llogiq:small-resolve-refactor, r=jieyouxu
Small resolve refactor

I was looking into how resolve works in order to find a good way for clippy to shorten paths in messages and suggestions, and found a needless `.collect()` and a recursive function that could be written as a loop, also removed a panicky code path.
2025-02-08 20:41:24 -08:00
Jubilee
36c1809aa2
Rollup merge of #136730 - lukas-code:trans-ice, r=jswrenn
transmutability: fix ICE when passing wrong ADT to ASSUME

- Remove an incorrect assert that the `ASSUME` parameter has the type `Assume` and delay a bug instead.
- Since we checked the type of `ASSUME` is `Assume` (an ADT), its valtree must be a branch, so we can just unwrap it.

r? ```@jswrenn```
2025-02-08 20:41:23 -08:00
Jubilee
117ebaa8e6
Rollup merge of #136727 - chenyukang:yukang-fix-review-scope, r=workingjubilee
Have a break from review rotation

Be busy on the job recently.
2025-02-08 20:41:23 -08:00
Jubilee
bf2c5323e0
Rollup merge of #136724 - steffahn:asyncfn-non-fundamental, r=compiler-errors
Make `AsyncFnOnce`, `AsyncFnMut`, `AsyncFn` non-`#[fundamental]`

Address the issue #136723 on nightly (the issue will only *actually* be fixed with a beta backport).
2025-02-08 20:41:22 -08:00
Jubilee
c30908979f
Rollup merge of #136710 - JakenHerman:jaken/iterator-docs, r=workingjubilee
Document `Sum::sum` returns additive identities for `[]`

Because the neutral element of `<fNN as iter::Sum>` was changed to `neg_zero`, the documentation needed to be updated, as it was reporting inadequate information about what should be expected from the return.

Relevant Commit: 4908188518
Relevant Pull Request: https://github.com/rust-lang/rust/pull/129321

---

The referenced commit causes unintended side effects on presentation layer applications like using Tera templates, for example. I'm not sure what the motivation was behind the original change, but it seems like more discussion should be put into this issue and potentially have that change reverted.
2025-02-08 20:41:21 -08:00
Jubilee
5e4d6278af
Rollup merge of #136706 - workingjubilee:finish-up-rustc-abi-updates, r=compiler-errors
compiler: mostly-finish `rustc_abi` updates

This almost-finishes all the updates in the compiler to use `rustc_abi` and removes some of the reexports of `rustc_abi` items in `rustc_target` that were previously available.

r? ```@compiler-errors```
2025-02-08 20:41:21 -08:00
Jubilee
e7ad8cec96
Rollup merge of #136686 - bjoernager:master, r=jhpratt
Clean up `HashMap` and `HashSet` docs.

This commit makes some small, pedantic changes to the docs for `HashMap` and `HashSet`, which fixes that:

* "HashMap" is not always formatted as code (as in `HashMap`), and that
* `HashSet` sometimes references `HashMap` instead of itself.
2025-02-08 20:41:20 -08:00
Jubilee
ef22c14dfb
Rollup merge of #136397 - Shunpoco:issue-136223-ICE-pattern-mutability-cap-violated, r=Nadrieril
Add a comment pointing to ICE-136223

Fixes #136223

## Steps how the ICE happen
This explanation is based on the test case `&Some(Some(x)) = &Some(&mut Some(0))`.
The case should fail with E0596 error, but it catches the debug assertion instead.

1. For the first `&`: In check_pat_ref(), the value max_ref_mutbl becomes MutblCap::Not ([here](fdd1a3b026/compiler/rustc_hir_typeck/src/pat.rs (L2394-L2396))). Once max_ref_mutbl becomes Not, it will never be back to MutblCap::Mut.
2. For `&mut`: In peel_off_references(), because Some(x) doesn't have `&` nor `&mut`, `&mut` in `&mut Some(0)` is not consumed then default_binding_mode (def_br) becomes `ByRef::Yes(Mutability::Mut)` (around [here](fdd1a3b026/compiler/rustc_hir_typeck/src/pat.rs (L519-L536))). This will be inherited to the next step. So this pattern has the mismatch between `def_br=Yes(Mut)` and `max_ref_mutbl=Not` now.
3. For the value `0`: Because of the step 2, the default_binding_mode is `Yes(Mut)`, but max_ref_mutbl is `Not` from the step 1. It causes the assertion error [here](fdd1a3b026/compiler/rustc_hir_typeck/src/pat.rs (L427-L430)).

## What this PR fixes
Step 1 has happened from [this commit](e2f3ce9568) by deleting `no_ref_mut_behind_and` from the if block. In my understanding, after RFC3627 is released, step 1 should happen not only 2024 edition but also other editions to track MutblCap value. But for now, it should not happen for non-2024 edition. So I put it back.

NOTE: I think there is another solution - We should return an E0596 error in calc_default_binding_mode() instead of the debug assertion. Since the assertion is caused by the mismatch between `def_br = Yes(Mut)` and `max_ref_mutbl = Not`, but in my understanding this violation is the same as E0596. check_pat_ident() does returns E0596 by a similar reason [here](fdd1a3b026/compiler/rustc_hir_typeck/src/pat.rs (L837-L856)).
2025-02-08 20:41:20 -08:00
Urgau
5ec56e5fbb
Rollup merge of #136659 - wesleywiser:dwarf_version_lto_merge_behavior, r=jieyouxu
Pick the max DWARF version when LTO'ing modules with different versions

Currently, when rustc compiles code with `-Clto` enabled that was built
with different choices for `-Zdwarf-version`, a warning will be
reported. It's very easy to observe this by compiling most anything (eg,
"hello world") and specifying `-Clto -Zdwarf-version=5` since the
standard library is distributed with `-Zdwarf-version=4`.

This behavior isn't actually useful for a few reasons:
- From observation, LLVM chooses to pick the highest DWARF version
  anyway after issuing the warning.
- Clang specifies that in this case, the max version should be picked
  without a warning and as a general principle, we want to support
  x-lang LTO with Clang which implies using the same module flag merge
  behaviors.
- Debuggers need to be able to handle a variety of versions within the
  same debugging session as you can easily have some parts of a binary
  (or some dynamic libraries within an application) all compiled with
  different DWARF versions.

This commit changes the module flag merge behavior to match Clang and
use the highest version of DWARF. It also adds a test to ensure this
behavior is respected in the case of two crates being LTO'd together and
adds a test to ensure no warning is printed.

Fixes #130041 which fails due to these warnings being printed

cc #103057
2025-02-09 00:37:28 +01:00
Urgau
e5bc12e4a3
Rollup merge of #136601 - compiler-errors:borrow-null-zst, r=saethlin
Detect (non-raw) borrows of null ZST pointers in CheckNull

Fixes #136568. Ensures that we check that borrows of derefs are non-null in the `CheckNull` pass **even if** it's a ZST pointee.

I'm actually surprised that this is UB in Miri, but if it's certainly UB, then this PR modifies the null check to be stricter. I couldn't find anywhere in https://doc.rust-lang.org/reference/behavior-considered-undefined.html that discusses this case specifically, but I didn't read it too closely, or perhaps it's just missing a bullet point.

On the contrary, if this is actually erroneous UB in Miri, then I'm happy to close this (and perhaps fix the null check in Miri to exclude ZSTs?)

On the double contrary, if this is still an "open question", I'm also happy to close this and wait for a decision to be made.

r? ``@saethlin`` cc ``@RalfJung`` (perhaps you feel strongly about this change)
2025-02-09 00:37:28 +01:00
Urgau
d024cef057
Rollup merge of #136530 - Kobzol:x-perf, r=onur-ozkan
Implement `x perf` directly in bootstrap

Discussed [here](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Turning.20.60x.20perf.60.20into.20a.20first.20class.20command).

Implementing the command directly in bootstrap let's us correctly build the compiler toolchain based on input arguments (such as include rustdoc in the toolchain [only] when needed), and it also makes the CLI interface nicer.

r? ``@onur-ozkan``
2025-02-09 00:37:27 +01:00
Urgau
9530d243d7
Rollup merge of #136213 - erickt:fs, r=Mark-Simulacrum
Allow Rust to use a number of libc filesystem calls

This allows Rust on Fuchsia to use a number of function calls from libc:

* dirfd
* fdatasync
* flock with LOCK_EX, LOCK_SH, LOCK_NB, LOCK_UN
* fstatat

cc #120426

try-job: dist-various-2
2025-02-09 00:37:27 +01:00
Urgau
34182470eb
Rollup merge of #134679 - ChrisDenton:rm-readonly, r=Mark-Simulacrum
Windows: remove readonly files

When calling `remove_file`, we shouldn't fail to delete readonly files. As the test makes clear, this make the Windows behaviour consistent with other platforms. This also makes us internally consistent with `remove_dir_all`.

try-job: x86_64-msvc-ext1
2025-02-09 00:37:26 +01:00
Michael Goulet
a61537f6c0 occured -> occurred 2025-02-08 22:28:21 +00:00
bjorn3
1fcae03369 Rustfmt 2025-02-08 22:12:13 +00:00
bjorn3
3183b44a1e Update bootstrap compiler and rustfmt
The rustfmt version we previously used formats things differently from
what the latest nightly rustfmt does. This causes issues for subtrees
that get formatted both in-tree and in their own repo. Updating the
rustfmt used in-tree solves those issues. Also bumped the bootstrap
compiler as the stage0 update command always updates both at the same
time.
2025-02-08 22:07:11 +00:00
Jaken Herman
4457f44065 Document Sum::sum returns additive identities for []
Because the neutral element of `<fNN as iter::Sum>` was changed to
`neg_zero`, the documentation needed to be updated, as it was reporting
inadequate information about what should be expected from the return.

Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-02-08 14:06:13 -08:00
Michael Goulet
b4641b2b3f Detect (non-raw) borrows of null ZST pointers in CheckNull 2025-02-08 21:38:16 +00:00
bors
43ca9d18e3 Auto merge of #136747 - matthiaskrgr:rollup-qfiiv4n, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #135696 (std: move `io` module out of `pal`, get rid of `sys_common::io`)
 - #136099 (Optimize `Rc::<str>::default()` implementation)
 - #136200 (Generate correct terminate block under Wasm EH)
 - #136626 (create `initial_rustdoc` field in `Build`)
 - #136657 (Make empty-line-after an early clippy lint)
 - #136679 (ci: Use largedisk for loongarch)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-08 21:11:17 +00:00
Matthias Krüger
45771e43ba
Rollup merge of #136679 - Flakebi:loongarch64-diskspace, r=marcoieni
ci: Use largedisk for loongarch

`dist-loongarch64-linux` and `dist-loongarch64-musl` seem to run out of disk space when adding the amdgpu LLVM backend. There are changes underway to free more disk space, but that may take a while, so it was suggested to switch the affected jobs to a largedisk runner until that is ready.
`dist-powerpc64-linux` is another job that ran out of disk space one time, but it succeeded the other times, so I did not include it here.

amdgpu target PR with more references to the failures: #134740

r? ```@marcoieni```
2025-02-08 21:37:27 +01:00
Matthias Krüger
dbcd74e6d9
Rollup merge of #136657 - jdonszelmann:empty-line-after, r=y21,flip1995,WaffleLapkin
Make empty-line-after an early clippy lint

r? ```@y21```

95% a refiling of https://github.com/rust-lang/rust-clippy/pull/13658 but for correctness it needed 2 extra methods in `rust_lint` which made it much easier to apply on `rust-lang/rust` than `rust-lang/rust-clippy`.

Commits have been thoroughly reviewed on `rust-lang/clippy already`. The last two review comments there (about using `Option` and popping for assoc items have been applied here.
2025-02-08 21:37:26 +01:00
Matthias Krüger
2d87a07e9f
Rollup merge of #136626 - onur-ozkan:initial-rustdoc, r=jieyouxu
create `initial_rustdoc` field in `Build`

just a minor improvement
2025-02-08 21:37:25 +01:00
Matthias Krüger
1667e26616
Rollup merge of #136200 - purplesyringa:wasm-eh-fixes, r=bjorn3
Generate correct terminate block under Wasm EH

This fixes failing LLVM assertions during insnsel.

Improves #135665.

r? bjorn3

^ you reviewed the PR bringing Wasm EH in, I assume this is within your area of expertise?
2025-02-08 21:37:25 +01:00
Matthias Krüger
785a4eb2d2
Rollup merge of #136099 - Kijewski:pr-rc-str-default, r=ibraheemdev
Optimize `Rc::<str>::default()` implementation

This PR lets `impl Default for Rc<str>` re-use the implementation for `Rc::<[u8]>::default()`. The previous version only calculted the memory layout at runtime, even though it should be known at compile time, resulting in an additional function call.

The same optimization is done for `Rc<CStr>`.

Generated byte code: <https://godbolt.org/z/dfq73jsoP>.

Resolves <https://github.com/rust-lang/rust/issues/135784>.

Cc `@Billy-Sheppard.`
2025-02-08 21:37:24 +01:00
Matthias Krüger
02b8bea084
Rollup merge of #135696 - joboet:move_pal_io, r=Noratrieb
std: move `io` module out of `pal`, get rid of `sys_common::io`

Part of #117276.

This does two related things:
1. It moves the platform-specific definitions for `IoSlice`, `IoSliceMut` and `is_terminal` out of `pal` and into `sys` and unifies some of them.
2. It gets rid of `sys_common::io`, moving the non-platform-specific test helpers into `std::test_helpers` and the buffer size definition to the new `sys::io` module.
2025-02-08 21:37:24 +01:00
bors
73bf7947e9 Auto merge of #136715 - bjorn3:sync_cg_clif-2025-02-07, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlights this time are a Cranelift update and a fix for a warning that the x87 feature is not enabled.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler<!-- homu-ignore:start -->
2025-02-08 18:23:41 +00:00
Wesley Wiser
bbc40e7822 Pick the max DWARF version when LTO'ing modules with different versions
Currently, when rustc compiles code with `-Clto` enabled that was built
with different choices for `-Zdwarf-version`, a warning will be
reported. It's very easy to observe this by compiling most anything (eg,
"hello world") and specifying `-Clto -Zdwarf-version=5` since the
standard library is distributed with `-Zdwarf-version=4`.

This behavior isn't actually useful for a few reasons:
- from observation, LLVM chooses to pick the highest DWARF version
  anyway after issuing the warning
- Clang specifies that in this case, the max version should be picked
  without a warning and as a general principle, we want to support
  x-lang LTO with Clang which implies using the same module flag merge
  behaviors
- Debuggers need to be able to handle a variety of versions withing the
  same debugging session as you can easily have some parts of a binary
  (or some dynamic libraries within an application) all compiled with
  different DWARF versions

This commit changes the module flag merge behavior to match Clang and
use the highest version of DWARF. It also adds a test to ensure this
behavior is respected in the case of two crates being LTO'd together and
updates the test added in the previous commit to ensure no warning is
printed.
2025-02-08 16:33:36 +00:00
Wesley Wiser
cd3dd5bd23 Add tests for -Zdwarf-version lto behavior 2025-02-08 16:33:36 +00:00
bors
8ad2c9724d Auto merge of #136728 - matthiaskrgr:rollup-x2qh9yt, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #136640 (Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bit)
 - #136648 (Add a missing `//@ needs-symlink` to `tests/run-make/libs-through-symlinks`)
 - #136651 (Label mismatched parameters at the def site for foreign functions)
 - #136691 (Remove Linkage::Private and Linkage::Appending)
 - #136692 (add module level doc for bootstrap:utils:exec)
 - #136700 (i686-unknown-hurd-gnu: bump baseline CPU to Pentium 4)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-08 12:57:59 +00:00
Andre Bogus
32955b91e8 Small resolve refactor 2025-02-08 10:46:46 +01:00
Jubilee Young
221416deea compiler: use rustc_abi in rustc_ast_* 2025-02-07 21:52:37 -08:00
bors
d2f335d58e Auto merge of #136725 - weihanglo:update-cargo, r=weihanglo
Update cargo

14 commits in 0e3d73849ab8cbbab3ec5c65cbd555586cb21339..2928e32734b04925ee51e1ae88bea9a83d2fd451
2025-02-01 20:14:40 +0000 to 2025-02-07 16:50:22 +0000
- Simplify backtrack (rust-lang/cargo#15150)
- Don't use on Solaris libc::LOCK_* which were removed from libc in ver… (rust-lang/cargo#15143)
- feat: emit error if package not found within workspace (rust-lang/cargo#15071)
- Make cache tracking resilient to unexpected files (rust-lang/cargo#15147)
- Small resolver cleanups (rust-lang/cargo#15040)
- feat: add `cargo pkgid` support for cargo-script (rust-lang/cargo#14961)
- Suggest similar feature names on CLI (rust-lang/cargo#15133)
- fix: Don't use "did you mean" in errors (rust-lang/cargo#15138)
- Fix changelog link (rust-lang/cargo#15142)
- chore(deps): update rust crate rand to 0.9.0 (rust-lang/cargo#15129)
- Remove the original changelog (rust-lang/cargo#15123)
- chore(deps): update rust crate gix to 0.70.0 (rust-lang/cargo#15128)
- allow windows reserved names in CI (rust-lang/cargo#15135)
- removed a word that was repeated (rust-lang/cargo#15136)
2025-02-08 05:43:19 +00:00
Lukas Markeffsky
c097b2c6bb transmutability: fix ICE when passing wrong ADT to ASSUME 2025-02-08 05:44:29 +01:00
Matthias Krüger
a5b9e8ce83
Rollup merge of #136700 - RalfJung:hurd, r=Noratrieb
i686-unknown-hurd-gnu: bump baseline CPU to Pentium 4

See https://github.com/rust-lang/rust/issues/136495 for context. ``@sthibaul`` (the only listed target maintainer) said they would be [fine](https://github.com/rust-lang/rust/issues/136495#issuecomment-2638355845) with this change.
2025-02-08 03:58:49 +01:00
Matthias Krüger
68ef129939
Rollup merge of #136692 - Shourya742:2025-02-07-add-rust-docs-for-bootstrap-utils-exec, r=onur-ozkan
add module level doc for bootstrap:utils:exec

This PR adds module level doc for bootstrap utils/exec module
2025-02-08 03:58:49 +01:00
Matthias Krüger
c9771e9590
Rollup merge of #136691 - bjorn3:linkage_cleanup, r=jieyouxu
Remove Linkage::Private and Linkage::Appending

Neither of them has any use case. Neither known nor theoretical.
2025-02-08 03:58:48 +01:00
Matthias Krüger
50f9bbaee4
Rollup merge of #136651 - Jarcho:fn_ctxt3, r=compiler-errors
Label mismatched parameters at the def site for foreign functions

Nice and simple. Adds parameter marking for the only missing definition type.

r? ``@compiler-errors``
2025-02-08 03:58:47 +01:00
Matthias Krüger
926857f030
Rollup merge of #136648 - jieyouxu:missing-needs-symlink, r=wesleywiser
Add a missing `//@ needs-symlink` to `tests/run-make/libs-through-symlinks`

r? ``@wesleywiser`` (since you [found it](498173394) :P or reroll)
2025-02-08 03:58:46 +01:00
Matthias Krüger
93b194516a
Rollup merge of #136640 - Zalathar:debuginfo-align-bits, r=compiler-errors
Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bit

In #116096, function ZSTs were made to have debuginfo that gives them an alignment of “1”. But because alignment in LLVM debuginfo is denoted in *bits*, not bytes, this resulted in an alignment specification of 1 bit instead of 1 byte.

I don't know whether this has any practical consequences, but I noticed that a test started failing when I accidentally fixed the mistake while working on #136632, so I extracted the fix (and the test adjustment) to this PR.
2025-02-08 03:58:45 +01:00
bors
0148a2be13 Auto merge of #136713 - matthiaskrgr:rollup-sy6py39, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #135179 (Make sure to use `Receiver` trait when extracting object method candidate)
 - #136554 (Add `opt_alias_variances` and use it in outlives code)
 - #136556 ([AIX] Update tests/ui/wait-forked-but-failed-child.rs to accomodate exiting and idle processes.)
 - #136589 (Enable "jump to def" feature on rustc docs)
 - #136615 (sys: net: Add UEFI stubs)
 - #136635 (Remove outdated `base_port` calculation in std net test)
 - #136682 (Move two windows process tests to tests/ui)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-08 02:57:14 +00:00
yukang
597143b7b6 Have a break from review rotation 2025-02-08 09:53:58 +08:00
Frank Steffahn
7155382240 Make AsyncFnOnce, AsyncFnMut, AsyncFn non-#[fundamental] 2025-02-08 02:45:29 +01:00
Weihang Lo
b14fb2d6c3
Update cargo 2025-02-07 20:36:15 -05:00
bors
e0607238c9 Auto merge of #136588 - ChrisDenton:no-msys2, r=Kobzol
Don't install msys2 in CI

windows-msvc doesn't need it and windows-gnu [installs its own version](https://github.com/rust-lang/rust/blob/master/src/ci/scripts/install-mingw.sh)

try-job: dist-x86_64-msvc
try-job: dist-i686-msvc
try-job: dist-aarch64-msvc
try-job: dist-i686-mingw
try-job: dist-x86_64-mingw
try-job: dist-x86_64-msvc-alt
2025-02-08 00:09:42 +00:00
Shunpoco
ba124898c0 Add comment for regression #136223 on borrowck-errors.rs
Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-02-07 21:40:58 +00:00
bjorn3
cac271fd38 Merge commit '8332329f83' into sync_cg_clif-2025-02-07 2025-02-07 20:58:27 +00:00