Commit Graph

308495 Commits

Author SHA1 Message Date
Zalathar
f988679d23 Rename RunnableTest to TestThreadArgs and inline its methods 2025-10-25 13:20:39 +11:00
Zalathar
2db19f27da Don't pass Arc<Config> to runtest::run
This function doesn't need its own clone of the `Arc`, and can just take a
reference instead.
2025-10-25 12:51:30 +11:00
bors
f435972085 Auto merge of #142712 - davidtwco:sized-hierarchy-missing-default-bounds, r=lcnr
hir_analysis: add missing sizedness bounds

Depends on rust-lang/rust#144064

Default sizedness bounds were not being added to `explicit_super_predicates_of` and `explicit_implied_predicates_of` which meant that a trait bound added to a associated type projection would be missing the implied predicate of the default sizedness supertrait of that trait.

An unexpected consequence of this change was that the check for multiple principals was now finding an additional `MetaSized` principal when eagerly expanding trait aliases - which is fixed by skipping `MetaSized` when elaborating trait aliases in lowering `dyn TraitAlias`.
2025-10-24 21:39:28 +00:00
bors
2aaa62b89d Auto merge of #148018 - tardyp:lto_big_filesize_utf8, r=JonathanBrouwer
fix panic when rustc tries to reduce intermediate filenames len with utf8

The issue cannot be reproduced with the former testcase of creating external crates because rust refuses to use "external crate 28_找出字符串中第一个匹配项的下标" because it is not a valid indentifier (starts with number, and contain non ascii chars)

But still using 28_找出字符串中第一个匹配项的下标.rs as a filename is accepted by previous rustc releases So we consider it valid, and add an integration test for it to catch any regression on other code related to non ascii filenames.

Fix rust-lang/rust#147975
2025-10-24 18:23:10 +00:00
David Wood
82a4049844 hir_analysis: add missing sizedness bounds
Default sizedness bounds were not being added to
`explicit_super_predicates_of` and `explicit_implied_predicates_of`
which meant that a trait bound added to a associated type projection
would be missing the implied predicate of the default sizedness
supertrait of that trait.

An unexpected consequence of this change was that the check for multiple
principals was now finding an additional `MetaSized` principal when
eagerly expanding trait aliases. Instead of special-casing trait aliases
as different from traits and not adding a `MetaSized` supertrait to trait
aliases, filter out `MetaSized` when lowering `dyn Trait`.
2025-10-24 15:28:34 +01:00
Pierre Tardy
c6acffeb78 fix panic when rustc tries to reduce intermediate filenames length with multi byte chars
The issue cannot be reproduced with the former testcase of creating external crates because
rust refuses to use "external crate 28_找出字符串中第一个匹配项的下标"
because it is not a valid indentifier (starts with number, and contain non ascii chars)

But still using 28_找出字符串中第一个匹配项的下标.rs as a filename is accepted by previous rustc releases
So we consider it valid, and add an integration test for it to catch any regression on other code related to non ascii filenames.
2025-10-24 16:20:29 +02:00
bors
ab925646fa Auto merge of #147950 - durin42:llvm-22-intrinsics-changes, r=nikic
rustc_codegen_llvm: adapt for LLVM 22 change to pass masked intrinsic alignment as an attribute

This was a bit more invasive than I had kind of hoped. An alternate approach would be to add an extra call_intrinsic_with_attrs() that would have the new-in-this-change signature for call_intrinsic, but this felt about equivalent and made it a little easier to audit the relevant callsites of call_intrinsic().

Related LLVM change is llvm/llvm-project#163802.

`@rustbot` label llvm-main
2025-10-24 13:00:14 +00:00
bors
8aab621cd5 Auto merge of #148043 - lqd:revert-146121, r=wesleywiser
Revert "fix: Filter suggestion parts that match existing code"

As requested by `@wesleywiser` in https://github.com/rust-lang/rust/issues/147973#issuecomment-3437393773 this is a revert of https://github.com/rust-lang/rust/pull/146121 due to the handful of diagnostics ICEs that have been since reported, and found in the beta crater run.

This should thus also be backported to beta so the ICEs don't make it to next week's stable.

Works around (after backport)
- https://github.com/rust-lang/rust/issues/146261
- https://github.com/rust-lang/rust/issues/146706
- https://github.com/rust-lang/rust/issues/146834 but I didn't add a test for this allowed-by-default lint
- as well as the crater run regressions from https://github.com/rust-lang/rust/issues/147973 of which I only added the MCVE as a test.

The proper fix would likely be https://github.com/rust-lang/rust/pull/147849 but it's still currently at the MCP stage. In the meantime, this PR would still emit the same overlapping suggestions, but still use a debug-assert...

r? `@wesleywiser`
2025-10-24 09:50:35 +00:00
bors
75948c8bb3 Auto merge of #148059 - Zalathar:rollup-zkk5prm, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#148016 (Revert constification of `Borrow` and `Deref for Cow` due to inference failure)
 - rust-lang/rust#148021 ([rustdoc] Simplify module rendering and HTML tags handling)
 - rust-lang/rust#148039 (Add myself to the review rotation)
 - rust-lang/rust#148042 (test(frontmatter): Cover spaces between infostring parts)
 - rust-lang/rust#148054 (Streamline iterator chaining when computing successors.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-24 06:27:11 +00:00
Stuart Cook
7141a0f634 Rollup merge of #148054 - nnethercote:chain, r=saethlin
Streamline iterator chaining when computing successors.

There are numerous unnecessary `into_iter` calls.

Also add a comment explaining why the code looks like this, because it's non-obvious at first glance.

r? `@saethlin`
2025-10-24 14:53:48 +11:00
Stuart Cook
195815583d Rollup merge of #148042 - epage:info-space, r=Urgau
test(frontmatter): Cover spaces between infostring parts

As these characters are specifically called out in the RFC, I felt it would be important to have a test to cover them.

Tracking issue: rust-lang/rust#136889
2025-10-24 14:53:47 +11:00
Stuart Cook
439d374ef8 Rollup merge of #148039 - JonathanBrouwer:add-myself, r=JonathanBrouwer
Add myself to the review rotation
2025-10-24 14:53:47 +11:00
Stuart Cook
b8ca0d40ff Rollup merge of #148021 - GuillaumeGomez:simplify-mod-render, r=notriddle
[rustdoc] Simplify module rendering and HTML tags handling

Extracted code from rust-lang/rust#145458.

This PR simplifies the rendering of modules, in particular the HTML tags handling. Instead of having all items in a `vec`, we make a map with their types as key, allowing to then iterate over the types, which allows us to open and close the HTML tag at every turn without the need to check if a tag was opened or not, or to check it's still the same kind of type.

For a better review experience: enable "Hide whitespace", the diff will be much smaller.

r? `@notriddle`
2025-10-24 14:53:46 +11:00
Stuart Cook
3f40ce54a9 Rollup merge of #148016 - clarfonthey:const-convert-revert-2, r=cuviper
Revert constification of `Borrow` and `Deref for Cow` due to inference failure

Reported issue: rust-lang/rust#147964
Original PR: rust-lang/rust#145279
Previous revert: rust-lang/rust#148011
`const Borrow`/`Deref` tracking issue: rust-lang/rust#143773

Should have additional crater run to verify this fixes the issue.

Since other PR is in the queue, this will need to be rebased after that merges. Also will want a beta nomination.
2025-10-24 14:53:45 +11:00
bors
38bc2468de Auto merge of #148049 - cuviper:revert-hash_map, r=Mark-Simulacrum
Revert "feat: implement `hash_map!` macro"

Crater for 1.91-beta found that this unstable macro caused ambiguity in the ecosystem: rust-lang/rust#147971

Since we are very close to release, it's probably best to just revert the macro for now, and re-add it later in a less invasive way -- i.e. not a top-level macro, and not in the prelude until a future edition (as noted [here](https://std-dev-guide.rust-lang.org/breaking-changes/prelude.html#macros)).

`@rustbot` label beta-nominated
2025-10-24 03:21:07 +00:00
ltdk
4a4f3b0e8e Add regression test for inference failures 2025-10-23 18:24:39 -04:00
Rémy Rakic
dd83c57674 add crashes tests for overlapping spans 2025-10-23 22:15:34 +00:00
Nicholas Nethercote
3d951598b2 Streamline iterator chaining when computing successors.
There are numerous unnecessary `into_iter` calls.

Also add a comment explaining why the code looks like this, because it's
non-obvious at first glance.
2025-10-24 08:41:39 +11:00
bors
27050c0d15 Auto merge of #148030 - hkBst:patch-3, r=lqd
Add Marijn Schouten to .mailmap

Should fix https://github.com/rust-lang/thanks/issues/85
2025-10-23 21:32:14 +00:00
Augie Fackler
e3e342a90b rustc_codegen_llvm: adapt for LLVM 22 change to pass masked intrinsic alignment as an attribute
This was a bit more invasive than I had kind of hoped. An alternate
approach would be to add an extra call_intrinsic_with_attrs() that would
have the new-in-this-change signature for call_intrinsic, but this felt
about equivalent and made it a little easier to audit the relevant
callsites of call_intrinsic().
2025-10-23 17:23:01 -04:00
Guillaume Gomez
90c047b3d9 Replace the FxHashMap with an FxIndexMap 2025-10-23 21:45:37 +02:00
Josh Stone
c01682ebf6 Revert "feat: implement hash_map! macro"
This reverts commit 066023e47c.
2025-10-23 12:37:53 -07:00
Josh Stone
a81ed52f58 Add a regression test for rust-lang/rust#147971 2025-10-23 12:37:53 -07:00
Rémy Rakic
a2b48332ba Revert "Auto merge of #146121 - Muscraft:filter-suggestion-parts, r=petrochenkov"
This reverts commit 99317ef14d, reversing
changes made to 9cd272dc85.
2025-10-23 18:18:35 +00:00
Ed Page
bca35effc2 test(frontmatter): Cover spaces between infostring parts
As these characters are specifically called out in the RFC, I felt it
would be important to have a test to cover them.
2025-10-23 11:47:53 -05:00
Jonathan Brouwer
9ceb997e04 Add myself to the review rotation 2025-10-23 17:52:54 +02:00
bors
6501e64fcb Auto merge of #147486 - petrochenkov:optpriv, r=lcnr
privacy: Introduce some caching to type visiting in `DefIdVisitorSkeleton`

The caching fixes compilation speed issues in special cases like https://github.com/rust-lang/rust/issues/145741, without introducing too much overhead in general cases.

I tried to cache more, but it caused regressions from the caching overhead, like it can be seen from benchmark runs below.

Inspired by https://github.com/rust-lang/rust/pull/146128.
Closes https://github.com/rust-lang/rust/issues/145741.
2025-10-23 14:30:10 +00:00
Marijn Schouten
41b4b2f718 Add Marijn Schouten to .mailmap 2025-10-23 15:17:44 +02:00
ltdk
ebd5bea84f Revert inference failure from Deref/Borrow constification 2025-10-23 08:51:27 -04:00
bors
11d2046fe9 Auto merge of #148022 - Zalathar:rollup-3m6ty9u, r=Zalathar
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#140463 (Document MaybeUninit bit validity)
 - rust-lang/rust#148017 (Add TidyFlags and merge DiagCtx)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-23 11:22:38 +00:00
Stuart Cook
5ff30d3daf Rollup merge of #148017 - simp4t7:add-tidy-flags, r=Kobzol
Add TidyFlags and merge DiagCtx

Adds a struct `TidyFlags` and merges it with `DiagCtx` into `TidyCtx`. Removes the need to pass `bless` into individual check functions in tidy.
2025-10-23 22:10:15 +11:00
Stuart Cook
c5e4a5f121 Rollup merge of #140463 - joshlf:patch-13, r=RalfJung
Document MaybeUninit bit validity

Partially addresses https://github.com/rust-lang/unsafe-code-guidelines/issues/555 by clarifying that it is sound to write any byte values (initialized or uninitialized) to any `MaybeUninit<T>` regardless of `T`.

r? `@RalfJung`
2025-10-23 22:10:14 +11:00
Guillaume Gomez
c18cd774b3 [rustdoc] Simplify module rendering and HTML tags handling 2025-10-23 12:59:29 +02:00
T
dbeb7faaed add TidyFlags and merge DiagCtx
reorder impl block

changed is_bless to is_bless_enabled
2025-10-23 08:19:38 +00:00
bors
469357eb48 Auto merge of #148014 - jhpratt:rollup-aglren3, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#134316 (Add `String::replace_first` and `String::replace_last`)
 - rust-lang/rust#147713 (Retire ast::TyAliasWhereClauses.)
 - rust-lang/rust#148011 (Revert constification of `AsRef for Cow` due to inference failure )

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-23 08:17:05 +00:00
Jacob Pratt
5d55418a7d Rollup merge of #148011 - clarfonthey:const-convert-revert, r=oli-obk
Revert constification of `AsRef for Cow` due to inference failure

Reported issue: rust-lang/rust#147964
Original PR: rust-lang/rust#145279
`const AsRef` tracking issue: rust-lang/rust#143773

Should have additional crater run to verify this fixes the issue.
2025-10-23 01:22:06 -04:00
Jacob Pratt
0185feb7db Rollup merge of #147713 - cjgillot:where-cfg, r=fmease
Retire ast::TyAliasWhereClauses.

`ast::TyAliasWhereClauses` is a tentative to avoid forgetting predicates when manipulating the AST.
It is incompatible with `cfg` attributes on where clauses.

This PR uses a regular `WhereClause` for the "second" clause.

Fixes https://github.com/rust-lang/rust/issues/138010
cc https://github.com/rust-lang/rust/pull/138037
2025-10-23 01:22:06 -04:00
Jacob Pratt
4491efbc82 Rollup merge of #134316 - zachs18:string_replace_in_place_rebase, r=joshtriplett
Add `String::replace_first` and `String::replace_last`

Rebase of #97977 (cc `@WilliamVenner)`

> Convenience methods that use `match_indices` and `replace_range` to efficiently replace a substring in a string without reallocating, if capacity (and the implementation of `Vec::splice`) allows.

The intra-doc link to `str::replacen` is a direct url-based link to `str::replacen` in `std`'s docs to work around #98941. This means that when building only `alloc`'s docs (and not `std`'s), it will be a broken link. There is precedent for this e.g. in [`core::hint::spin_loop`](https://doc.rust-lang.org/nightly/src/core/hint.rs.html#214) which links to `std:🧵:yield_now` using a [url-based link](https://github.com/rust-lang/rust/blob/master/library/core/src/hint.rs#L265) and thus is a dead link when only building `core`'s docs.

ACP: https://github.com/rust-lang/libs-team/issues/506
2025-10-23 01:22:05 -04:00
bors
4b3ba5844e Auto merge of #147793 - cjgillot:no-null-op, r=scottmcm,oli-obk
Replace NullOp::SizeOf and NullOp::AlignOf by lang items.

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

Fixes https://github.com/rust-lang/rust/issues/119729
Keeps https://github.com/rust-lang/rust/issues/136175 as it involves `offset_of!` which this PR does not touch.

r? `@ghost`
2025-10-23 05:09:25 +00:00
bors
7838ce1a3a Auto merge of #148012 - Zalathar:rollup-ed6cnn8, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#115501 (Add new inherit_handles flag to CommandExt trait)
 - rust-lang/rust#146629 (std: reorganize the UNIX-internal `weak` module)
 - rust-lang/rust#147762 (feat(rustdoc): `--emit=depinfo` output to stdout via `-`)
 - rust-lang/rust#148001 (fix: Don't add diff symbol to unchanged lines)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-23 02:01:36 +00:00
Stuart Cook
2f7e07bb4a Rollup merge of #148001 - Muscraft:fix-diff-symbol-unchanged-lines, r=fmease
fix: Don't add diff symbol to unchanged lines

When rendering a "multi-line" suggestion with the [`Diff`](dc1feabef2/compiler/rustc_errors/src/emitter.rs (L3078)) format, `rustc` uses a [diff symbol](dc1feabef2/compiler/rustc_errors/src/emitter.rs (L3017-L3022)) for
[any line that has a highlight part](dc1feabef2/compiler/rustc_errors/src/emitter.rs (L2705-L2713)). This includes highlight parts that are highlighting nothing, i.e., a span of `0..0`. This leads `rustc` to add a diff symbol unnecessarily to lines that have no changes and are not highlighted. This PR makes it so that `rustc` will not add a diff symbol to lines that contain no changes/highlights.

Note: This PR is part of my ongoing effort to have `rustc` use `annotate-snippets` for rendering. This change will make it so that `rustc` and `annotate-snippets` will match in this case.
2025-10-23 12:06:32 +11:00
Stuart Cook
b397b6b5b7 Rollup merge of #147762 - weihanglo:rustdoc-depinfo-stdout, r=fmease
feat(rustdoc): `--emit=depinfo` output to stdout via `-`

rustdoc's `--emit=depinfo` flag now supports using `-` to write the output to stdout,
aligning with rustc's behavior.

This will fix <https://github.com/rust-lang/rust/issues/147649>.

### How to review

* The first commit demonstrates that `rustdoc --emit=depinfo=-` hasn't yet supported emitting to stdout.
* The second implements it and the diff shows how the behavior changes.
2025-10-23 12:06:32 +11:00
Stuart Cook
e93ec9aab4 Rollup merge of #146629 - joboet:reorganize-weak, r=ibraheemdev
std: reorganize the UNIX-internal `weak` module

This moves the `dlsym`-based and weak-linkage versions of the `weak!` macro into separate files, both of which include a common test file. As a result, both versions will be tested on all the platforms where they are used.

Since the `#[link_name]` arm of the `dlsym` version was unused, I've removed it. I've also removed the unused `raw_syscall!` and non-Linux `syscall!` macros and gated the `#[allow(dead_code, unused_macros)]` to only apply on non-Linux platforms, so compilation will fail if `weak` turns out to be unused on all platforms.

The last change concerns the use of `dlsym!` on FreeBSD: it is only used once, to link against `sysctlbyname`. But that symbol is always available, so there is no need for weak linkage.
2025-10-23 12:06:31 +11:00
Stuart Cook
e4bf8b3fc3 Rollup merge of #115501 - michaelvanstraten:set_inherit_handles, r=ChrisDenton
Add new inherit_handles flag to CommandExt trait

This PR adds a new flag to the [`CommandExt`](https://doc.rust-lang.org/stable/std/os/windows/process/trait.CommandExt.html) trait to set whether to inherit the handles of the calling process ([ref][1]).

This is necessary when, for example, spawning a process with a `pseudoconsole` attached.

r? ``@ChrisDenton``

ACP: https://github.com/rust-lang/libs-team/issues/264
[1]: <https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw>
2025-10-23 12:06:30 +11:00
Camille Gillot
15c91bf308 Retire ast::TyAliasWhereClauses. 2025-10-23 00:40:01 +00:00
Camille Gillot
5dfbf67f94 Replace NullOp::SizeOf and NullOp::AlignOf by lang items. 2025-10-23 00:38:28 +00:00
ltdk
cb7fb35ad1 Revert inference failure from AsRef constification 2025-10-22 20:31:43 -04:00
bors
6244effd03 Auto merge of #147810 - bjorn3:lto_refactors6, r=wesleywiser
Split LTO out of the main codegen coordinator event loop into a separate event loop on the same thread

This will make it easier to in the future move all this code to link_binary.

Follow up to https://github.com/rust-lang/rust/pull/146209
Part of https://github.com/rust-lang/compiler-team/issues/908
2025-10-22 22:50:15 +00:00
Scott Schafer
c7f014ddc6 fix: Don't add diff symbol to unchanged lines 2025-10-22 15:30:57 -06:00
bors
1d23d06800 Auto merge of #147997 - jhpratt:rollup-nupruru, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#145617 (docs(style): Specify the frontmatter style)
 - rust-lang/rust#147830 (Reword unstable fingerprints ICE to ask for reproduction)
 - rust-lang/rust#147988 (Remove unused field `style` from `AttributeKind::CrateName`)
 - rust-lang/rust#147990 (Fix invalid jump to def link generated on derive attributes)
 - rust-lang/rust#147991 ([rustdoc] Check `doc(cfg())` even of private/hidden items)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-22 19:38:56 +00:00