Commit graph

289036 commits

Author SHA1 Message Date
Stuart Cook
16ca18d1da
Rollup merge of #140804 - bend-n:signed, r=lcnr
add signed ints to unn- transmutes to ensure feature parity

i forgot a few cases https://github.com/rust-lang/rust-clippy/pull/14703/#pullrequestreview-2824194994

adds

- char -> i32
-  i32 -> char
- float -> size ()
-  size -> float
-   i32 -> float
``@rustbot`` label L-unnecessary_transmutes
2025-05-09 16:25:04 +10:00
Stuart Cook
b165a4c280
Rollup merge of #140801 - xizheyin:issue-140747, r=SparrowLii
Use span before macro expansion in lint for-loops-over-falibles

Fixes #140747

I think there are going to be a lot of cases where macros are expanded in the compiler resulting in span offsets, and I'd like to know how that's typically handled. Does it have to be handled specially every time?
2025-05-09 16:25:03 +10:00
bors
c8b7f32434 Auto merge of #140176 - dpaoliello:arm64ecdec, r=wesleywiser
Fix linking statics on Arm64EC

Arm64EC builds recently started to fail due to the linker not finding a symbol:
```
symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol)
          C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals
```

It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it.

The fix is to have Rust not prefix statics with `#` when importing.

Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them.

CI found another bug: we only apply `DllImport` to non-local statics that aren't foreign items (i.e., in an `extern` block), that is we want to use `DllImport` for statics coming from other Rust crates. However, `__rust_no_alloc_shim_is_unstable` is a static generated by the Rust compiler if required, but downstream crates consider it a foreign item since it is declared in an `extern "Rust"` block, thus they do not apply `DllImport` to it and so fails to link if it is exported by the previous crate as `DATA`. The fix is to apply `DllImport` to foreign items that are marked with the `rustc_std_internal_symbol` attribute (i.e., we assume they aren't actually foreign and will be in some Rust crate).

Fixes #138541

---
try-job: dist-aarch64-msvc
try-job: dist-x86_64-msvc
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
2025-05-09 00:43:28 +00:00
bors
667247db71 Auto merge of #140818 - matthiaskrgr:rollup-5eaotr2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #140095 (Eliminate `word_and_empty` methods.)
 - #140341 (Clarify black_box warning a bit)
 - #140684 (Only include `dyn Trait<Assoc = ...>` associated type bounds for `Self: Sized` associated types if they are provided)
 - #140707 (Structurally normalize in range pattern checking in HIR typeck)
 - #140716 (Improve `-Zremap-path-scope` tests with dependency)
 - #140800 (Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linux)
 - #140802 (Add release notes for 1.87.0)
 - #140811 (Enable triagebot note functionality for rust-lang/rust)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-08 21:32:19 +00:00
Matthias Krüger
4e4d6ad43c
Rollup merge of #140811 - jieyouxu:notes, r=Urgau
Enable triagebot note functionality for rust-lang/rust

Docs: <https://forge.rust-lang.org/triagebot/note.html>.

r? `@Urgau`
2025-05-08 20:22:25 +02:00
Matthias Krüger
196b5cbb9b
Rollup merge of #140802 - BoxyUwU:relnotes_1_87_0, r=pietroalbini
Add release notes for 1.87.0

Originally drafted in #140133

cc `@rust-lang/release`

r? `@pietroalbani` as you're running the release
2025-05-08 20:22:23 +02:00
Matthias Krüger
8d7a4c286b
Rollup merge of #140800 - GuillaumeGomez:rustdoc-tempdir-removal, r=jieyouxu
Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linux

Follow-up of #140706.

r? `@jieyouxu`
2025-05-08 20:22:21 +02:00
Matthias Krüger
1aa0dd2dc8
Rollup merge of #140716 - Urgau:improve-remap_scope-tests, r=jieyouxu
Improve `-Zremap-path-scope` tests with dependency

This PR greatly improves our coverage of `-Zremap-path-scope` for diagnostic paths and macros with dependencies.

r? `@jieyouxu` (since we talked about it)

try-job: x86_64-msvc-1
2025-05-08 20:22:20 +02:00
Matthias Krüger
f7168af76f
Rollup merge of #140707 - compiler-errors:range-pat-struct-norm, r=lcnr
Structurally normalize in range pattern checking in HIR typeck

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/200

r? lcnr
2025-05-08 20:22:18 +02:00
Matthias Krüger
a054be7434
Rollup merge of #140684 - compiler-errors:unnecessary-assoc, r=lcnr
Only include `dyn Trait<Assoc = ...>` associated type bounds for `Self: Sized` associated types if they are provided

Since #136458, we began filtering out associated types with `Self: Sized` bounds when constructing the list of associated type bounds to put into our `dyn Trait` types. For example, given:

```rust
trait Trait {
    type Assoc where Self: Sized;
}
```

After #136458, even if a user writes `dyn Trait<Assoc = ()>`, the lowered ty would have an empty projection list, and thus be equivalent to `dyn Trait`. However, this has the side effect of no longer constraining any types in the RHS of `Assoc = ...`, not implying any WF implied bounds, and not requiring that they hold when unsizing.

After this PR, we include these bounds, but (still) do not require that they are provided. If the are not provided, they are skipped from the projections list.

This results in `dyn Trait` types that have differing numbers of projection bounds. This will lead to re-introducing type mismatches e.g. between `dyn Trait` and `dyn Trait<Assoc = ()>`. However, this is expected and doesn't suffer from any of the deduplication unsoundness from before #136458.

We may want to begin to ignore thse bounds in the future by bumping `unused_associated_type_bounds` to an FCW. I don't want to tangle that up into the fix that was originally intended in #136458, so I'm doing a "fix-forward" in this PR and deferring thinking about this for the future.

Fixes #140645

r? lcnr
2025-05-08 20:22:16 +02:00
Matthias Krüger
32e3207969
Rollup merge of #140341 - saethlin:black-box-qoi, r=Mark-Simulacrum
Clarify black_box warning a bit

Trying to bring the docs on black_box more in line with the advice that we have discussed in Zulip.

https://github.com/rust-lang/rust/pull/140341#issuecomment-2832592382
2025-05-08 20:22:13 +02:00
Matthias Krüger
6914d83de9
Rollup merge of #140095 - nnethercote:rm-word_or_empty, r=jdonszelmann
Eliminate `word_and_empty` methods.

To remove the last remaining `Ident::empty` uses.

r? `@jdonszelmann`
2025-05-08 20:22:09 +02:00
bors
50aa041807 Auto merge of #140786 - Kobzol:try-builds-no-deny-warnings, r=jieyouxu
Do not deny warnings in "fast" try builds

When we do the classic ``@bors` try` build without specifying `try-job` in the PR description, we want to get a compiler toolchain for perf./crater/local experimentation as fast as possible. We don't run any tests in that case, so it seems reasonable to also ignore warnings.

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

r? `@jieyouxu`

try-job: dist-x86_64-linux
2025-05-08 18:21:54 +00:00
bendn
3b4c4938c5
add signed integers to unnecessary_lints to ensure feature parity with clippy 2025-05-08 23:16:49 +07:00
Jieyou Xu
c9a96eb379
Enable triagebot note functionality for rust-lang/rust
See <https://forge.rust-lang.org/triagebot/note.html>.
2025-05-09 00:00:52 +08:00
bors
fe348cd1a8 Auto merge of #140797 - matthiaskrgr:rollup-3km95qh, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #140736 (trait selection: check `&` before suggest remove deref)
 - #140755 ([win][arm64] Disable various DebugInfo tests that don't work on Arm64 Windows)
 - #140756 ([arm64] Pointer auth test should link with C static library statically)
 - #140758 ([win][arm64] Disable MSVC Linker 'Arm Hazard' warning)
 - #140759 ([win][arm64] Disable std::fs tests that require symlinks)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-08 15:09:05 +00:00
Michael Goulet
9af6ee50ed Structurally resolve in check_ref_cast and calc_adjust_mode 2025-05-08 15:00:17 +00:00
Jakub Beránek
4f9bb8c735
Mention fast try builds in the rustc-dev-guide 2025-05-08 16:00:48 +02:00
Boxy
a278f8dcea Add release notes for 1.87.0 2025-05-08 14:33:52 +01:00
Guillaume Gomez
41ff588c70 Make rustdoc-tempdir-removal run-make tests work on other platforms than linux 2025-05-08 15:24:05 +02:00
xizheyin
88c1796384 Use span before macro expansion in lint for-loops-over-falibles
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-08 21:17:33 +08:00
xizheyin
c0f0b5157f
Add ui test for for-loops-over-falibles
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-08 21:17:28 +08:00
Ben Kimock
f501775ec8 Indicate that the warning on black_box is a general property of Rust
And note that the same limitation applies to all LLVM-based compilers

Co-authored-by: Ralf Jung <post@ralfj.de>
2025-05-08 09:03:57 -04:00
Urgau
f959039994 Rework -Zremap-path-scope macro test with dependency check 2025-05-08 15:02:58 +02:00
Jakub Beránek
082777e088
Do not deny warnings for fast try builds 2025-05-08 14:52:38 +02:00
Urgau
fc0f0a8add Add tests for -Zremap-path-scope and paths in diagnostics with deps 2025-05-08 14:24:31 +02:00
Matthias Krüger
7fc43e50c7
Rollup merge of #140759 - dpaoliello:symlink, r=workingjubilee
[win][arm64] Disable std::fs tests that require symlinks

While trying to get the aarch64-msvc build working correctly (#140136), various tests in `std::fs` were failing as the Arm64 Windows runner image we are using does not have Developer Mode enabled, thus it cannot create symlinks.

I've [filed a request to get Developer Mode enabled](https://github.com/actions/partner-runner-images/issues/94), but in the meantime I've disabled the relevant tests on Arm64 Windows.
2025-05-08 13:55:46 +02:00
Matthias Krüger
54f1da4486
Rollup merge of #140758 - dpaoliello:armhazard, r=jieyouxu
[win][arm64] Disable MSVC Linker 'Arm Hazard' warning

While trying to get the aarch64-msvc build working correctly (#140136), I observed the following test failure:

From <https://github.com/rust-lang/rust/pull/140136#issuecomment-2848179657>

```
  = note: main.main.d17f5fbe6225cf88-cgu.0.rcgu.o : fatal error LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419) in section 0x57; please consider using compiler option /Gy if it was not used
```

This is warning of a code sequence that triggers a bug in Cortex-A53 processors: <https://developer.arm.com/documentation/epm048406/latest>

However, since Windows 10 isn't supported on the Cortex-A53, this warning is not required, so it can be suppressed using the undocumented `/arm64hazardfree` flag.
2025-05-08 13:55:45 +02:00
Matthias Krüger
12d6a47bda
Rollup merge of #140756 - dpaoliello:paclink, r=jieyouxu
[arm64] Pointer auth test should link with C static library statically

While trying to get the aarch64-msvc build working correctly (#140136), the `pointer-auth-link-with-c` test was failing.

The pointer auth test builds its C library statically:
3ef8e64ce9/tests/run-make/pointer-auth-link-with-c/rmake.rs (L15)

However, the Rust code did not indicate the link kind, so it defaulted to dynamic which then fails on Windows.
2025-05-08 13:55:45 +02:00
Matthias Krüger
13ad11821e
Rollup merge of #140755 - dpaoliello:arm64windebuginfo, r=jieyouxu
[win][arm64] Disable various DebugInfo tests that don't work on Arm64 Windows

While trying to get the aarch64-msvc build working correctly (#140136), various DebugInfo related tests were failing.

I've added comments to each test to indicate why it is disabled and linked to appropriate bugs.

* `tests/debuginfo/step-into-match.rs`: Stepping at the end of a function on goes to the callsite, not the instruction after it.
* `tests/debuginfo/type-names.rs`: Arm64 Windows cdb doesn't support JavaScript extensions. Followed up with the Microsoft Debugger Tools team to fix this.
* `tests/ui/runtime/backtrace-debuginfo.rs`: Backtraces are truncated due to #140489
2025-05-08 13:55:44 +02:00
Matthias Krüger
4ed13189ec
Rollup merge of #140736 - xizheyin:issue-140166, r=petrochenkov
trait selection: check `&` before suggest remove deref

FIxes #140166

r? compiler
2025-05-08 13:55:44 +02:00
bors
e964ccafed Auto merge of #140732 - onur-ozkan:use-in-tree-rustfmt, r=Kobzol
make it possible to run in-tree rustfmt with `x run rustfmt`

Currently, there is no way to run in-tree `rustfmt` using `x fmt` or `x test tidy` commands. This PR implements `rustfmt` on `x run`, which allows bootstrap to run the in-tree `rustfmt`.

Fixes #140723
2025-05-08 11:53:39 +00:00
Jakub Beránek
34495f5895
Migrate opt-dist to edition 2024 2025-05-08 10:18:17 +02:00
Jakub Beránek
52fcf33ed7
Remove unused dependency from opt-dist 2025-05-08 10:17:21 +02:00
onur-ozkan
e85d014244 add change-entry for x run rustfmt
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-08 10:18:17 +03:00
onur-ozkan
1a18da5674 implement x run rustfmt
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-08 10:18:05 +03:00
bors
1973872013 Auto merge of #140781 - matthiaskrgr:rollup-90sig9g, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #140260 (Only prefer param-env candidates if they remain non-global after norm)
 - #140523 (Better error message for late/early lifetime param mismatch)
 - #140579 (Remove estebank from automated review assignment)
 - #140641 (detect additional uses of opaques after writeback)
 - #140711 (Do not discard constraints on overflow if there was candidate ambiguity)
 - #140762 (rustdoc-json: Remove newlines from attributes)
 - #140764 (style: Never break within a nullary function call `func()` or a unit literal `()`)
 - #140769 (Add `DefPathData::OpaqueLifetime` to avoid conflicts for remapped opaque lifetimes)
 - #140773 (triagebot: Better message for changes to `tests/rustdoc-json`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-08 06:52:42 +00:00
Matthias Krüger
526923ad05
Rollup merge of #140773 - aDotInTheVoid:rdj-triagdfsadgs, r=dtolnay
triagebot: Better message for changes to `tests/rustdoc-json`

Followup to #140689 / #140606

Adds a message to changes to `tests/rustdoc-json`, instead of just pinging me. Hopefully this makes the significance of these tests clearer to people who otherwise wouldn't have context, so hopefully we can avoid that happening again. It's annoyingly hard to know how well this works, because the real test is seeing if it doesn't get ignored.

Predrag has [kindly offered](https://github.com/rust-lang/rust/issues/140689#issuecomment-2855602664) to also get pinged here.

cc ``@jyn514`` ``@obi1kenobi``

r? ``@GuillaumeGomez``
2025-05-08 08:14:21 +02:00
Matthias Krüger
34feb216e6
Rollup merge of #140769 - Zoxc:fix-140731, r=oli-obk
Add `DefPathData::OpaqueLifetime` to avoid conflicts for remapped opaque lifetimes

This adds `DefPathData::OpaqueLifetime` to ensure the def paths for remapped opaque lifetimes remain unique.

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

r? ``@oli-obk``
2025-05-08 08:14:20 +02:00
Matthias Krüger
b330d04b2d
Rollup merge of #140764 - joshtriplett:style-nullary-functions, r=traviscross
style: Never break within a nullary function call `func()` or a unit literal `()`

Implements https://github.com/rust-lang/style-team/issues/210
2025-05-08 08:14:19 +02:00
Matthias Krüger
cd235bdec8
Rollup merge of #140762 - aDotInTheVoid:popnl, r=GuillaumeGomez
rustdoc-json: Remove newlines from attributes

Fixes #140689

Not sure if this needs to bump `FORMAT_VERSION` or not.

r? ``@GuillaumeGomez``

cc ``@obi1kenobi``
2025-05-08 08:14:19 +02:00
Matthias Krüger
74b79aee60
Rollup merge of #140711 - compiler-errors:combine-maybes, r=lcnr
Do not discard constraints on overflow if there was candidate ambiguity

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/201.

There's a pretty chunky justification in the test.

r? lcnr
2025-05-08 08:14:18 +02:00
Matthias Krüger
aace48811b
Rollup merge of #140641 - lcnr:opaque-type-storage-entries, r=compiler-errors
detect additional uses of opaques after writeback

Based on #140607. It's a lot harder to encounter in practice than I though 😅 😁 I've still added it with the expectation that somebody will encounter it at some point.

Also modifies the `EvalCtxt` to use the same impl to detect newly added opaque types.

r? ``@compiler-errors``
2025-05-08 08:14:18 +02:00
Matthias Krüger
1521f2cff3
Rollup merge of #140579 - jieyouxu:temp-remove, r=wesleywiser
Remove estebank from automated review assignment

First of all, Esteban thanks for all the reviews 💙

I think you've been quite busy IRL recently, so I'm proposing to remove you from the *automated* review assignment to prevent randomly rolling compiler PRs to you until you have more availability. If this is just temporary, please close this PR!

This is [just a way to improve our fairness when assigning reviews, trying to find a balance between leaving time to Rust contributors review on their terms and availability and avoid having PRs waiting for too long](https://github.com/rust-lang/compiler-team/issues/856).

> [!NOTE]
>
> This only prevents randomly-rolled compiler PRs from being auto assigned to you, it does not prevent explicit `r?` assignments.

**Please feel free to re-add yourself back to the active review rotation once you have more availability (if you feel like it).**

- If you want, it's also possible to only opt-out of the *general* compiler review rotation (`r? compiler`) but keep e.g. `r? diagnostics` rolls.

r? compiler_leads
2025-05-08 08:14:17 +02:00
Matthias Krüger
a810f8ac89
Rollup merge of #140523 - compiler-errors:late-early-mismatch, r=jackh726
Better error message for late/early lifetime param mismatch

Rework the way we report early-/late-bound lifetime param mismatches to equate the trait and impl signatures using region variables, so that we can detect when a late-bound param is present in the signature in place of an early-bound param, or vice versa.

The diagnostic is a bit more technical, but it's more obviously clear to see what the problem is, even if it's not great at explaining how to fix it. I think this could be improved further, but I still think it's much better than what exists today.

Note to reviewer(s): I'd appreciate if we didn't bikeshed *too* much about this verbiage, b/c I hope it's clear that the old message sucked a lot. I'm happy to file bugs for interested new contributors to improve the messaging further.

Edit(fmease): Fixes https://github.com/rust-lang/rust/issues/33624.
2025-05-08 08:14:16 +02:00
Matthias Krüger
8a3ab85e7d
Rollup merge of #140260 - compiler-errors:only-global-post-norm, r=lcnr
Only prefer param-env candidates if they remain non-global after norm

Introduce `CandidateSource::GlobalParamEnv`, and dynamically compute the `CandidateSource` based on whether the predicate contains params *post-normalization*.

This code needs some cleanup and documentation. I'm just putting this up for review.

cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/179

r? lcnr
2025-05-08 08:14:16 +02:00
bors
7e552b46af Auto merge of #140106 - dianne:deref-pat-usefulness, r=Nadrieril
allow deref patterns to participate in exhaustiveness analysis

Per [this proposal](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Exhaustiveness), this PR allows deref patterns to participate in exhaustiveness analysis. Currently all deref patterns enforce `DerefPure` bounds on their scrutinees, so this assumes all patterns it's analyzing are well-behaved. This also doesn't support [mixed exhaustiveness](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Mixed-exhaustiveness), and instead emits an error if deref patterns are used together with normal constructors. I think mixed exhaustiveness would be nice to have (especially if we eventually want to support arbitrary `Deref` impls[^1]), but it'd require more work to get reasonable diagnostics[^2].

Tracking issue for deref patterns: #87121

r? `@Nadrieril`

[^1]: Regardless of whether we support limited exhaustiveness checking for untrusted `Deref` or always require other arms to be exhaustive, I think it'd be useful to allow mixed matching for user-defined smart pointers. And it'd be strange if it worked there but not for `Cow`.

[^2]: I think listing out witnesses of non-exhaustiveness can be confusing when they're not necessarily disjoint, and when you only need to cover some of them, so we'd probably want special formatting and/or explanatory subdiagnostics. And if it's implemented similarly to unions, we'd probably also want some way of merging witnesses; the way witnesses for unions can appear duplicated is pretty unfortunate. I'm not sure yet how the diagnostics should look, especially for deeply nested patterns.
2025-05-08 02:16:45 +00:00
bors
ae3e8c6191 Auto merge of #140751 - GuillaumeGomez:rollup-eahw4ta, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #140234 (Separate dataflow analysis and results)
 - #140614 (Correct warning message in restricted visibility)
 - #140671 (Parser: Recover error from named params while parse_path)
 - #140700 (Don't crash on error codes passed to `--explain` which exceed our internal limit of 9999 )
 - #140706 ([rustdoc] Ensure that temporary doctest folder is correctly removed even if doctests failed)
 - #140734 (Fix regression from #140393 for espidf / horizon / nuttx / vita)
 - #140741 (add armv5te-unknown-linux-gnueabi target maintainer)
 - #140745 (run-make-support: set rustc dylib path for cargo wrapper)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-07 23:03:25 +00:00
Alona Enraght-Moony
1799f5f8a9 triagebot: Better message for changes to tests/rustdoc-json 2025-05-07 21:33:04 +00:00
onur-ozkan
34c42c8f31 do not allow stage > 0 on x fmt
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-07 23:37:30 +03:00