Commit Graph

284846 Commits

Author SHA1 Message Date
Vadim Petrochenkov
ba4190cf7e resolve: Avoid some unstable iteration 2 2025-03-24 23:03:11 +03:00
bors
4510e86a41 Auto merge of #138629 - Zoxc:graph-anon-hashmap, r=oli-obk
Only use the new node hashmap for anonymous nodes

This is a rebase of https://github.com/rust-lang/rust/pull/112469.

cc `@cjgillot`
2025-03-24 15:02:09 +00:00
bors
90f5eab952 Auto merge of #115747 - Zoxc:query-hashes, r=oli-obk
Optimize hash map operations in the query system

This optimizes hash map operations in the query system by explicitly passing hashes and using more optimal operations. `find_or_find_insert_slot` in particular saves a hash table lookup over `entry`. It's not yet available in a safe API, but will be in https://github.com/rust-lang/hashbrown/pull/466.

<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.6189s</td><td align="right">1.6129s</td><td align="right"> -0.37%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2353s</td><td align="right">0.2337s</td><td align="right"> -0.67%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9344s</td><td align="right">0.9289s</td><td align="right"> -0.59%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.4693s</td><td align="right">1.4652s</td><td align="right"> -0.28%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.6606s</td><td align="right">5.6439s</td><td align="right"> -0.30%</td></tr><tr><td>Total</td><td align="right">9.9185s</td><td align="right">9.8846s</td><td align="right"> -0.34%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9956s</td><td align="right"> -0.44%</td></tr></table>

r? `@cjgillot`
2025-03-24 11:40:33 +00:00
bors
b95aac6a98 Auto merge of #138878 - jieyouxu:revert-ci-llvm, r=dianqk
Revert "fix download-llvm logic for subtree sync branches #137593"

Reverts #137593.

Looks like unfortunately the `--diff-merges=first-parent` flag is a `git show`-only flag, not `git rev-list` which only accepts `--first-parent`.

See https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---first-parent which has `--first-parent`, versus https://git-scm.com/docs/git-show#Documentation/git-show.txt---diff-mergesltformatgt which has `--diff-merges=first-parent`.

This reverts commit 95994f94ff, reversing changes made to 7290b04b0a.

This will unfortunately re-open https://github.com/rust-lang/rust/issues/101907 but that isn't fixed anyway since the git invocation is broken.

cc `@RalfJung` `@Mark-Simulacrum` for FYI (but I would've written the same incorrect flag 💀)
r? `@onur-ozkan` (or bootstrap or infra or anyone really)
2025-03-24 07:25:53 +00:00
Jieyou Xu
c71569a765
Revert "Rollup merge of #137593 - RalfJung:subtree-sync-download-llvm, r=Mark-Simulacrum"
Looks like unfortunately the `--diff-merges` flag is a `git show`-only
command, not `git rev-list`.

This reverts commit 95994f94ff, reversing
changes made to 7290b04b0a.
2025-03-24 14:09:06 +08:00
bors
ae8ab87de4 Auto merge of #138873 - jhpratt:rollup-tggrbxl, r=jhpratt
Rollup of 10 pull requests

Successful merges:

 - #137593 (fix download-llvm logic for subtree sync branches)
 - #137736 (Don't attempt to export compiler-builtins symbols from rust dylibs)
 - #138135 (Simplify `PartialOrd` on tuples containing primitives)
 - #138321 ([bootstrap] Distribute split debuginfo if present)
 - #138574 (rustdoc: be more strict about "Methods from Deref")
 - #138606 (Fix missing rustfmt in msi installer - cont)
 - #138671 (Fix `FileType` `PartialEq` implementation on Windows)
 - #138728 (Update `compiler-builtins` to 0.1.152)
 - #138783 (Cache current_dll_path output)
 - #138846 (Tweaks to writeback and `Obligation -> Goal` conversion)

Failed merges:

 - #138755 ([rustdoc] Remove duplicated loop when computing doc cfgs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-24 01:03:21 +00:00
Jacob Pratt
0e95f962d9
Rollup merge of #138846 - compiler-errors:stall-prereqs, r=lcnr
Tweaks to writeback and `Obligation -> Goal` conversion

Each of these commits are self-contained, but are prerequisites that I'd like to land before #138845, which still needs some cleaning.

The ""most controversial"" one is probably [Explicitly don't fold coroutine obligations in writeback](e7d27bae27), which I prefer because I think using `fold_predicate` to control against not normalizing predicates seems... easy to mess up 🤔, and we could have *other things* that we don't want to normalize.

Explicitly noting whether we want `resolve` to normalize is a lot clearer (and currently in writeback is limited to resolving stalled coroutine obligations), since we can attach it to a comment that explains *why*.
2025-03-23 20:44:13 -04:00
Jacob Pratt
ab138e6aa8
Rollup merge of #138783 - bjorn3:cache_current_dll_path, r=lqd
Cache current_dll_path output

Computing the current dll path is somewhat expensive relative to other work when compiling `fn main() {}` as `dladdr` needs to iterate over the symbol table of librustc_driver.so until it finds a match.
2025-03-23 20:44:12 -04:00
Jacob Pratt
b406d9aaaa
Rollup merge of #138728 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.152

Includes the following changes related to unordered atomics:

* Remove element_unordered_atomic intrinsics [1]
* Remove use of `atomic_load_unordered` and undefined behaviour [2]

There are a handful of other small changes, but nothing else user-visible.

[1]: https://github.com/rust-lang/compiler-builtins/pull/789
[2]: https://github.com/rust-lang/compiler-builtins/pull/790
2025-03-23 20:44:12 -04:00
Jacob Pratt
8e30df7f26
Rollup merge of #138671 - ChrisDenton:filetype, r=joshtriplett
Fix `FileType` `PartialEq` implementation on Windows

Fixes #138668

On Windows the [`FileType`](https://doc.rust-lang.org/stable/std/fs/struct.FileType.html) struct was deriving `PartialEq` which in turn means it was doing a bit-for-bit comparison on the file attributes and reparse point. This is wrong because `attributes` may contain many things unrelated to file type.

`FileType` on Windows allows for four possible combinations (see also [`FileTypeExt`](https://doc.rust-lang.org/stable/std/os/windows/fs/trait.FileTypeExt.html)): `file`, `dir`, `symlink_file` and `symlink_dir`. So the new implementation makes sure both symlink and directory information match (and only those things).

This could be considered just a bug fix but it is a behaviour change so someone from libs-api might want to FCP this (or might not)...
2025-03-23 20:44:11 -04:00
Jacob Pratt
0fc6279ce9
Rollup merge of #138606 - heiseish:131365-extended, r=Mark-Simulacrum
Fix missing rustfmt in msi installer - cont

## Context
- This PR extended and fixed https://github.com/rust-lang/rust/pull/131365, which was reverted in https://github.com/rust-lang/rust/pull/135253
- Initial effort from `@klensy` in https://github.com/rust-lang/rust/pull/135255 (at any points if you feel like picking this up again, let me know I'll close my PR! Just trying to push this through since it's my mistake in the original commits)
- Tested with both `beta` and `nightly` `rust.channel`

r? `@Mark-Simulacrum`
2025-03-23 20:44:11 -04:00
Jacob Pratt
abc67849a8
Rollup merge of #138574 - lolbinarycat:rustdoc-deref-24686-v2, r=GuillaumeGomez
rustdoc: be more strict about "Methods from Deref"

fixes #137083
fixes #24686

Currently done:
* [x] fix `render_assoc_items_inner
* [x] fix sidebar logic
* [x] port test from https://github.com/rust-lang/rust/pull/137564
* [x] add test for sidebar items

Note that this does not yet fix the sidebar logic.
2025-03-23 20:44:10 -04:00
Jacob Pratt
66f2a19676
Rollup merge of #138321 - wesleywiser:bootstrap_package_pdbs, r=onur-ozkan
[bootstrap] Distribute split debuginfo if present

If debuginfo has been requested in `config.toml`, it should be packaged alongside the appropriate binary when running `x.py dist`.

Currently, this is only implemented for msvc environments where split debuginfo is (basically) the only option. I've tested that this correctly packages the `.pdb` for each binary in the various dist packages.
2025-03-23 20:44:09 -04:00
Jacob Pratt
1ba9b7873a
Rollup merge of #138135 - scottmcm:chaining-ord, r=Mark-Simulacrum
Simplify `PartialOrd` on tuples containing primitives

We noticed in https://github.com/rust-lang/rust/pull/133984#issuecomment-2704011800 that currently the tuple comparison code, while it [does optimize down](https://github.com/rust-lang/rust/blob/master/tests/codegen/comparison-operators-2-tuple.rs) today, is kinda huge: <https://rust.godbolt.org/z/xqMoeYbhE>

This PR changes the tuple code to go through an overridable "chaining" version of the comparison functions, so that for simple things like `(i16, u16)` and `(f32, f32)` (as seen in the new MIR pre-codegen test) we just directly get the
```rust
if lhs.0 == rhs.0 { lhs.0 OP rhs.0 }
else { lhs.1 OP rhs.1 }
```
version in MIR, rather than emitting a mess for LLVM to have to clean up.

Test added in the first commit, so you can see the MIR diff in the second one.
2025-03-23 20:44:09 -04:00
Jacob Pratt
9a243cf7d3
Rollup merge of #137736 - bjorn3:compiler_builtins_export_fix, r=petrochenkov
Don't attempt to export compiler-builtins symbols from rust dylibs

They are marked with hidden visibility to prevent them from getting exported, so we shouldn't ask the linker to export them anyway. The only thing that does it cause a warning on macOS.

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

cc `@jyn514`
2025-03-23 20:44:08 -04:00
Jacob Pratt
95994f94ff
Rollup merge of #137593 - RalfJung:subtree-sync-download-llvm, r=Mark-Simulacrum
fix download-llvm logic for subtree sync branches

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

Cc `@onur-ozkan`
r? `@Mark-Simulacrum`
2025-03-23 20:44:08 -04:00
Trevor Gross
95181ae170 Update compiler-builtins to 0.1.152
Includes the following changes related to unordered atomics:

* Remove element_unordered_atomic intrinsics [1]
* Remove use of `atomic_load_unordered` and undefined behaviour [2]

There are a handful of other small changes, but nothing else
user-visible.

[1]: https://github.com/rust-lang/compiler-builtins/pull/789
[2]: https://github.com/rust-lang/compiler-builtins/pull/790
2025-03-24 00:29:21 +00:00
Scott McMurray
7781346243 Stop using specialization for this
Uses `__`-named `doc(hidden)` methods instead.
2025-03-23 15:27:31 -07:00
bors
7290b04b0a Auto merge of #138866 - compiler-errors:rollup-9d8v3mz, r=compiler-errors
Rollup of 12 pull requests

Successful merges:

 - #136040 (Remove unused trait BoundedSize)
 - #138236 (uefi: Add OwnedEvent abstraction)
 - #138293 (rustdoc: Gate unstable `doc(cfg())` predicates)
 - #138509 (Add test to ensure no index out of bounds panic (#135474))
 - #138545 (Add MIR pre-codegen tests to track #138544)
 - #138631 (Update test for SGX now implementing `read_buf`)
 - #138641 (Add unstable `--print=supported-crate-types` option)
 - #138667 (std: uefi: fs: Implement mkdir)
 - #138849 (doc: rename reference #create-a-configtoml to #create-a-bootstraptoml)
 - #138854 (Fix ICE #138415 for invalid extern function body)
 - #138858 (Say which test failed the `COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS` assertion)
 - #138861 (Tweak type flags, fix missing flags from coroutine kind ty)

Failed merges:

 - #138755 ([rustdoc] Remove duplicated loop when computing doc cfgs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-23 20:59:14 +00:00
Michael Goulet
045a1c78ae
Rollup merge of #138861 - compiler-errors:flags-tweaks, r=lcnr
Tweak type flags, fix missing flags from coroutine kind ty

Firstly, make sure we visit the coroutine kind ty. Since this kind ty is either infer (before upvar computation), or `()` or `i8`/`i16`/`i32`, this isn't really that big of a deal, since other types in the coroutine will also be infer, so we're not misreporting `ty.has_infer()` or anything, but it's still wrong not to do this.

Furthermore, remove `HAS_TY_COROUTINE`, since nobody used it, and also remove special casing for `STILL_FURTHER_SPECIALIZABLE` since it's likely not important anymore? I have a vague recollection that it was important for polymorphization(?), but no tests seem to rely on this behavior.

r? lcnr or reassign
2025-03-23 14:59:36 -04:00
Michael Goulet
db52a4a030
Rollup merge of #138858 - jieyouxu:ct-llvm-components, r=onur-ozkan
Say which test failed the `COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS` assertion

Closes #138857.

This is of course a spot fix. The general problem requires reworking compiletest directive handling's diagnostics logic.
2025-03-23 14:59:35 -04:00
Michael Goulet
1e023420f9
Rollup merge of #138854 - TaKO8Ki:invalid-extern-fn-body, r=compiler-errors
Fix ICE #138415 for invalid extern function body

Fixes #138415
2025-03-23 14:59:35 -04:00
Michael Goulet
93e53139fe
Rollup merge of #138849 - chiichen:dev/master/doc-correct-configtoml, r=TaKO8Ki
doc: rename reference #create-a-configtoml to #create-a-bootstraptoml

e4ddc21c8a This commit renamed `config.toml` to `bootstrap.toml`.
2025-03-23 14:59:34 -04:00
Michael Goulet
f4096dcda8
Rollup merge of #138667 - Ayush1325:uefi-mkdir, r=joboet
std: uefi: fs: Implement mkdir

- Since there is no direct mkdir in UEFI, first check if a file/dir with same path exists and then create the directory.

cc `@dvdhrm` `@nicholasbishop`
2025-03-23 14:59:33 -04:00
Michael Goulet
21cdebcf4e
Rollup merge of #138641 - jieyouxu:print-supported-crate-types, r=Urgau
Add unstable `--print=supported-crate-types` option

MCP: https://github.com/rust-lang/compiler-team/issues/836
Tracking issue: https://github.com/rust-lang/rust/issues/138640

### Test coverage

Two tests:

1. `tests/ui/print-request/stability.rs` to check that `--print=supported-crate-types` is `-Zunstable-options`-gated
2. `tests/ui/print-request/supported-crate-types.rs` is added as a basic smoke test. Observe that the compiler stdout corresponds to the below *Example output* section (e.g. `proc-macro` is unsupported on `wasm32-unknown-unknown` currently).

### Example output

<details>
<summary>For `x86_64-unknown-linux-gnu`</summary>

Notice the presence of `{c,}dylib` and `proc-macro`:
```
bin
cdylib
dylib
lib
proc-macro
rlib
staticlib
```
</details>

<details>
<summary>For `wasm32-unknown-unknown`</summary>

Notice the absence of `dylib` and `proc-macro`:
```
bin
cdylib
lib
rlib
staticlib
```
</details>

<details>
<summary>For `x86_64-unknown-linux-musl`</summary>

Notice the absence of `{c,}dylib` but presence of `proc-macro`:
```
bin
lib
proc-macro
rlib
staticlib
```
</details>

### Documentation

I added an entry in the unstable book's print request section to document this `supported-crate-types` print request.

### Unresolved questions

- [ ] (Name bikeshedding) is `supported-crate-types` a good name for the print request? I'm inclined to say it's good enough for an unstable print request, but may be worth revisiting at stabilization time.

### Stability

This print request being added is *unstable* in this PR. A separate stabilization PR following the usual compiler flag stabilization procedure should be filed for stabilization after some baking time.

### Review remarks

Best reviewed commit-by-commit.

r? compiler
2025-03-23 14:59:33 -04:00
Michael Goulet
bb49f0d8b6
Rollup merge of #138631 - thaliaarchi:sgx-read-buf-test, r=workingjubilee
Update test for SGX now implementing `read_buf`

In #108326, `read_buf` was implemented for a variety of types, but SGX was saved for later. Update a test from then, now that #137355 implemented it for SGX types.

cc ````@jethrogb````
2025-03-23 14:59:32 -04:00
Michael Goulet
e31d3e3bde
Rollup merge of #138545 - scottmcm:more-option-tests, r=Mark-Simulacrum
Add MIR pre-codegen tests to track #138544

I don't know how best to fix the problem yet, but wanted to check in some tests to demonstrate it and make sure that they get updated to keep it fixed if anyone does fix it 🙂

No code changes; just the tests for #138544.
2025-03-23 14:59:32 -04:00
Michael Goulet
6756e3da5a
Rollup merge of #138509 - reddevilmidzy:add-test, r=compiler-errors
Add test to ensure no index out of bounds panic (#135474)

Adds test for #135474
2025-03-23 14:59:31 -04:00
Michael Goulet
856ba39bd9
Rollup merge of #138293 - clubby789:doc-cfg-gate, r=GuillaumeGomez
rustdoc: Gate unstable `doc(cfg())` predicates

Fixes #138113

Since the extraction process treats `cfg(true)` as having no cfg attribute, we have to do the gating during parsing; so we remove the unused `features` arg from `Cfg::matches`
2025-03-23 14:59:30 -04:00
Michael Goulet
d7c5f5f319
Rollup merge of #138236 - Ayush1325:uefi-event, r=petrochenkov
uefi: Add OwnedEvent abstraction

- Events are going to become quite important for Networking, so needed owned abstractions.
- Switch to OwnedEvent abstraction for Exit boot services event.

cc ````@nicholasbishop````
2025-03-23 14:59:30 -04:00
Michael Goulet
145fe2d648
Rollup merge of #136040 - mu001999-contrib:cleanup, r=Mark-Simulacrum
Remove unused trait BoundedSize

Detected by #128637

The usage of this trait is removed in #135104

r? `@the8472`
2025-03-23 14:59:29 -04:00
Michael Goulet
fad34c603c Explicitly don't fold coroutine obligations in writeback 2025-03-23 18:34:33 +00:00
Michael Goulet
d588bc2a2b Don't super fold const in Resolver 2025-03-23 18:18:47 +00:00
Michael Goulet
575f129faa Obligation::as_goal 2025-03-23 18:18:47 +00:00
Michael Goulet
77a106e61f Remove STILL_FURTHER_SPECIALIZABLE special casing 2025-03-23 18:13:52 +00:00
Michael Goulet
e4f13e3ccd Remove HAS_TY_COROUTINE 2025-03-23 18:03:09 +00:00
Michael Goulet
e934975339 Visit coroutine kind ty in FlagComputation 2025-03-23 18:03:09 +00:00
bors
aa8f0fd716 Auto merge of #136929 - joboet:move_process_pal, r=Mark-Simulacrum
std: move process implementations to `sys`

As per #117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
2025-03-23 14:10:35 +00:00
Jieyou Xu
f10b58714e
Say which test failed the COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS assertion 2025-03-23 19:28:33 +08:00
Jieyou Xu
f2cde8eeb4
Adjust rustc-print-info-issue-138612.rs
- Document test intent to check for `-Whelp` suggestion if
  `--print=lints` was specified.
- Move this test under `tests/ui/print-request/` and rename it to
  `print-lints-help.rs` to better reflect what it is checking.
2025-03-23 19:08:56 +08:00
Jieyou Xu
f1b8d89659
Rebless tests with changed help due to new print request option 2025-03-23 19:08:55 +08:00
Jieyou Xu
13530afc08
Document supported-crate-types print request in unstable book 2025-03-23 19:08:55 +08:00
Jieyou Xu
0e7dbab1fc
Implement supported-crate-types print request
As an unstable print request.
2025-03-23 19:08:54 +08:00
bors
97fc1f62d8 Auto merge of #138602 - Veykril:push-purxoytpktpu, r=SparrowLii
Slim `rustc_parse_format` dependencies down

`rustc_index` is only used for its size assertion macro, so demote it to a dev-dependency gated under testing instead. This allows the crate to built without having to wait for `syn` (pulled in by `rustc_index_macros`)

Alternatively we could inline the macro, though from the looks of it that will run into trouble with `rustc_randomized_layouts`
2025-03-23 10:00:10 +00:00
Takayuki Maeda
34b7d51b95 fix typo 2025-03-23 17:47:10 +09:00
Takayuki Maeda
20f4a0d586 fix ICE #138415 2025-03-23 17:02:42 +09:00
Lukas Wirth
5950c862bd Slim rustc_parse_format dependencies down
`rustc_index` is only used for its size assertion macro, so demote it to a dev-dependency gated under testing instead
2025-03-23 07:30:18 +01:00
bors
60a3084f64 Auto merge of #136769 - thaliaarchi:io-optional-methods/stdio, r=joboet
Provide optional `Read`/`Write` methods for stdio

Override more of the default methods for `io::Read` and `io::Write` for stdio types, when efficient to do so, and deduplicate unsupported types.

Tracked in https://github.com/rust-lang/rust/issues/136756.

try-job: x86_64-msvc-1
2025-03-23 06:23:51 +00:00
Chiichen
fa0c951a27 doc: rename reference #create-a-configtoml to #create-a-bootstraptoml 2025-03-23 12:41:23 +08:00
bors
f08d5c01e6 Auto merge of #138833 - joboet:optimize-repeat-n, r=thomcc
core: optimize `RepeatN`

...by adding an optimized implementation of `try_fold` and `fold` as well as replacing some unnecessary `mem::replace` calls with `MaybeUninit` helper methods.
2025-03-23 03:11:13 +00:00