Commit graph

303841 commits

Author SHA1 Message Date
Jacob Pratt
561656db67
Rollup merge of #145745 - heiher:ignore-basic-stepping, r=lqd
tests: Ignore basic-stepping.rs on LoongArch
2025-08-22 22:00:58 -04:00
Jacob Pratt
c9b4c33932
Rollup merge of #145743 - xihuwenhua:master, r=petrochenkov
doc: fix some typos in comment

fix some typos in comment
2025-08-22 22:00:58 -04:00
Jacob Pratt
2d1da7c88d
Rollup merge of #145742 - lolbinarycat:rustdoc-search-type-cleanup-continued, r=GuillaumeGomez
rustdoc js: Even more typechecking improvments

made another pass at eliminating typescript errors, this time mainly focused on adding fields to `window` that weren't declared before.

r? `@notriddle`
2025-08-22 22:00:57 -04:00
Jacob Pratt
ca6415d692
Rollup merge of #145738 - cjgillot:union-find-uplift, r=Zalathar
Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures.

I was wondering if we had some union-find implementation in the compiler. We do. So put it where we can find it.
2025-08-22 22:00:56 -04:00
Jacob Pratt
a3d5d65815
Rollup merge of #145736 - joshtriplett:triagebot-style, r=traviscross
triagebot: Update style team reviewers
2025-08-22 22:00:56 -04:00
Jacob Pratt
779818575e
Rollup merge of #145731 - lolbinarycat:rustdoc-search-generic-pointer-142385, r=notriddle
Make raw pointers work in type-based search

fixes rust-lang/rust#142385
2025-08-22 22:00:55 -04:00
Jacob Pratt
566c13c88e
Rollup merge of #145726 - aapoalas:reborrow-lang-experiment, r=petrochenkov
Experiment: Reborrow trait

Tracking issue: rust-lang/rust#145612

Starting off really small here: just introduce the unstable feature and the feature gate, and one of the two traits that the Reborrow experiment deals with.

### Cliff-notes explanation

The `Reborrow` trait is conceptually a close cousin of `Copy` with the exception that it disables the source (`self`) for the lifetime of the target / result of the reborrow action. It can be viewed as a method of `fn reborrow(self: Self<'a>) -> Self<'a>` with the compiler adding tracking of the resulting `Self<'a>` (or any value derived from it that retains the `'a` lifetime) to keep the `self` disabled for reads and writes.

No method is planned to be surfaced to the user, however, as reborrowing cannot be seen in code (except for method calls [`a.foo()` reborrows `a`] and explicit reborrows [`&*a`]) and thus triggering user-code in it could be viewed as "spooky action at a distance". Furthermore, the added compiler tracking cannot be seen on the method itself, violating the Golden Rule. Note that the userland "reborrow" method is not True Reborrowing, but rather a form of a "Fancy Deref":
```rust
fn reborrow(&'short self: Self<'long>) -> Self<'short>;
```
The lifetime shortening is the issue here: a reborrowed `Self` or any value derived from it is bound to the method that called `reborrow`, since `&'short` is effectively a local variable. True Reborrowing does not shorten the lifetime of the result.

To avoid having to introduce new kinds of references, new kinds of lifetime annotations, or a blessed trait method, no method will be introduced at all. Instead, the `Reborrow` trait is intended to be a derived trait that effectively reborrows each field individually; `Copy` fields end up just copying, while fields that themselves `Reborrow` get disabled in the source, usually leading to the source itself being disabled (some differences may appear with structs that contain multiple reborrowable fields). The goal of the experiment is to determine how the actual implementation here will shape out, and what the "bottom case" for the recursive / deriving `Reborrow` is.

`Reborrow` has a friend trait, `CoerceShared`, which is equivalent to a `&'a mut T -> &'a T` conversion. This is needed as a different trait and different operation due to the different semantics it enforces on the source: a `CoerceShared` operation only disables the source for writes / exclusive access for the lifetime of the result. That trait is not yet introduced in this PR, though there is no particular reason why it could not be introduced.
2025-08-22 22:00:55 -04:00
Jacob Pratt
0cd557b096
Rollup merge of #145710 - heiher:issue-145692-2, r=nnethercote
Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64

Issue: rust-lang/rust#145692
2025-08-22 22:00:54 -04:00
Jacob Pratt
c80e77fa21
Rollup merge of #145695 - cjgillot:place-elem-map, r=oli-obk,lcnr
Introduce ProjectionElem::try_map.

Small utility function useful to manipulate MIR place projections.
2025-08-22 22:00:54 -04:00
Jacob Pratt
77f980f202
Rollup merge of #145669 - notriddle:test-js-search-scripts-path, r=GuillaumeGomez
rustdoc-search: GUI tests check for `//` in URL

Follow up https://github.com/rust-lang/rust/pull/145650

When this fails, you get output that looks like:

    /home/user/rust/tests/rustdoc-gui/search-result-impl-disambiguation.goml search-result-impl-disambiguation... FAILED
    [ERROR] `tests/rustdoc-gui/utils.goml` around line 49
        from `tests/rustdoc-gui/search-result-impl-disambiguation.goml` line 25: JS errors occurred: Event: Event

Making the error message more informative requires patching browser-ui-test.
2025-08-22 22:00:53 -04:00
Jacob Pratt
15eeddee1f
Rollup merge of #145641 - estebank:point-at-type-in-e0277, r=davidtwco
On E0277, point at type that doesn't implement bound

When encountering an unmet trait bound, point at local type that doesn't implement the trait:

```
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
  --> $DIR/issue-64855.rs:9:19
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   |                   ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Foo` is not implemented for `Bar<T>`
  --> $DIR/issue-64855.rs:9:1
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   | ^^^^^^^^^^^^^^^^^
```
2025-08-22 22:00:52 -04:00
Jacob Pratt
6991786d5e
Rollup merge of #145633 - qxzcode:patch-1, r=jhpratt
Fix some typos in LocalKey documentation

A few minor grammatical/wording changes in the `std:🧵:LocalKey` documentation.
2025-08-22 22:00:52 -04:00
Jacob Pratt
8066e76c7d
Rollup merge of #145597 - petrochenkov:nolateset, r=b-naber
resolve: Remove `ScopeSet::Late`

It's better to decouple the late/early stage from scope set, because in https://github.com/rust-lang/rust/pull/144131#discussion_r2283200511 we'll need the stage for `ScopeSet::Module` as well.

See individual commits for the refactoring details.
r? ``@b-naber``
2025-08-22 22:00:51 -04:00
Jacob Pratt
45d5109ad8
Rollup merge of #145573 - veluca93:unsafe-force-target-feature, r=davidtwco
Add an experimental unsafe(force_target_feature) attribute.

This uses the feature gate for https://github.com/rust-lang/rust/issues/143352, but is described in https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to the experiment.
2025-08-22 22:00:51 -04:00
Jacob Pratt
f0a414870a
Rollup merge of #145380 - okaneco:add-codegen-tests, r=Mark-Simulacrum
Add codegen-llvm regression tests

Most of these regressions deal with elimination of panics and bounds checks that were fixed upstream by LLVM.

closes https://github.com/rust-lang/rust/issues/141497
closes https://github.com/rust-lang/rust/issues/131162
closes https://github.com/rust-lang/rust/issues/129583
closes https://github.com/rust-lang/rust/issues/110971
closes https://github.com/rust-lang/rust/issues/91109
closes https://github.com/rust-lang/rust/issues/80075
closes https://github.com/rust-lang/rust/issues/74917
closes https://github.com/rust-lang/rust/issues/71997
closes https://github.com/rust-lang/rust/issues/71257
closes https://github.com/rust-lang/rust/issues/59352
2025-08-22 22:00:50 -04:00
Jacob Pratt
5cfdbd6c08
Rollup merge of #145218 - nilptr:nilptr/feat/lldb-enum-pretty-printer, r=Mark-Simulacrum
[Debuginfo] improve enum value formatting in LLDB for better readability

> TL;DR: When debugging with CodeLLDB, I noticed enum values were often hard to read because LLDB lists every possible variant, resulting in a verbose and cluttered view, even though only one variant is actually valid. Interestingly, raw enum types display nicely. After some investigation, I found that `&enum` values get classified as `Other`, so it falls back to `DefaultSyntheticProvider`, which causes this verbose output.

## What does this PR do?

This PR contains 2 commits:

1. change the enum value formatting from showing 2 separate fields (`value` for attached data and `$discr$` for the discriminator) to a concise `<readable variant name>: <attached data>` format
2. dereference pointer types in `classify_rust_type` so that it can return more accurate type for reference type

## Self-test proof

Before:

<img width="1706" height="799" alt="before" src="https://github.com/user-attachments/assets/b66c7e22-990a-4da5-9036-34e3f9f62367" />

After:

<img width="1541" height="678" alt="after" src="https://github.com/user-attachments/assets/36db32e2-f822-4883-8f17-cb8067e509f6" />
2025-08-22 22:00:49 -04:00
Jacob Pratt
2dbd411d22
Rollup merge of #144897 - fee1-dead-contrib:raw_lifetimes_printing, r=fmease
print raw lifetime idents with r#

This replaces rust-lang/rust#143185 and fixes rust-lang/rust#143150

cc ``@fmease``
2025-08-22 22:00:47 -04:00
Jacob Pratt
2bd39222cd
Rollup merge of #144648 - connortsui20:nonpoison_rwlock, r=Mark-Simulacrum
Implementation: `#[feature(nonpoison_rwlock)]`

Tracking Issue: https://github.com/rust-lang/rust/issues/134645

This PR continues the effort made in https://github.com/rust-lang/rust/pull/144022 by adding the implementation of `nonpoison::rwlock`.

Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. The only real difference is that this PR includes a reorganizing of the existing `poison::rwlock` file that hopefully makes both variants more readable.

### Related PRs

- `nonpoison_condvar` implementation: https://github.com/rust-lang/rust/pull/144651
- `nonpoison_once` implementation: https://github.com/rust-lang/rust/pull/144653
2025-08-22 22:00:46 -04:00
Jacob Pratt
bc4a6431eb
Rollup merge of #142185 - saethlin:refprop-moves, r=cjgillot
Convert moves of references to copies in ReferencePropagation

This is a fix for https://github.com/rust-lang/rust/issues/141101.

The root cause of this miscompile is that the SsaLocals analysis that MIR transforms use is supposed to detect locals that are only written to once, in their single assignment. But that analysis is subtly wrong; it does not consider `Operand::Move` to be a write even though the meaning ascribed to `Operand::Move` (at least as a function parameter) by Miri is that the callee may have done arbitrary writes to the caller's Local that the Operand wraps (because `Move` is pass-by-pointer). So Miri conwiders `Operand::Move` to be a write but both the MIR visitor system considers it a read, and so does SsaLocals.

I have tried fixing this by changing the `PlaceContext` that is ascribed to an `Operand::Move` to a `MutatingUseContext` but that seems to have borrow checker implications, and changing SsaLocals seems to have wide-ranging regressions in MIR optimizations.

So instead of doing those, this PR adds a new kludge to ReferencePropagation, which follows the same line of thinking as the kludge in CopyProp that solves this same problem inside that pass: a5584a8fe1/compiler/rustc_mir_transform/src/copy_prop.rs (L65-L98)
2025-08-22 22:00:46 -04:00
Jacob Pratt
467c89cd0b
Rollup merge of #137457 - JayAndJef:issue-132802-fix, r=Kobzol
Fix host code appearing in Wasm binaries

This is a direct fix for issue [132802](https://github.com/rust-lang/rust/issues/132802).
Followed the outline as follows:
> * give a hard error in bootstrap when using gcc to compile for wasm
> * change our CI to use clang instead of gcc
> * add a test that compiling a sample program for wasm32-unknown doesn't give any linker warnings

The `test-various` ci job was also changed.

try-job: test-various
try-job: dist-various-1
try-job: dist-various-2
try-job: x86_64-msvc-1
2025-08-22 22:00:45 -04:00
Jacob Pratt
85c9af57f4
Rollup merge of #137396 - compiler-errors:param-default, r=fmease
Recover `param: Ty = EXPR`

Fixes #137310

Pretty basic recovery here, but better than giving an unexpected token error.
2025-08-22 22:00:44 -04:00
Jacob Pratt
dbc38eed1d
Rollup merge of #132087 - ijchen:issue-131770-fix, r=dtolnay
Fix overly restrictive lifetime in `core::panic::Location::file` return type

Fixes #131770 by relaxing the lifetime to match what's stored in the struct. See that issue for more details and discussion.

Since this is a breaking change, I think a crater run is in order. Since this change should only have an effect at compile-time, I think just a check run is sufficient.
2025-08-22 22:00:44 -04:00
bors
6545b05638 Auto merge of #145494 - cjgillot:span-decode-once, r=lqd
Only unpack span data once to compute end_point and next_point.

Split from https://github.com/rust-lang/rust/pull/144930
2025-08-22 21:43:06 +00:00
Michael Goulet
6caa586f57
Recover param: Ty = EXPR 2025-08-22 21:45:28 +02:00
bors
46c219bd24 Auto merge of #145352 - Shourya742:2025-08-12-remove-default-config, r=Kobzol
Remove default config from bootstrap

This PR removes the default config initialization from parse_inner, as it introduced many assumptions during config setup. Instead, each variable is now manually initialized to eliminate certain invariants in parse_inner and streamline the process.

r? `@Kobzol`
2025-08-22 18:35:26 +00:00
Esteban Küber
049c32797b On E0277, point at type that doesn't implement bound
When encountering an unmet trait bound, point at local type that doesn't implement the trait:

```
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
  --> $DIR/issue-64855.rs:9:19
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   |                   ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Foo` is not implemented for `Bar<T>`
  --> $DIR/issue-64855.rs:9:1
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   | ^^^^^^^^^^^^^^^^^
```
2025-08-22 17:55:15 +00:00
bors
d20509c2a0 Auto merge of #145749 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2025-08-22 15:09:33 +00:00
binarycat
771c6415b2 main.js: only call window.rustdocToggleSrcSidebar if it exists 2025-08-22 10:07:33 -05:00
binarycat
4a2d6dfe26 typecheck: add nonnull around element known to exist 2025-08-22 10:07:33 -05:00
binarycat
cb572cb876 typecheck tooltipBlurHandler 2025-08-22 10:07:32 -05:00
binarycat
dfec2bbdca typecheck window.CURRENT_TOOLTIP_ELEMENT 2025-08-22 10:07:32 -05:00
Vadim Petrochenkov
e26b1754cb resolve: Remove ScopeSet::Late
The difference between `Late` and `All` only matters when `finalize` is enabled.
So add a `stage` field to `Finalize` and use it instead.
2025-08-22 16:52:16 +03:00
Vadim Petrochenkov
a47c3729b4 resolve: Remove derive fallback lint id from ScopeSet::Late 2025-08-22 16:52:16 +03:00
Vadim Petrochenkov
b82b947a5c resolve: Remove Module from ScopeSet::Late
It can be passed in a more usual way through `ParentScope`
2025-08-22 16:52:16 +03:00
Vadim Petrochenkov
774d96a29f resolve: early_resolve_ident_in_lexical_scope -> resolve_ident_in_scope_set 2025-08-22 16:52:16 +03:00
Philipp Krones
9a348e8da8
Merge commit '877967959a' into clippy-subtree-update 2025-08-22 14:57:22 +02:00
Philipp Krones
877967959a
Rustup (#15531)
Letting rustbot assign a reviewer, so that someone can double check
9de86f40d7.

changelog: none
2025-08-22 12:36:32 +00:00
Philipp Krones
60374e257a
Bump nightly version -> 2025-08-22 2025-08-22 14:26:37 +02:00
Philipp Krones
9de86f40d7
Dogfood fixes 2025-08-22 14:26:24 +02:00
Philipp Krones
567b65e537
Ignore unexpected_cfgs warning for bootstrap 2025-08-22 14:25:53 +02:00
Philipp Krones
284b596ac4
Merge remote-tracking branch 'upstream/master' into rustup 2025-08-22 14:25:23 +02:00
bors
f5703d5dd3 Auto merge of #144689 - JonathanBrouwer:share_parse_path, r=jdonszelmann
Rewrite the new attribute argument parser

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

This rewrites the parser, should improve performance and maintainability.
This can be reviewed commit by commit
2025-08-22 10:27:12 +00:00
Jakub Beránek
c058ce594b
Sort Config fields and remove some muts from bindings 2025-08-22 12:08:58 +02:00
Philipp Krones
6d89c55e1a
Fixunnecessary_safety_comment does not lint for the first line (#15354)
Closes rust-lang/rust-clippy#14553
Closes rust-lang/rust-clippy#14554

changelog: [`unnecessary_safety_comment`] fix FN for the first line in
file
2025-08-22 08:33:46 +00:00
WANG Rui
d61353ff43 tests: Ignore basic-stepping.rs on LoongArch 2025-08-22 15:58:52 +08:00
bors
831e291d3b Auto merge of #145358 - Kobzol:symbol-name-sort, r=nnethercote
Sort mono items by symbol name

Trying to claw back cycles/branch/cache miss losses from https://github.com/rust-lang/rust/pull/144722.
2025-08-22 07:13:07 +00:00
Jonathan Brouwer
ec5b2cce8e
Updated uitests for new parser 2025-08-22 08:58:45 +02:00
Jonathan Brouwer
17e34f6b24
Use the new attribute parser throughout the codebase 2025-08-22 08:58:45 +02:00
Philipp Krones
e408b25c42
chore: remove redundant word in comment (#15530)
remove redundant word in comment
changelog: none
2025-08-22 06:42:57 +00:00
xihuwenhua
e1d4f099e5 doc: fix some typos in comment
Signed-off-by: xihuwenhua <xihuwenhua@outlook.com>
2025-08-22 14:42:26 +08:00