Commit Graph

300570 Commits

Author SHA1 Message Date
Tomasz Miąsko
5b6d661039 Remove support for SwitchInt edge effects in backward dataflow analyses
Those effects are untested and unused. Remove them along with
the implementation of `BasicBlocks::switch_sources`.
2025-07-11 10:56:50 +02:00
Oli Scherer
e681d1a973 constify From and Into 2025-07-11 08:30:47 +00:00
Jubilee Young
39f7707fea compiler: comment on some call-related codegen fn in cg_ssa
Partially documents the situation due to LLVM CFI.
2025-07-11 01:08:21 -07:00
Shoyu Vanilla (Flint)
7e743ab065 Merge pull request #20224 from Hmikihiro/migrate_remove_dbg
Migrate `remove_dbg` assist to use `SyntaxEditor`
2025-07-11 07:41:34 +00:00
Hayashi Mikihiro
1b9d64d876 Migrate remove_dbg assist to use SyntaxEditor 2025-07-11 16:24:57 +09:00
Marijn Schouten
ba3b7a7d9c build-helper: clippy fixes 2025-07-11 07:15:20 +00:00
Tomasz Miąsko
011d4aa81f Call get_switch_int_data on a block with SwitchInt terminator
Fix a mix-up of a block with its predecessors in handling of SwitchInt
edge effects for backward analysis. Note that this functionality is
currently unused, so change has no practical impact.
2025-07-11 08:49:11 +02:00
Marijn Schouten
8bf88a2623 tidy: use write_all 2025-07-11 05:39:27 +00:00
Marijn Schouten
6356faf848 tidy: use flatten instead of manual flatten 2025-07-11 05:39:27 +00:00
Marijn Schouten
9bd4c90caf tidy: move to edition 2024 2025-07-11 05:39:27 +00:00
Marijn Schouten
a4e994ea43 tidy: simplify fluent file extension checking 2025-07-11 05:39:27 +00:00
Marijn Schouten
ef5c209df3 tidy: clippy fixes 2025-07-11 05:39:21 +00:00
Marijn Schouten
dcf965d652 x: use let-else 2025-07-11 05:38:05 +00:00
Marijn Schouten
b87a1b1297 x: move to edition 2024 2025-07-11 05:38:05 +00:00
Marijn Schouten
28612748f6 x: clippy fixes 2025-07-11 05:38:00 +00:00
Matthias Krüger
e43481e362 Rollup merge of #143718 - scottmcm:ub-transmute-is-ub, r=WaffleLapkin
Make UB transmutes really UB in LLVM

Ralf suggested in <https://github.com/rust-lang/rust/pull/143410#discussion_r2184928123> that UB transmutes shouldn't be trapping, which happened for the one path *that* PR was changing, but there's another path as well, so *this* PR changes that other path to match.

r? codegen
2025-07-11 07:35:22 +02:00
Matthias Krüger
dbd2f30395 Rollup merge of #143708 - epage:pretty, r=compiler-errors
fix: Include frontmatter in -Zunpretty output

In the implementation (rust-lang/rust#140035), this was left as an open question for
the tracking issue (rust-lang/rust#136889).  My assumption is that this should be
carried over.

The test was carried over from rust-lang/rust#137193 which was superseded by rust-lang/rust#140035.

Thankfully, either way, `-Zunpretty` is unstable and we can always
change it even if we stabilize frontmatter.
2025-07-11 07:35:21 +02:00
Matthias Krüger
140f2fa5ae Rollup merge of #143661 - Muscraft:other-suggestion-message, r=estebank
chore: Improve how the other suggestions message gets rendered

Note: This change is part of my ongoing work to use `annotate-snippets` as `rustc`'s emitter

This change started as a way to remove some specialty code paths from `annotate-snippets`, by making the "and {} other candidates" message get rendered like a secondary message with no level, but turned into a fix for the message's Unicode output. Before this change, when using the Unicode output, the other suggestions message would get rendered outside of the main suggestion block, making it feel disconnected from what it was referring to. This change makes it so that the message is on the last line of the block, aligning its rendering with other secondary messages, and making it clear what the message is referring to.

Before:
```
error[E0433]: failed to resolve: use of undeclared type `IntoIter`
   ╭▸ $DIR/issue-82956.rs:28:24
   │
LL │         let mut iter = IntoIter::new(self);
   │                        ━━━━━━━━ use of undeclared type `IntoIter`
   ╰╴
help: consider importing one of these structs
   ╭╴
LL + use std::array::IntoIter;
   ├╴
LL + use std::collections::binary_heap::IntoIter;
   ├╴
LL + use std::collections::btree_map::IntoIter;
   ├╴
LL + use std::collections::btree_set::IntoIter;
   ╰╴
     and 9 other candidates
```

After:
```
error[E0433]: failed to resolve: use of undeclared type `IntoIter`
   ╭▸ $DIR/issue-82956.rs:28:24
   │
LL │         let mut iter = IntoIter::new(self);
   │                        ━━━━━━━━ use of undeclared type `IntoIter`
   ╰╴
help: consider importing one of these structs
   ╭╴
LL + use std::array::IntoIter;
   ├╴
LL + use std::collections::binary_heap::IntoIter;
   ├╴
LL + use std::collections::btree_map::IntoIter;
   ├╴
LL + use std::collections::btree_set::IntoIter;
   │
   ╰ and 9 other candidates
```
2025-07-11 07:35:20 +02:00
Matthias Krüger
2ffaa1ec0d Rollup merge of #143611 - GrigorenkoPV:ParseIntError, r=tgross35
Mention more APIs in `ParseIntError` docs

Fixes rust-lang/rust#143602

r? `@lolbinarycat`

`@rustbot` label +A-docs
2025-07-11 07:35:20 +02:00
Matthias Krüger
5cbf7cf9c4 Rollup merge of #143568 - Ayush1325:uefi-tcp4-timeout, r=tgross35
std: sys: net: uefi: tcp4: Add timeout support

- Implement timeout support for read, write and connect.
- A software implementation using Instant.
2025-07-11 07:35:19 +02:00
Matthias Krüger
66799d0b83 Rollup merge of #143303 - Kivooeo:tf28, r=tgross35
`tests/ui`: A New Order [28/28] FINAL PART

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? ``@tgross35``
2025-07-11 07:35:19 +02:00
Matthias Krüger
3d6eb225e2 Rollup merge of #143302 - Kivooeo:tf27, r=tgross35
`tests/ui`: A New Order [27/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? ``@tgross35``
2025-07-11 07:35:18 +02:00
Matthias Krüger
2730bebbf8 Rollup merge of #142391 - LevitatingBusinessMan:setsid, r=workingjubilee
rust: library: Add `setsid` method to `CommandExt` trait

Add a setsid method to the CommandExt trait so that callers can create a process in a new session and process group whilst still using the POSIX spawn fast path.

Tracking issue: rust-lang/rust#105376

ACP: https://github.com/rust-lang/libs-team/issues/184

This PR was previously submitted by ``@HarveyHunt`` (whom I marked as Co-Author in the commit message) in rust-lang/rust#105377. However that PR went stale.

I applied the [suggestion](231d19fcbf (r1893457943)) to change the function signature to `fn setsid(&mut self, setsid: bool) -> &mut Command`.
2025-07-11 07:35:17 +02:00
bors
855e0fe46e Auto merge of #142911 - mejrs:unsized, r=compiler-errors
Remove support for dynamic allocas

Followup to rust-lang/rust#141811
2025-07-11 05:27:32 +00:00
Colten
3c11029ace docs: clarify “dag” in std::sys_common doc comment 2025-07-11 11:53:47 +08:00
Shoyu Vanilla (Flint)
c4f97e8078 Merge pull request #20230 from asahi-myzk/update-cargo-metadata
update cargo_metadata to 0.21.0
2025-07-11 01:42:57 +00:00
bors
cdac44e608 Auto merge of #143762 - tgross35:rollup-n9t27c6, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#140136 (Add an aarch64-msvc build running on ARM64 Windows)
 - rust-lang/rust#143642 (stdarch subtree update)
 - rust-lang/rust#143707 (Fix `--skip-std-check-if-no-download-rustc`)
 - rust-lang/rust#143722 (Make some "safe" llvm ops actually sound)
 - rust-lang/rust#143728 (Resolve refactor: extraction of `finalize_module_binding` and `single_import_can_define_name`)
 - rust-lang/rust#143742 (Rework borrowing suggestions to use `Expr` instead of just `Span`)
 - rust-lang/rust#143744 (Properly track the depth when expanding free alias types)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-11 01:06:04 +00:00
asahi-myzk
506ea9a4f1 update cargo_metadata to 0.21.0 2025-07-11 09:59:40 +09:00
Trevor Gross
3a1bb04166 Rollup merge of #143744 - fmease:lta-expand-proper-depth, r=compiler-errors
Properly track the depth when expanding free alias types

Decrease the depth after the fold so as not to affect the depth for unrelated same-level constituent types. My bad.

Fixes rust-lang/rust#142419.
2025-07-10 20:20:41 -04:00
Trevor Gross
58e5c2629d Rollup merge of #143742 - estebank:borrow-suggestion, r=compiler-errors
Rework borrowing suggestions to use `Expr` instead of just `Span`

In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`. (We were already doing this, but only for a subset of cases.) This now better handles situations where parentheses and `<>` are needed for correct syntax (`&(foo + bar)`, `(&foo).bar()`, `<&Foo>::bar()`, etc.).

Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases. (Instead of having two branches for emitting the suggestion, we now have a single one, using `Diag::multipart_suggestions` always.)

Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`. Fix rust-lang/rust#143393.

Make `Diag::multipart_suggestions` always verbose. CC rust-lang/rust#141973.
2025-07-10 20:20:40 -04:00
Trevor Gross
44f40e95d5 Rollup merge of #143728 - LorrensP-2158466:refactor-resolve-extraction, r=petrochenkov
Resolve refactor: extraction of `finalize_module_binding` and `single_import_can_define_name`

This pr the work Vadim asked for in https://github.com/rust-lang/rust/pull/142547#issuecomment-3001339385. This part:
> finalize_module_binding/single_import_can_define_name extraction

Cherry-picked commits of b-naber. Extraction of 2 processes in `resolve_ident_in_module_unadjusted`:
- `finalize_module_binding`
- `single_import_can_define_name`

r? ```@petrochenkov```
2025-07-10 20:20:40 -04:00
Trevor Gross
6e3d017b2f Rollup merge of #143722 - oli-obk:sound-llvm, r=dianqk
Make some "safe" llvm ops actually sound

Noticed while doing other refactorings

it may cause some extra unnecessary allocations, but the current use sites are rare ones anyway
2025-07-10 20:20:39 -04:00
Trevor Gross
d1a57676ef Rollup merge of #143707 - Kobzol:bootstrap-std-check, r=jieyouxu
Fix `--skip-std-check-if-no-download-rustc`

Since https://github.com/rust-lang/rust/pull/143048, we now explicitly set the build compiler for `check::Std`, which caused it to be built before we checked `--skip-std-check-if-no-download-rustc`. So I moved the check earlier to `make_run`, which resolves it.

I also added a regression test for this. Sadly we can't really test for the positive case easily (when download-ci-rustc is enabled), but we can test the negative cases, where it is disabled.

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

r? ```@RalfJung```
2025-07-10 20:20:39 -04:00
Trevor Gross
a5aff96d4d Rollup merge of #143642 - Kobzol:stdarch-push, r=Amanieu
stdarch subtree update

Subtree update of `stdarch` to b262a9af85.

Created using https://github.com/rust-lang/josh-sync.

r? ```@ghost```
2025-07-10 20:20:38 -04:00
Trevor Gross
6debe03634 Rollup merge of #140136 - dpaoliello:arm64winci, r=Kobzol
Add an aarch64-msvc build running on ARM64 Windows

Resurrecting rust-lang/rust#126341

Per <https://github.com/rust-lang/rfcs/pull/3817> we intend to promote `aarch64-pc-windows-msvc` to Tier 1. As part of that work, we are adding a pre-merge CI job to validate that changes do not break this target.

Additionally, for consistency, the `dist-aarch64-msvc` job will also be run on Arm64 Windows runners.

r? ``@Kobzol``

try-job: `*aarch64-msvc*`
2025-07-10 20:20:37 -04:00
Fluid
ed96f00682 fix typos in function names in the target_feature test 2025-07-11 02:27:39 +03:00
mejrs
a7bf5c4fa2 Split up the unknown_or_malformed_diagnostic_attributes lint 2025-07-11 01:24:24 +02:00
Chayim Refael Friedman
a28dffa703 Merge pull request #20228 from ChayimFriedman2/fix-use-display
fix: Fix display of `use<>` syntax
2025-07-10 21:19:38 +00:00
Chayim Refael Friedman
e6a8a133bf Fix display of use<> syntax 2025-07-11 00:08:24 +03:00
bors
2a023bf80a Auto merge of #143746 - matthiaskrgr:rollup-yaojj7t, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143446 (use `--dynamic-list` for exporting executable symbols)
 - rust-lang/rust#143590 (Fix weird rustdoc output when single and glob reexport conflict on a name)
 - rust-lang/rust#143599 (emit `.att_syntax` when global/naked asm use that option)
 - rust-lang/rust#143615 (Fix handling of no_std targets in `doc::Std` step)
 - rust-lang/rust#143632 (fix: correct parameter names in LLVMRustBuildMinNum and LLVMRustBuildMaxNum FFI declarations)
 - rust-lang/rust#143640 (Constify `Fn*` traits)
 - rust-lang/rust#143651 (Win: Use exceptions with empty data for SEH panic exception copies instead of a new panic)
 - rust-lang/rust#143660 (Disable docs for `compiler-builtins` and `sysroot`)
 - rust-lang/rust#143665 ([rustdoc-json] Add tests for `#[doc(hidden)]` handling of items.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-10 19:56:08 +00:00
Jens Reidel
a8663770c9 Add target maintainer information for aarch64-unknown-linux-musl
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-10 21:07:18 +02:00
Philipp Krones
c629a450d6 Add clippy_test_deps to workspace member of repo 2025-07-10 20:45:04 +02:00
Philipp Krones
69fca569eb Update Cargo.lock 2025-07-10 20:34:42 +02:00
Matthias Krüger
b5d1b92a8c Rollup merge of #143665 - obi1kenobi:pg/doc-hidden-tests, r=aDotInTheVoid
[rustdoc-json] Add tests for `#[doc(hidden)]` handling of items.

Add tests which check:
- `#[doc(hidden)]` items are not present in rustdoc JSON output by default.
- Invoking rustdoc with `--document-hidden-items` makes `#[doc(hidden)]` items appear, and they show their `#[doc(hidden)]` status appropriately.

r? `@aDotInTheVoid`
2025-07-10 20:28:51 +02:00
Matthias Krüger
6c4502d97d Rollup merge of #143660 - cuviper:lib-doc-false, r=tgross35
Disable docs for `compiler-builtins` and `sysroot`

Bootstrap already had a manual doc filter for the `sysroot` crate, but
other library crates keep themselves out of the public docs by setting
`[lib] doc = false` in their manifest. This seems like a better solution
to hide `compiler-builtins` docs, and removes the `sysroot` hack too.

Fixes rust-lang/rust#143215 (after backport)
```@rustbot``` label beta-nominated
2025-07-10 20:28:50 +02:00
Matthias Krüger
92f9480f8d Rollup merge of #143651 - Fulgen301:seh-exception-ptr, r=ChrisDenton
Win: Use exceptions with empty data for SEH panic exception copies instead of a new panic

For unwinding with SEH, we currently construct a C++ exception with the panic data. Being a regular C++ exception, it interacts with the C++ exception handling machinery and can be retrieved via `std::current_exception`, which needs to copy the exception. We can't support that, so we panic, which throws another exception, which the C++ runtime tries to copy and store into the exception_ptr, which panics again, which causes the C++ runtime to store a `bad_exception` instance.

However, this doesn't work because the panics thrown by the copy function will be dropped without being rethrown, and causes unnecessary log spam in stderr. Fix this by directly throwing an exception without data, which doesn't cause log spam and can be dropped without being rethrown.

Fixes rust-lang/rust#143623.

This also happens to be the solution ``@dpaoliello`` suggested, though I'm not sure how to handle the commit credit attribution.
2025-07-10 20:28:50 +02:00
Matthias Krüger
b4089bf417 Rollup merge of #143640 - oli-obk:const-fn-traits, r=compiler-errors
Constify `Fn*` traits

r? `@compiler-errors` `@fee1-dead`

this should unlock a few things. A few `const_closures` tests have broken even more than before, but that feature is marked as incomplete anyway

cc rust-lang/rust#67792
2025-07-10 20:28:49 +02:00
Matthias Krüger
95cbacd019 Rollup merge of #143632 - dillona:ffi-param-names, r=jieyouxu
fix: correct parameter names in LLVMRustBuildMinNum and LLVMRustBuildMaxNum FFI declarations
2025-07-10 20:28:48 +02:00
Matthias Krüger
55a57fcbac Rollup merge of #143615 - Kobzol:doc-std, r=jieyouxu
Fix handling of no_std targets in `doc::Std` step

The previous logic was wrong for no_std targets, it just didn't do anything. The logic was added there because by default, the `Std` step would otherwise have a list of all std crates to check, but these would fail for no_std targets. What has to happen instead is to select the default set of packages to check/doc/build, which currently happens in the `std_cargo` function, but the `self.crates` list was overriding that.

In general, using `crates: Vec<String>` in the `Std` steps is quite fishy, because it's difficult to distinguish between all crates (either they are all enumerated or `crates` is empty) and the default (e.g. `x <kind> [library]`) vs a subset (e.g. `x <kind> core`). I wanted to improve that using an enum that would distinguish these situations, avoid passing `-p` for all of the crates explicitly, and unify the selection of packages to compile/check/... in `std_cargo`, based on this enum.

However, I found out from some other bootstrap comments that when you pass `-p` explicitly for all crates, cargo behaves differently (apparently for check it will also check targets/examples etc. with `-p`, but not without it). Furthermore, the doc step has a special case where it does not document the `sysroot` package. So as usually, unifying this logic would get into some edge cases... So instead I opted for a seemingly simpler solution, where I try to prefilter only two allowed crates (core and alloc) for no_std targets in the `std_crates_for_run_make` function.

It's not perfect, but I think it's better than the status quo (words to live by when working on bootstrap...).

Fixes [this Zulip topic](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/docs.20for.20non-host.20targets.3F).

r? `@jieyouxu`
2025-07-10 20:28:48 +02:00
Matthias Krüger
9e6af56e12 Rollup merge of #143599 - folkertdev:x86-asm-syntax-global-naked-asm, r=Amanieu
emit `.att_syntax` when global/naked asm use that option

fixes https://github.com/rust-lang/rust/issues/143542

LLVM would error when using `-Cllvm-args=-x86-asm-syntax=intel` in combination with global/naked assembly with `att_syntax`. It turns out that for LLVM you do in this case need to emit `.att_syntax`.

r? `@Amanieu`
2025-07-10 20:28:47 +02:00