Rustc pull update - #2952
Open
workflows-rustc-dev-guide[bot] wants to merge 170 commits into
Open
Conversation
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@045b177 Filtered ref: rust-lang/miri@729eed7 Upstream diff: rust-lang/rust@44860d3...045b177 This merge was created using https://github.com/rust-lang/josh-sync.
Automatic Rustup
…-connected-sockets Add `getsockname` shim for connecting and connected sockets
Add epoll integration for network sockets
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@4ddd453 Filtered ref: rust-lang/miri@99593b4 Upstream diff: rust-lang/rust@045b177...4ddd453 This merge was created using https://github.com/rust-lang/josh-sync.
Automatic Rustup
Add basic `getsockopt` shim for reading `SO_ERROR`
Remove `TcpStream::peer_addr` check for network sockets, test epoll readiness for `shutdown`
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@c8c4c83 Filtered ref: rust-lang/miri@75beaba Upstream diff: rust-lang/rust@63b1dfc...c8c4c83 This merge was created using https://github.com/rust-lang/josh-sync.
Automatic Rustup
…ions Support TTL and TCP nodelay socket options
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@281c97c Filtered ref: rust-lang/miri@bbdb123 Upstream diff: rust-lang/rust@c8c4c83...281c97c This merge was created using https://github.com/rust-lang/josh-sync.
Automatic Rustup
…nnect-err Fix `connect` of blocking TCP sockets always returning `ENOTCONN` on error
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@1f8e04d Filtered ref: rust-lang/miri@455eb04 Upstream diff: rust-lang/rust@281c97c...1f8e04d This merge was created using https://github.com/rust-lang/josh-sync.
Automatic Rustup
…tmp-buffer-readv Fix deallocating temporary buffer on failed `readv`
…r-windows Fix skipping TCP write buffer filling on Windows hosts
ci: declare contents:read on Tier 2 sysroots workflow
Add network socket read and write timeout
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@8f02e85 Filtered ref: rust-lang/miri@f11795e Upstream diff: rust-lang/rust@1f8e04d...8f02e85 This merge was created using https://github.com/rust-lang/josh-sync.
Automatic Rustup
flock tests: cover the case of asking for both locks on the same file handle
Add support for level-triggered epoll
add shim for `neon.pmull64`
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@bef8e62 Filtered ref: rust-lang/miri@3cc9654 Upstream diff: rust-lang/rust@6368fd5...bef8e62 This merge was created using https://github.com/rust-lang/josh-sync.
windows shims: avoid returning possibly outdated metadata
[Priroda] initial standalone CLI crate
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@76dfce2 Filtered ref: rust-lang/miri@d3a4cd9 Upstream diff: rust-lang/rust@4f84d9f...76dfce2 This merge was created using https://github.com/rust-lang/josh-sync.
Automatic Rustup
rustc: Support `--jobs` options for limiting parallelism in various parts of the compiler `--jobs-frontend` for the frontend, `--jobs-backend` for the backend, `--jobs-linker` for the linker, and `-j`/`--jobs` for the overall limit. See the added docs for more details. Part of rust-lang/compiler-team#1005. Any suspicious option combinations are prohibited for now. r? @bjorn3 @Zoxc
…on, r=bjorn3 Fix invalidation of stdlib in bootstrap when using non-LLVM codegen backends This was quite the detective hunt. Antoyo reached out to me that when using the GCC codegen backend by default (`--set rust.codegen-backends=["gcc"]`), the stdlib is invalidated after every rebuild. I did some digging, and found out this: - The `Builder::cargo` step manually invalidates the target directory if any of the used codegen backends is dirty, because apparently the used codegen backend is not tracked by `-Zbinary-dep-depinfo` yet. - It does so by getting all paths from `<sysroot>/lib/rustlib/<target>/codegen-backends` via the `Builder::codegen_backends` function, and if any such path is newer than the output directory, the output directory is deleted. - The intention was for this function to return codegen backends, i.e. `.so/.dll` files. However, since the GCC codegen backend has additional dependencies (libgccjit), the `codegen-backends` contains a `lib` subdirectory. And bootstrap was checking the mtime of this *directory*, which was always considered dirty. So I changed the function to only return the actual codegen backends, which fixes the issue. In theory, we should also be checking all the nested contents of the `lib` directory, i.e. the libgccjit dylibs, but I think that if they change, the GCC codegen backend itself should also change, in the vast majority of cases, so I consider this to be a worthy fix in the meantime. CC @antoyo @bjorn3
Bubble bad path error while parsing field to avoid unecessary second error Noticed while looking at rust-lang/rust#92685. Add test for the case in that ticket.
rustc_metadata: Move native library search code to `rustc_codegen_ssa` rust-lang/rust#138243 was partially implemented, so we can do this now.
rustfmt: Format `cfg_select!` tracking issue: rust-lang/rust#115585 Implementing `cfg_select!` formatting here in `rust-lang/rust` so that the feature can get out to nightly quicker. The previous PR (rust-lang/rust#144323) is a bit old at this point and I felt like I could simplify the implementation so I've opted to reimplement the formatting instead of building off the previous PR. I've tried to break the PR up into logical commits and I think this would be best reviewed one commit at a time. --- Previous PR: * rust-lang/rust#144323 See also: * rust-lang/style-team#201
Suggest `Vec<T>` instead of `[T]` Fixes rust-lang/rust#159491 Looks like a regression introduced by:rust-lang/rust#151530
…lacrum Add rustdoc/cargo PGO profiles to reproducible artifacts I forgot to do this in the previous PRs. I wanted to wait for rust-lang/rust#159642, but that's a bit stuck because of CI time, so let's not wait, to avoid missing reproducible artifacts in our builds.
…cro_only_attr, r=JonathanBrouwer Move "macro only" check for `#[allow_internal_unsafe/unstable]` to attribute parser Part of rust-lang/rust#131229 which is the parent issue of rust-lang/rust#153101 @JonathanBrouwer
rustc_middle: lint attribute cleanups
Remove various superfluous lint attributes
Coalesce `rustc_on_unimplemented` attributes and lint malformed filters Discussion on [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/attribute.20parsing.20rework/near/613179950). Best reviewed in commit order. r? @mejrs
fix query cycle in `coroutine_hidden_types` for the next solver Fixes rust-lang/trait-system-refactor-initiative#282 When computing assumptions for coroutine hidden types, we are required to prove the `Send` bound on the same coroutine type again thus the query cycle. We can just disable the higher-ranked-assumptions feature for the next solver. r? @ShoyuVanilla cc @lcnr
tests: Remove `-Zthreads` options from tests in `ui/parallel-rustc` The number of threads is now passed by compiletest through `--parallel-frontend-threads=N` in parallel testing runs. If it becomes necessary, we'll be able to set a larger number of threads or iterations for the `ui/parallel-rustc` tests specifically. r? @jieyouxu
… r=folkertdev Remove outdated comments from `va_list.rs` Since rust-lang/rust#150436 codegen backends haven't needed to implement `va_copy` or `va_end` as they are implemented using intrinsic fallback bodies, so the comments on the `#[inline]` annotations are no longer relevant. I've left the `#[inline]` annotations themselves as they seem worthwhile since `va_copy` and `va_end` are a memcpy and a no-op respectively.
More accurately check for interior mutability in `invalid_reference_casting` lint This PR replaces the `Freeze` trait check in the `invalid_reference_casting` lint by a recursive type check. The check was not enough to determine if a type has "interior mutability", as `Freeze` is proxy for "has *some* interior mutability", not "fully covered by interior mutability". As requested in rust-lang/rust#159960 (comment)
rustdoc: Fix crash when trying to list attributes on an opaque type Fixes rust-lang/rust#160107. It's crashing because we're using `get_attrs` on an `OpaqueTy` which cannot have attributes and therefore crashed. So instead, I check ahead of calling this function in the path where this can happen instead of doing it in `convert_render_type_id` on all `RenderTypeId::DefId`. r? @notriddle
Rename splat to rustc_splat in error messages Tracking issue: rust-lang/rust#153629 This PR renames "splat attribute" to "\`rustc_splat\` attribute" in error messages (and some comments). It was meant to be part of rust-lang/rust#159817 but I missed it. The search and replace command I used was: ```sh fastmod --extensions rs --fixed-strings 'splat attribute' '`rustc_splat` attribute' ``` This doesn't need to be backported, because those error messages only appear on nightly. Part of rust-lang/rust#159428
…trochenkov dont fire `unused_mut` on `&pin mut self` `SelfKind::Pinned` in `Param::from_self` was setting the binding mutability to `mutbl`, so `&pin mut self` produced a mutable binding and triggered `unused_mut` spuriously. the `mut` qualifies the pin reference, not the binding. same as `SelfKind::Region` which uses `Mutability::Not`. fixes rust-lang/rust#142077 r? @petrochenkov
Configure backport nominations for rustfmt ## Summary As discussed in [#t-rustfmt > Backport channel](https://rust-lang.zulipchat.com/#narrow/channel/357797-t-rustfmt/topic/Backport.20channel/with/613788070), configure triagebot backport nominations (rust-lang/rust) against [#t-rustfmt/backports](https://rust-lang.zulipchat.com/#narrow/channel/621384-t-rustfmt.2Fbackports) so it's less likely for backport nominations involving rustfmt to get lost. The rustfmt backport channel number is `621384`, since the URL is ``` https://rust-lang.zulipchat.com/#narrow/channel/621384-t-rustfmt.2Fbackports ``` cc @ytmimi
renovate: update lock files weekly r? @Kobzol
…uwer Rollup of 22 pull requests Successful merges: - rust-lang/rust#160100 (Add "system" option to `override-allocator` directive) - rust-lang/rust#160220 (Refactor: shrink region ext traits) - rust-lang/rust#159675 (rustc: Support `--jobs` options for limiting parallelism in various parts of the compiler) - rust-lang/rust#159999 (Fix invalidation of stdlib in bootstrap when using non-LLVM codegen backends) - rust-lang/rust#160233 (Bubble bad path error while parsing field to avoid unecessary second error) - rust-lang/rust#160272 (rustc_metadata: Move native library search code to `rustc_codegen_ssa`) - rust-lang/rust#154202 (rustfmt: Format `cfg_select!`) - rust-lang/rust#159520 (Suggest `Vec<T>` instead of `[T]`) - rust-lang/rust#159710 (Add rustdoc/cargo PGO profiles to reproducible artifacts) - rust-lang/rust#160034 (Move "macro only" check for `#[allow_internal_unsafe/unstable]` to attribute parser) - rust-lang/rust#160066 (rustc_middle: lint attribute cleanups) - rust-lang/rust#160085 (Remove various superfluous lint attributes) - rust-lang/rust#160113 (Coalesce `rustc_on_unimplemented` attributes and lint malformed filters) - rust-lang/rust#160119 (fix query cycle in `coroutine_hidden_types` for the next solver) - rust-lang/rust#160147 (tests: Remove `-Zthreads` options from tests in `ui/parallel-rustc`) - rust-lang/rust#160157 (Remove outdated comments from `va_list.rs`) - rust-lang/rust#160159 (More accurately check for interior mutability in `invalid_reference_casting` lint) - rust-lang/rust#160208 (rustdoc: Fix crash when trying to list attributes on an opaque type) - rust-lang/rust#160244 (Rename splat to rustc_splat in error messages) - rust-lang/rust#160246 (dont fire `unused_mut` on `&pin mut self`) - rust-lang/rust#160247 (Configure backport nominations for rustfmt) - rust-lang/rust#160274 (renovate: update lock files weekly)
Flatten all -L search paths into a single list of files This is an optimization that mostly targets the new [Cargo build dir layout](https://rust-lang.github.io/rust-project-goals/2025h2/cargo-build-dir-layout.html). Before, Cargo usually used to pass rustc a single `-L` path to a directory containing potentially a large number of `.rlib` or other dependency paths. Rustc is optimized for this, and does a preprocessing step, where it preloads all files from this directory into a sorted vector, in which it then performs binary search to look for files having a given prefix and postfix. With the new build dir layout, this changes, and Cargo will pass potentially many (even hundreds, if your crate has many dependencies) `-L` directories, where each directory will usually have only 1-2 files. This is not ideal for the current rustc search implementation, because the old preprocessing isn't really worth it when the `-L` directory typically only has a single file, and because rustc will do a lot of work per each `-L` directory in the lookup phase, including some quadratic (O(n^2)) work. With the `large-workspace` stress test from rustc-perf, where the final binary has ~1000 total and ~500 direct dependencies: - With the old build dir layout, rustc does 4274 calls to `FilesIndex::query` - With the new build dir layout, it does `1938314` calls to `FilesIndex::query`. Not ideal :) This PR modifies the logic so that instead of going through all `-L` directories one by one when we are looking for a specific dependency, we pre-gather all files from all passed `-L` directories at the start, and sort them all together. Then, in the lookup phase, instead of performing <number of -L dirs> * 4 (.rmeta, .rlib, etc.) searched, we only perform the 4 searches across all files. This gets rid of the O(n^2) behavior. Further improvements could be made, e.g. sort the files just once and then filter it for for both host and target filesearchs. I alsothought about pre-filtering the files further, e.g. based on their `kind`, but that is not worth it in usual situations, where ~all of the deps will be `.rlib`s or `.rmeta`s anyway. What might work is pre-filtering based on their actual names (we strip known prefixes from them and then search based on the names alone, in a hashmap or something?), but that can be a follow-up. Diff vs parent. of rust-lang/rust#159857: https://perf.rust-lang.org/compare.html?start=1a833e16546c2eb012758ddd499964fd8afee29e&end=6514e2707b7e90fecbc570eeaa36f3780a9b02b4&stat=instructions%3Au
Improve CFG traversal This PR implements a new CFG traversal algorithm in `iterate_to_fixpoint` that drastically speeds up a pathological case in `cranelift-codegen`. r? @cjgillot
…hercote perf: Avoid a heap allocation per basic block in MoveData's location maps `MoveData` holds two `LocationMap`s, and each was an `IndexVec<BasicBlock, Vec<T>>` that heap-allocated one `Vec` per basic block. Building the move data for a body allocated a small vector for every block, twice over. Store the entries in one flat buffer indexed by a per-block start offset, so each map is two allocations regardless of block count.
bootstrap: update cc-rs to `1.2.62` * Removes deprecated `static_flag` build methods
Implement `Debug` for C-like enums with a concatenated string Fixes: rust-lang/rust#133945 Related to: rust-lang/rust#88793 rust-lang/rust#114106 Continuation of: rust-lang/rust#109615 rust-lang/rust#114190 This optimizes the expansion of `derive(Debug)` for C-like enums with 10 or more variants to: ```rust fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { const __NAMES: &str = "AAAAABBBBCCDDDDDDDDEFFFFFFFFFFFFFGGGGGGHatsuneIIIIIIIJJJJJJJJJ"; const __OFFSET: [usize; 11] = [0usize, 5usize, 9usize, 11usize, 19usize, 20usize, 33usize, 39usize, 46usize, 53usize, 62usize]; let __d = ::core::intrinsics::discriminant_value(self) as usize; ::core::fmt::Formatter::debug_c_like_enum_write_str(f, __NAMES, &__OFFSET, __d) } ``` The number 10 was decided based on both [the rustc perf result](rust-lang/rust#155452 (comment)) and the results from the dedicated perf tool for this scenario: <img width="1920" height="1280" alt="chart-link" src="https://github.com/user-attachments/assets/1327ee63-ce05-482b-a1fd-c56e919250ea" /> <img width="1920" height="1280" alt="chart-obj" src="https://github.com/user-attachments/assets/1cb831d3-c9dc-469f-b87d-03cf633f8335" /> See https://codeberg.org/makai410/debug-fmt-perf for more details. r? @ghost (I want to see the perf first)
This updates the rust-version file to 22057b88b091743bc0fd8d592a9264f0a6951403.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@22057b8 Filtered ref: b20e9aa Upstream diff: rust-lang/rust@da86f4d...22057b8 This merge was created using https://github.com/rust-lang/josh-sync.
Collaborator
|
Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Latest update from rustc.