Skip to content

Rollup of 15 pull requests #144398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Jul 24, 2025
Merged

Rollup of 15 pull requests #144398

merged 30 commits into from
Jul 24, 2025

Conversation

fmease
Copy link
Member

@fmease fmease commented Jul 24, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

dianne and others added 30 commits July 16, 2025 01:44
The previous manual parsing of `serde_json::Value` was a lot of
complicated code and extremely error-prone. It was full of janky
behavior like sometimes ignoring type errors, sometimes erroring for
type errors, sometimes warning for type errors, and sometimes just
ICEing for type errors (the icing on the top).

Additionally, many of the error messages about allowed values were out
of date because they were in a completely different place than the
FromStr impls. Overall, the system caused confusion for users.

I also found the old deserialization code annoying to read. Whenever a
`key!` invocation was found, one had to first look for the right macro
arm, and no go to definition could help.

This PR replaces all this manual parsing with a 2-step process involving
serde.
First, the string is parsed into a `TargetSpecJson` struct. This struct
is a 1:1 representation of the spec JSON. It already parses all the
enums and is very simple to read and write.
Then, the fields from this struct are copied into the actual `Target`.
The reason for this two-step process instead of just serializing into a
`Target` is because of a few reasons

 1. There are a few transformations performed between the two formats
 2. The default logic is implemented this way. Otherwise all the default
    field values would have to be spelled out again, which is
    suboptimal. With this logic, they fall out naturally, because
    everything in the json struct is an `Option`.

Overall, the mapping is pretty simple, with the vast majority of fields
just doing a 1:1 mapping that is captured by two macros. I have
deliberately avoided making the macros generic to keep them simple.

All the `FromStr` impls now have the error message right inside them,
which increases the chance of it being up to date. Some "`from_str`"
impls were turned into proper `FromStr` impls to support this.

The new code is much less involved, delegating all the JSON parsing
logic to serde, without any manual type matching.

This change introduces a few breaking changes for consumers. While it is
possible to use this format on stable, it is very much subject to
change, so breaking changes are expected. The hope is also that because
of the way stricter behavior, breaking changes are easier to deal with,
as they come with clearer error messages.

1. Invalid types now always error, everywhere. Previously, they would
   sometimes error, and sometimes just be ignored (which meant the users
   JSON was still broken, just silently!)
2. This now makes use of `deny_unknown_fields` instead of just warning
   on unused fields, which was done previously. Serde doesn't make it
   easy to get such warning behavior, which was the primary reason that
   this now changed. But I think error behavior is very reasonable too.
   If someone has random stale fields in their JSON, it is likely
   because these fields did something at some point but no longer do,
   and the user likely wants to be informed of this so they can figure
   out what to do.

   This is also relevant for the future. If we remove a field but
   someone has it set, it probably makes sense for them to take a look
   whether they need this and should look for alternatives, or whether
   they can just delete it. Overall, the JSON is made more explicit.

This is the only expected breakage, but there could also be small
breakage from small mistakes. All targets roundtrip though, so it can't
be anything too major.
…nsion

This function can cause false negatives if used incorrectly
(usually "do any of the doc fragments come from a macro" is
the wrong question to ask), and thus it is unused.
- Use EFI_TCP4_GET_MODE_DATA to be able to query for ttl, nodelay,
  peer_addr and socket_addr.
- peer_addr is needed for implementation of `accept`.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
…petrochenkov

Unquerify extern_mod_stmt_cnum.

Based on rust-lang#143247
r? `````@ghost````` for perf
…=tgross35

std: net: uefi: Add support to query connection data

- Use EFI_TCP4_GET_MODE_DATA to be able to query for ttl, nodelay, peer_addr and socket_addr.
- peer_addr is needed for implementation of `accept`.
- cc `````@nicholasbishop`````
- Also a heads up. The UEFI spec seems to be wrong or something for [EFI_TCP4_CONFIG_DATA](https://uefi.org/specs/UEFI/2.11/28_Network_Protocols_TCP_IP_and_Configuration.html#efi-tcp4-protocol-getmodedata). `ControlOption` should be a pointer as seen in [edk2](https://github.com/tianocore/edk2/blob/a1b509c1a453815acbc6c8b0fc5882fd03a6f2c0/MdePkg/Include/Protocol/Tcp4.h#L97).
…bank

don't link to the nightly version of the Edition Guide in stable lints

As reported in rust-lang#143557 for `rust_2024_incompatible_pat`, most future-Edition-incompatibility lints link to the nightly version of the Edition Guide; the lints were written before their respective Editions (and their guides) stabilized. But now that Rusts 2021 and 2024 are stable, these lints are emitted on stable versions of the compiler, where it makes more sense to present users with links that don't say "nightly" in them.

This does not change the link for `rust_2024_incompatible_pat`. That's handled in rust-lang#144006.
…trochenkov

Ensure we codegen the main fn

This fixes two bugs. The one that was identified in the linked issue is that when we have a `main` function, mono collection didn't consider it as an extra collection root.

The other is that since CGU partitioning doesn't  know about the call edges between the entrypoint functions, naively it can put them in different CGUs and mark them all as internal. Which would result in LLVM just deleting all of them. There was an existing hack to exclude `lang = "start"` from internalization, which I've extended to include `main`.

Fixes rust-lang#144052
…, r=fee1-dead

Use serde for target spec json deserialize

The previous manual parsing of `serde_json::Value` was a lot of complicated code and extremely error-prone. It was full of janky behavior like sometimes ignoring type errors, sometimes erroring for type errors, sometimes warning for type errors, and sometimes just ICEing for type errors (the icing on the top).

Additionally, many of the error messages about allowed values were out of date because they were in a completely different place than the FromStr impls. Overall, the system caused confusion for users.

I also found the old deserialization code annoying to read. Whenever a `key!` invocation was found, one had to first look for the right macro arm, and no go to definition could help.

This PR replaces all this manual parsing with a 2-step process involving serde.
First, the string is parsed into a `TargetSpecJson` struct. This struct is a 1:1 representation of the spec JSON. It already parses all the enums and is very simple to read and write.
Then, the fields from this struct are copied into the actual `Target`. The reason for this two-step process instead of just serializing into a `Target` is because of a few reasons

 1. There are a few transformations performed between the two formats
 2. The default logic is implemented this way. Otherwise all the default field values would have to be spelled out again, which is suboptimal. With this logic, they fall out naturally, because everything in the json struct is an `Option`.

Overall, the mapping is pretty simple, with the vast majority of fields just doing a 1:1 mapping that is captured by two macros. I have deliberately avoided making the macros generic to keep them simple.

All the `FromStr` impls now have the error message right inside them, which increases the chance of it being up to date. Some "`from_str`" impls were turned into proper `FromStr` impls to support this.

The new code is much less involved, delegating all the JSON parsing logic to serde, without any manual type matching.

This change introduces a few breaking changes for consumers. While it is possible to use this format on stable, it is very much subject to change, so breaking changes are expected. The hope is also that because of the way stricter behavior, breaking changes are easier to deal with, as they come with clearer error messages.

1. Invalid types now always error, everywhere. Previously, they would sometimes error, and sometimes just be ignored (which meant the users JSON was still broken, just silently!)
2. This now makes use of `deny_unknown_fields` instead of just warning on unused fields, which was done previously. Serde doesn't make it easy to get such warning behavior, which was the primary reason that this now changed. But I think error behavior is very reasonable too. If someone has random stale fields in their JSON, it is likely because these fields did something at some point but no longer do, and the user likely wants to be informed of this so they can figure out what to do.

   This is also relevant for the future. If we remove a field but someone has it set, it probably makes sense for them to take a look whether they need this and should look for alternatives, or whether they can just delete it. Overall, the JSON is made more explicit.

This is the only expected breakage, but there could also be small breakage from small mistakes. All targets roundtrip though, so it can't be anything too major.

fixes rust-lang#144153
generate elf symbol version in raw-dylib

For link names like `aaa@bbb`, it generates a symbol named `aaa` and a version named `bbb`.

For link names like `aaa\0bbb`, `aaa@`@bbb`` or `aa@bb@cc`, it emits errors.

It adds a test that the executable is linked with glibc using raw-dylib.

cc rust-lang#135694
…ported-in-another-issue, r=fee1-dead

Add more test case to check if the false note related to sealed trait suppressed

Closes rust-lang#143121

I started to fix the issue but I found that this one has already been addressed in this PR (rust-lang#143431). I added an additional test to prove the reported thing has been resolved just in case.

I think we can discard this pull request if there's no need to add such kind of tests👍🏻
coretests/num: use ldexp instead of hard-coding a power of 2

r? `````@tgross35`````
…enkov

Use less HIR in check_private_in_public.

r? ````````@petrochenkov````````
…r=Kobzol

pass build.npm from bootstrap to tidy and use it for npm install

followup to rust-lang#142924

r? ```@Kobzol```
…BTreeMap-str, r=GuillaumeGomez

rustdoc: avoid allocating a temp String for aliases in search index

Here's the optimization I talked about in rust-lang#143988 (comment)

I got around the Serialize issue using the newtype pattern.  The wrapper type could be factored out into a helper that would work with anything that impls `AsRef<&str>`, but I'm not sure if that would be helpful anywhere else.

r? ``````@GuillaumeGomez``````
…ents-revert, r=GuillaumeGomez

rustc_resolve: get rid of unused rustdoc::span_of_fragments_with_expansion

This function can cause false negatives if used incorrectly (usually "do any of the doc fragments come from a macro" is the wrong question to ask), and thus it is unused.

r? `````@GuillaumeGomez`````
…wLii

Don't suggest assoc ty bound on non-angle-bracketed problematic assoc ty binding

Fixes rust-lang#140543.
…ormed, r=oli-obk

Stop using the old `validate_attr` logic for stability attributes

I think this was accidentally missed when implementing the stability attributes?

r? `````@oli-obk`````
cc `````@jdonszelmann`````
@rustbot rustbot added T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. rollup A PR which is a rollup labels Jul 24, 2025
@fmease
Copy link
Member Author

fmease commented Jul 24, 2025

@bors r+ p=5 rollup=never

@bors
Copy link
Collaborator

bors commented Jul 24, 2025

📌 Commit 6dc4152 has been approved by fmease

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 24, 2025
@fmease
Copy link
Member Author

fmease commented Jul 24, 2025

No checks 🙄 thanks GH!

@fmease fmease closed this Jul 24, 2025
@fmease fmease reopened this Jul 24, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 24, 2025
@fmease
Copy link
Member Author

fmease commented Jul 24, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 24, 2025

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Collaborator

bors commented Jul 24, 2025

📌 Commit 6dc4152 has been approved by fmease

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 24, 2025
@bors
Copy link
Collaborator

bors commented Jul 24, 2025

⌛ Testing commit 6dc4152 with merge 246733a...

@bors
Copy link
Collaborator

bors commented Jul 24, 2025

☀️ Test successful - checks-actions
Approved by: fmease
Pushing 246733a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 24, 2025
@bors bors merged commit 246733a into rust-lang:master Jul 24, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 24, 2025
@fmease fmease deleted the rollup-z6vq7mi branch July 24, 2025 20:38
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 5d22242 (parent) -> 246733a (this PR)

Test differences

Show 21 test diffs

Stage 1

  • [ui] tests/ui/entry-point/imported_main_local_codegen.rs: [missing] -> pass (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/empty.rs: [missing] -> pass (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs: [missing] -> pass (J1)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.rs: [missing] -> pass (J1)
  • errors::verify_metadata_raw_dylib_malformed_81: [missing] -> pass (J4)
  • tests::no_warnings_for_valid_target: pass -> [missing] (J4)
  • tests::report_incorrect_json_type: pass -> [missing] (J4)

Stage 2

  • [ui] tests/ui/linkage-attr/raw-dylib/elf/empty.rs: [missing] -> ignore (only executed when the target is x86_64-unknown-linux-gnu) (J0)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs: [missing] -> ignore (only executed when the target is x86_64-unknown-linux-gnu) (J0)
  • [ui] tests/ui/entry-point/imported_main_local_codegen.rs: [missing] -> pass (J2)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/empty.rs: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs: [missing] -> pass (J3)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.rs: [missing] -> ignore (only executed when the target binary format is ELF) (J5)
  • [ui] tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.rs: [missing] -> pass (J6)

Additionally, 7 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 246733a3d978de41c5b77b8120ba8f41592df9f1 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-1: 15027.8s -> 8217.1s (-45.3%)
  2. dist-aarch64-apple: 7959.2s -> 5626.4s (-29.3%)
  3. x86_64-apple-2: 4666.8s -> 5631.1s (20.7%)
  4. aarch64-msvc-2: 5350.9s -> 5842.1s (9.2%)
  5. dist-x86_64-apple: 10506.4s -> 11440.3s (8.9%)
  6. aarch64-apple: 5694.7s -> 5205.7s (-8.6%)
  7. dist-various-2: 3093.3s -> 3341.5s (8.0%)
  8. tidy: 104.6s -> 112.0s (7.1%)
  9. dist-x86_64-netbsd: 4912.9s -> 4604.9s (-6.3%)
  10. dist-apple-various: 8462.3s -> 7967.2s (-5.9%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#143374 Unquerify extern_mod_stmt_cnum. 83a2eb9231335a3b5a7912491dc31c666e3e5cf0 (link)
#143838 std: net: uefi: Add support to query connection data d3fb8c8dfa2f59277a055373ffb10e1af814d358 (link)
#144014 don't link to the nightly version of the Edition Guide in s… f54ea3cbc7845d54796548936082ebf69ef9576a (link)
#144094 Ensure we codegen the main fn aceeb4b625fc3b0cb7589521f580ffe976fa758f (link)
#144218 Use serde for target spec json deserialize cabe12f5825a3a8ea7f709114043adacfb92f215 (link)
#144221 generate elf symbol version in raw-dylib b01460c4338778c0fb4a2fff94973dc6074d5c48 (link)
#144240 Add more test case to check if the false note related to se… 972b49c67d976dbeb055af3719a31250be058821 (link)
#144247 coretests/num: use ldexp instead of hard-coding a power of 2 b9cbd88d4700fdf0f8aea168c0f71d9d05b3a981 (link)
#144276 Use less HIR in check_private_in_public. 54e02f3d49a82790e575de91fa4a8bb8123ecc2e (link)
#144278 add Rev::into_inner 2947980ddab9d788f3ead38839fc8b2b517ec3e6 (link)
#144317 pass build.npm from bootstrap to tidy and use it for npm in… 3de5c86cc47a92e64aecde71b8f66109d0ad9816 (link)
#144320 rustdoc: avoid allocating a temp String for aliases in sear… 684bbdb8a86a3b5b35c5468a19360fd7f65c1f17 (link)
#144334 rustc_resolve: get rid of unused rustdoc::span_of_fragments… 663623aec8afdd2de22972ce7caf3ebd92cccb44 (link)
#144335 Don't suggest assoc ty bound on non-angle-bracketed problem… 69bf8bcb469d22304faf3a36e0332fca85617268 (link)
#144358 Stop using the old validate_attr logic for stability attr… bc094baa2587fad013d722c472bf5fcc7d87c8ef (link)

previous master: 5d22242a3a

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (246733a): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 3
Regressions ❌
(secondary)
0.2% [0.0%, 0.2%] 3
Improvements ✅
(primary)
-0.4% [-0.8%, -0.1%] 14
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.1%] 21
All ❌✅ (primary) -0.3% [-0.8%, 0.4%] 17

Max RSS (memory usage)

Results (primary -1.6%, secondary 2.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.0% [1.0%, 5.3%] 5
Improvements ✅
(primary)
-1.6% [-1.6%, -1.6%] 1
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) -1.6% [-1.6%, -1.6%] 1

Cycles

Results (primary -2.2%, secondary -0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
-2.2% [-2.4%, -2.0%] 3
Improvements ✅
(secondary)
-1.9% [-2.8%, -1.1%] 2
All ❌✅ (primary) -2.2% [-2.4%, -2.0%] 3

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 466.913s -> 469.69s (0.59%)
Artifact size: 374.67 MiB -> 374.65 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.