Commit graph

308340 commits

Author SHA1 Message Date
bors
f6aa851dba Auto merge of #147453 - matthiaskrgr:rollup-z3db8zi, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#146865 (kcfi: only reify trait methods when dyn-compatible)
 - rust-lang/rust#147205 (Add a new `wasm32-wasip3` target to Rust)
 - rust-lang/rust#147322 (cg_llvm: Consistently import `llvm::Type` and `llvm::Value`)
 - rust-lang/rust#147398 (Fix; correct placement of type inference error for method calls)
 - rust-lang/rust#147410 (Update `S-waiting-on-team` refs to new `S-waiting-on-{team}` labels)
 - rust-lang/rust#147422 (collect-license-metadata: Print a diff of the expected output)
 - rust-lang/rust#147431 (compiletest: Read the whole test file before parsing directives)
 - rust-lang/rust#147433 (Fix doc comment)

Failed merges:

 - rust-lang/rust#147390 (Use globals instead of metadata for std::autodiff)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-07 20:47:13 +00:00
Josh Triplett
1bf555c947 library: fs: Factor out the Apple file time to attrlist code for reuse 2025-10-07 13:18:38 -07:00
Josh Triplett
1e6b444df7 library: fs: Factor out a file_time_to_timespec function in preparation for reusing it 2025-10-07 13:16:54 -07:00
Ana Hobden
1dd0a01deb
Fix backtraces with -C panic=abort on qnx; emit unwind tables by default 2025-10-07 13:06:56 -07:00
Michael Howell
c9293bfdae rustdoc-search: add test case for throbber 2025-10-07 12:59:58 -07:00
cyrgani
7aa52ea97a remove Decode trait and only impl 2025-10-07 21:21:40 +02:00
cyrgani
74ec42e000 refactor confusing loop in proc_macro arena 2025-10-07 21:21:07 +02:00
Michael Howell
6d4b4d9ef0 rustdoc-search: keep hourglass in searchbar 2025-10-07 11:51:50 -07:00
Matthias Krüger
b5c3247b01
Rollup merge of #147433 - theemathas:theemathas-patch-1, r=chenyukang
Fix doc comment
2025-10-07 19:39:11 +02:00
Matthias Krüger
7b2e9fb442
Rollup merge of #147431 - Zalathar:directive, r=jieyouxu
compiletest: Read the whole test file before parsing directives

Few tests are larger than a handful of kilobytes, and nowadays we scan the whole file for directives anyway, so there's little reason not to just read the whole thing up-front.

This avoids having to deal with I/O within `iter_directives`, which should make it easier to overhaul directive processing.

r? jieyouxu
2025-10-07 19:39:10 +02:00
Matthias Krüger
68656b7579
Rollup merge of #147422 - jyn514:license-diff, r=Kobzol
collect-license-metadata: Print a diff of the expected output

Previously, `x test collect-license-metadata` gave the following message on errors:
```
gathering license information from REUSE (this might take a minute...)
finished gathering the license information from REUSE in 78.69s
loading existing license information
The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json
file is out of date.
Run ./x run collect-license-metadata to update it.
Error: The existing
/home/runner/work/ferrocene/ferrocene/license-metadata.json file doesn't
match what REUSE reports.
Bootstrap failed while executing `test collect-license-metadata`
```

Notable, this doesn't actually say what went wrong. Print a diff in addition so it's more clear what broke:
```
...
                "license": {
                   "copyright": [
+                    "2010 The Rust Project Developers",
                     "2016, 2017, 2018, 2019, 2020, 2021 AXE Consultants. All Rights",
+                    "License. Subject to the terms and conditions of this",
                     "Notice",
-                    "The Ferrocene Developers"
+                    "The Ferrocene Developers",
+                    "[yyyy] [name of copyright owner]"
                   ],
...
```

Currently, this prints the entire text of the JSON file as context. That's not ideal, but it's rare for this to fail, so I think it's ok for now.

I considered using `assert_json_diff` instead of `similar`, but its errors are a lot harder to read IMO, even though they are better at omitting unnecessary context:

```
Diff: json atoms at path ".files.children[0].children[10].license.copyright[0]" are not equal:
    lhs:
        "2016 The Fuchsia Authors"
    rhs:
        "2019 The Crossbeam Project Developers"

json atoms at path ".files.children[0].children[10].license.spdx" are not equal:
    lhs:
        "BSD-2-Clause AND (Apache-2.0 OR MIT)"
    rhs:
        "Apache-2.0 OR MIT"

json atom at path ".files.children[0].children[10].children" is missing from lhs

json atoms at path ".files.children[0].children[10].name" are not equal:
    lhs:
        "library/std/src/sys/sync/mutex/fuchsia.rs"
    rhs:
        "library/std/src/sync/mpmc"
...
```
2025-10-07 19:39:09 +02:00
Matthias Krüger
a8cc1a2dab
Rollup merge of #147410 - Urgau:waiting-on-team-refactor, r=Kobzol
Update `S-waiting-on-team` refs to new `S-waiting-on-{team}` labels

Context: https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/Team-based.20variant.20of.20.60S-waiting-on-team.60/with/542791637

r? `@Kobzol`
2025-10-07 19:39:09 +02:00
Matthias Krüger
0174900c5d
Rollup merge of #147398 - Jamesbarford:fix/method-call-type-inference-error, r=chenyukang
Fix; correct placement of type inference error for method calls

Addresses a FIXME for displaying errors on method calls;

Before;
```
error[E0282]: type annotations needed
  --> /<location>/src/main.rs:48:15
   |
## |             e.is_conversion_error();
   |               ^^^^^^^^^^^^^^^^^^^ cannot infer type
```

After;

```
error[E0282]: type annotations needed
  --> /<location>/src/main.rs:48:15
   |
## |             e.is_conversion_error();
   |             ^ cannot infer type
```
2025-10-07 19:39:08 +02:00
Matthias Krüger
d60f0a2b17
Rollup merge of #147322 - Zalathar:llvm-imports, r=jdonszelmann
cg_llvm: Consistently import `llvm::Type` and `llvm::Value`

We already have other modules that import these types and other types from `llvm`, so having the re-exports `type_::Type` and `value::Value` just distracts rust-analyzer and results in messier and less-consistent imports.

No functional change.
2025-10-07 19:39:07 +02:00
Matthias Krüger
60bbb533df
Rollup merge of #147205 - alexcrichton:wasip3, r=davidtwco
Add a new `wasm32-wasip3` target to Rust

This commit adds a new tier 3 target to rustc, `wasm32-wasip3`. This follows in the footsteps of the previous `wasm32-wasip2` target and is used to represent binding to the WASIp3 set of APIs managed by the WASI subgroup to the WebAssembly Community Group.

As of now the WASIp3 set of APIs are not finalized nor standardized. They're in the process of doing so and the current trajectory is to have the APIs published in December of this year. The goal here is to get the wheels turning in Rust to have the target in a
more-ready-than-nonexistent state by the time this happens in December.

For now the `wasm32-wasip3` target looks exactly the same as `wasm32-wasip2` except that `target_env = "p3"` is specified. This indicates to crates in the ecosystem that WASIp3 APIs should be used, such as the [`wasip3` crate]. Over time this target will evolve as implementation in guest toolchains progress, notably:

* The standard library will use WASIp3 APIs natively once they're finalized in the WASI subgroup.
* Support through `wasi-libc` will be updated to use WASIp3 natively which Rust will then transitively use.
* Longer-term, features such as cooperative multithreading will be added to the WASIp3-track of targets to enable using `std::thread`, for example, on this target.

These changes are all expected to be non-breaking changes for users of this target. Runtimes supporting WASIp3, currently Wasmtime and Jco, support WASIp2 APIs as well and will work with components whether or not they import WASIp2, both WASIp2 and WASIp3, or just WASIp3 APIs. This means that changing the internal implementation details of libstd over time is expected to be a non-breaking change.

[`wasip3` crate]: https://crates.io/crates/wasip3
2025-10-07 19:39:07 +02:00
Matthias Krüger
ffba05ee29
Rollup merge of #146865 - folkertdev:kcfi-only-reify-dyn-compatible, r=rcvalle
kcfi: only reify trait methods when dyn-compatible

fixes https://github.com/rust-lang/rust/issues/146853

Only generate a `ReifyShim` for trait method calls if the trait is dyn-compatible.

Until now kcfi would generate a `ReifyShim` whenever a trait method was cast to a function pointer. But technically the shim is only needed for dyn-compatible traits (where the method might end up in a vtable).

Up to this point that was only slightly inefficient, but in combination with c-variadic trait methods it is wrong. For c-variadic trait methods the generated shim is incorrect, and that is why c-variadic methods make a trait no longer dyn-compatible: we should simply never generate a `ReifyShim` that is c-variadic.

With this change the documentation on `ReifyReason` is now actually correct:

>  If KCFI is enabled, creating a function pointer from a method on a dyn-compatible trait. This includes the case of converting `::call`-like methods on closure-likes to function pointers.

cc ```@maurer``` ```@workingjubilee```

r? ```@rcvalle```
2025-10-07 19:39:06 +02:00
bors
d62f33a7c6 Auto merge of #147449 - matthiaskrgr:rollup-njyi5yr, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#145943 (stdlib docs: document lifetime extension for `format_args!`'s arguments)
 - rust-lang/rust#147243 (cmse: disallow `impl Trait` in `cmse-nonsecure-entry` return types)
 - rust-lang/rust#147402 ([rustdoc] Don't serialize & deserialize data that doesn't go OTW)
 - rust-lang/rust#147418 (Fix target list of `link_section`)
 - rust-lang/rust#147429 (Print tip for human error format in runtest)
 - rust-lang/rust#147441 (Fix comments error for Provenance impls)
 - rust-lang/rust#147442 (c-variadic: fix thir-print for `...` without a pattern)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-07 17:37:56 +00:00
Ralf Jung
8171174715 fix panic with extra-const-ub-checks 2025-10-07 19:16:58 +02:00
Samuel Tardieu
30c73fef62
replace_box: clean-up a bit (#15834)
changelog: none
2025-10-07 17:03:03 +00:00
Ralf Jung
91a9b1fe4d
Merge pull request #4614 from Patrick-6/miri-genmc-mutex
Implement std::sync::Mutex interception for GenMC mode.
2025-10-07 17:01:00 +00:00
Josh Stone
03cdcb5cd5 bootstrap: add Builder::rustc_cmd that includes the lib path
When building with `rust.rpath = false`, every `rustc` invocation needs
to include the library path as well. I particularly ran into this in
`generate_target_spec_json_schema` when testing 1.91-beta in Fedora,
where we do disable rpath for our system builds. The new helper function
will hopefully encourage the right thing going forward.
2025-10-07 09:55:55 -07:00
Marijn Schouten
d52744e9fc iter repeat: panic on last 2025-10-07 16:43:48 +00:00
Ada Alakbarova
01d2adc2f9
replace get_box_inner_type with Ty::boxed_ty 2025-10-07 18:31:46 +02:00
Ada Alakbarova
e5e3bbd9a1
extend the let-chain 2025-10-07 18:31:46 +02:00
Samuel Tardieu
f110f3412d
Fix needless_continue FP when match type is not unit or never (#15547)
Closes rust-lang/rust-clippy#14550
Closes rust-lang/rust-clippy#15548

changelog: [`needless_continue`] fix FP when match type is not unit or
never
2025-10-07 16:24:56 +00:00
Urgau
659575bfbe Add t- prefix to S-waiting-on-{team} labels 2025-10-07 18:15:02 +02:00
yanglsh
13bd9b5d0f fix: needless_continue wrongly unmangled macros 2025-10-08 00:03:48 +08:00
yanglsh
7117bd9a27 fix: needless_continue FP when match type is not unit or never 2025-10-08 00:03:48 +08:00
yanglsh
0415d96f1e Migrate needless_continue to late pass 2025-10-08 00:03:48 +08:00
Samuel Tardieu
0a2eeceefc
Add replace_box lint (#14953)
Adds a new lint that detects `var = Default::default()` when `var` is
`Box<T>` and `T` implements `Default`.

changelog: [`replace_box`]: new lint
2025-10-07 15:56:38 +00:00
dswij
ea54123fd4
fix(collapsible_match): exclude binding modes from struct field pattern suggestions (#15608)
Fixes https://github.com/rust-lang/rust-clippy/issues/13287

changelog: [`collapsible_match`]: exclude binding modes from struct
field pattern suggestions
2025-10-07 15:49:47 +00:00
Matthias Krüger
5f03328084
Rollup merge of #147442 - folkertdev:thir-print-c-variadic, r=fmease
c-variadic: fix thir-print for `...` without a pattern

tracking issue: https://github.com/rust-lang/rust/issues/44930
fixes https://github.com/rust-lang/rust/issues/147409

r? `@fmease`
2025-10-07 17:42:15 +02:00
Matthias Krüger
883032b3d8
Rollup merge of #147441 - chenyukang:yukang-trivial-fix-comments, r=RalfJung
Fix comments error for Provenance impls

r? `@RalfJung`
2025-10-07 17:42:14 +02:00
Matthias Krüger
2d353c35e8
Rollup merge of #147429 - chenyukang:yukang-fix-test-tip, r=fmease
Print tip for human error format in runtest

When working on https://github.com/rust-lang/rust/pull/147354, spent some time to figure out that there is `//~ ERROR` left on test file, this PR will give a better error message for this scenario.
2025-10-07 17:42:13 +02:00
Matthias Krüger
0072d0cd1c
Rollup merge of #147418 - JonathanBrouwer:link_section_targets, r=jdonszelmann
Fix target list of `link_section`

Fixes https://github.com/rust-lang/rust/issues/147411#event-20124673569

r? `@jdonszelmann`
`@rustbot` beta-nominate T-compiler
2025-10-07 17:42:13 +02:00
Matthias Krüger
4461dd9f02
Rollup merge of #147402 - yotamofek:wip/rustdoc/search_index/impl-display, r=GuillaumeGomez
[rustdoc] Don't serialize & deserialize data that doesn't go OTW

`@GuillaumeGomez`
2025-10-07 17:42:12 +02:00
Matthias Krüger
7ab1fd1816
Rollup merge of #147243 - folkertdev:cmse-bail-impl-trait, r=davidtwco
cmse: disallow `impl Trait` in `cmse-nonsecure-entry` return types

tracking issue: https://github.com/rust-lang/rust/issues/75835
fixes https://github.com/rust-lang/rust/issues/147242

Refactors some logic to be more robust in the future, and then disallows `impl Trait` as a return type for the cmse ABIs.

The `is_valid_cmse_output_layout` function disallows `union` values like before. That is not entirely correct, but preserves the current behavior. Some additional logic is needed for `union` values (and any types where parts may be uninitialized) that I'll tackle in a later PR.

can be reviewed commit-by-commit.

r? types
2025-10-07 17:42:11 +02:00
Matthias Krüger
bce59abf1e
Rollup merge of #145943 - dianne:format-args-assign-docs, r=joboet
stdlib docs: document lifetime extension for `format_args!`'s arguments

Since rust-lang/rust#140748 is stable and rust-lang/rust#92698 is closed, the section about `format_args!`'s argument lifetime limitation is outdated. I've updated it to point to the Reference docs, which will specify lifetime extension rules for builtin macros once rust-lang/reference#1980 or equivalent is merged.

I've also taken the liberty of updating one of the doctests to assign the result of `format_args!` to a variable, both to provide an example and because I think it reads a little better.

r? `@m-ou-se`
2025-10-07 17:42:10 +02:00
+merlan #flirora
517ef604af Add replace_box lint 2025-10-07 11:33:54 -04:00
Folkert de Vries
fbdc685ed0
cmse: disallow impl Trait in cmse-nonsecure-entry return types 2025-10-07 17:31:08 +02:00
Jynn Nelson
f7c9b30b1b collect-license-metadata: update submodules before running
Previously, this could cause incorrect failures like the following:
```
diff --git a/license-metadata.json b/license-metadata.json
index 4fb59210854..b1291c00b94 100644
--- a/license-metadata.json
+++ b/license-metadata.json
@@ -244,19 +172,6 @@
             },
             "name": "src/doc/rustc-dev-guide/mermaid.min.js",
             "type": "file"
-          },
-          {
-            "children": [],
-            "license": {
-              "copyright": [
-                "2003-2019 University of Illinois at Urbana-Champaign",
-                "2003-2019 by the contributors listed in CREDITS.TXT (7738295178/llvm/CREDITS.TXT)",
-                "2010 Apple Inc"
-              ],
-              "spdx": "Apache-2.0 WITH LLVM-exception AND NCSA"
-            },
-            "name": "src/llvm-project",
-            "type": "directory"
```

Additionally, this prints a warning if there were untracked files, which
could cause a failure like the following:
```
diff --git a/license-metadata.json b/license-metadata.json
index 4fb59210854..ebf1c478282 100644
--- a/license-metadata.json
+++ b/license-metadata.json
@@ -155,6 +155,22 @@
             "name": "src/librustdoc/html/static/fonts",
             "type": "directory"
           },
+          {
+            "directories": [],
+            "files": [
+              "2015-edition.txt",
+              "diagnostics.json",
+              "license.diff",
+              "test.fixed.rs"
+            ],
+            "license": {
+              "copyright": [
+                "NONE"
+              ],
+              "spdx": "NONE"
+            },
+            "type": "group"
+          },
           {
             "license": {
               "copyright": [
```
2025-10-07 11:30:42 -04:00
Mads Marquart
a914f827c8 Set the minimum deployment target for aarch64-apple-watchos
To match what's done in LLVM 21.
2025-10-07 17:21:24 +02:00
Augie Fackler
eb20c6abd6 PassWrapper: use non-deprecated lookupTarget method
This avoids an extra trip through a triple string by directly passing
the Triple, and has been available since LLVM 21. The string overload
was deprecated today and throws an error on our CI for HEAD due to
-Werror paranoia, so we may as well clean this up now and also skip the
conversion on LLVM 21 since we can.

@rustbot label llvm-main
2025-10-07 11:02:13 -04:00
Arthur Carcano
e98856b6bb Only allocate new string if there are DOS backlines 2025-10-07 16:29:48 +02:00
bors
fed46ffd50 Auto merge of #145608 - Darksonn:derefmut-pin-fix, r=lcnr
Prevent downstream `impl DerefMut for Pin<LocalType>`

The safety requirements for [`PinCoerceUnsized`](https://doc.rust-lang.org/stable/std/pin/trait.PinCoerceUnsized.html) are essentially that the type does not have a malicious `Deref` or `DerefMut` impl. However, the `Pin` type is fundamental, so the end-user can provide their own implementation of `DerefMut` for `Pin<&SomeLocalType>`, so it's possible for `Pin` to have a malicious `DerefMut` impl. This unsoundness is known as rust-lang/rust#85099.

Unfortunately, this means that the implementation of `PinCoerceUnsized` for `Pin` is currently unsound. To fix that, modify the impl so that it becomes impossible for downstream crates to provide their own implementation of `DerefMut` for `Pin` by abusing a hidden struct that is not fundamental.

This PR is a breaking change, but it fixes rust-lang/rust#85099. The PR supersedes rust-lang/rust#144896.

r? lcnr
2025-10-07 14:26:48 +00:00
Folkert de Vries
0a3f1d5b98
c-variadic: fix thir-print for ... without a pattern 2025-10-07 16:00:39 +02:00
Patrick-6
4203fe84fb Implement std::sync::Mutex interception in GenMC mode. 2025-10-07 15:32:57 +02:00
yukang
713e0dddfd Fix comments error for CtfeProvenance 2025-10-07 21:05:45 +08:00
Yotam Ofek
c5ab530749 move serde impls to separate module 2025-10-07 13:37:49 +03:00
yukang
f8ee9f018c Print tip for human error format when check fail 2025-10-07 18:28:31 +08:00