Commit Graph

46432 Commits

Author SHA1 Message Date
Daniel Paoliello
35679bad98 Enable non-leaf Frame Pointers for Arm64EC Windows 2025-05-09 11:44:22 -07:00
bors
dcecb99176 Auto merge of #140839 - pietroalbini:pa-version-bump, r=pietroalbini
Bump version number to 1.89.0

Part of the release process. This PR must not be rolled up.

Closes #129461.

r? `@ghost`
2025-05-09 12:13:38 +00:00
Jieyou Xu
7dae31828b
Disarm time bomb (diagnostics)
Revert "Rollup merge of #129343 - estebank:time-version, r=jieyouxu"

This reverts commit 26f75a65d7, reversing
changes made to 2572e0e8c9.

Imports are modified to fix merge conflicts and remove unused ones.
2025-05-09 12:09:15 +02:00
bors
da1e442ebd Auto merge of #140838 - Zalathar:rollup-13hybry, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - #140801 (Use span before macro expansion in lint for-loops-over-falibles)
 - #140804 (add signed ints to unn- transmutes to ensure feature parity)
 - #140812 (Fix `tests/rustdoc-json` triagebot message path)
 - #140817 (bootstrap: more consistent use of `...` when citing configuration snippets)
 - #140828 (Enable non-leaf Frame Pointers for Arm64 Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-09 08:31:19 +00:00
Stuart Cook
d91e86e963
Rollup merge of #140828 - dpaoliello:arm64fp, r=workingjubilee
Enable non-leaf Frame Pointers for Arm64 Windows

Microsoft recommends enabling frame pointers for Arm64 Windows as it enables fast stack walking, from <https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers>:

> The frame pointer (x29) is required for compatibility with fast stack walking used by ETW and other services. It must point to the previous {x29, x30} pair on the stack.

I'm setting this to "non-leaf" as leaf functions shouldn't be spilling registers and so won't touch the frame pointer.
2025-05-09 16:25:06 +10:00
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
a7b1b24587 Auto merge of #140252 - nnethercote:rm-Ident-empty, r=oli-obk
Remove `Ident::empty`

All uses have been removed. And it's nonsensical: an identifier by definition has at least one char.

r? `@oli-obk`
2025-05-09 05:16:40 +00:00
Nicholas Nethercote
0984db553d Remove Ident::empty.
All uses have been removed. And it's nonsensical: an identifier by
definition has at least one char.

The commits adds an is-non-empty assertion to `Ident::new` to enforce
this, and converts some `Ident` constructions to use `Ident::new`.
Adding the assertion requires making `Ident::new` and
`Ident::with_dummy_span` non-const, which is no great loss.

The commit amends a couple of places that do path splitting to ensure no
empty identifiers are created.
2025-05-09 13:57:49 +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
Daniel Paoliello
d951c41a68 Enable non-leaf Frame Pointers for Arm64 Windows 2025-05-08 13:18:18 -07: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
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
bendn
3b4c4938c5
add signed integers to unnecessary_lints to ensure feature parity with clippy 2025-05-08 23:16:49 +07:00
Michael Goulet
9af6ee50ed Structurally resolve in check_ref_cast and calc_adjust_mode 2025-05-08 15:00:17 +00: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
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
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
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
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
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
John Kåre Alsaker
5913e55dfc Add DefPathData::OpaqueLifetime to avoid conflicts for remapped opaque lifetimes 2025-05-07 22:17:29 +02:00
bors
e9f8103f93 Auto merge of #140590 - lcnr:closure-in-dead-code, r=compiler-errors
borrowck nested items in dead code

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

r? `@compiler-errors`
2025-05-07 19:49:36 +00:00
Daniel Paoliello
75ca6c621e [win][arm64] Disable MSVC Linker 'Arm Hazard' warning 2025-05-07 12:02:14 -07:00
Michael Goulet
f03d246db9 Better error message for late/early lifetime param mismatch 2025-05-07 18:12:54 +00:00
lcnr
e7979eab89 detect additional uses of opaques after writeback 2025-05-07 17:59:51 +00:00
lcnr
fc0ef54fd9 opaque_type_storage to InferCtxtLike 2025-05-07 17:58:20 +00:00
Daniel Paoliello
6dabf7ea3a [Arm64EC] Only decorate functions with # 2025-05-07 10:36:12 -07:00
Michael Goulet
3799d8427a Review 2025-05-07 17:29:12 +00:00
Michael Goulet
b27d630f89 Point out region bound mismatches in check_region_bounds_on_impl_item 2025-05-07 17:13:39 +00:00
Michael Goulet
a910329c67 Use MaybeCause::or to allow constraints from overflows if they are combined with ambiguity 2025-05-07 17:12:15 +00:00
Michael Goulet
fd37906477 Only include associated type bounds for Self:Sized associated types if they are provided 2025-05-07 16:36:55 +00:00
Michael Goulet
8a21d1b495 Review 2025-05-07 16:29:49 +00:00
Guillaume Gomez
7d372aec2f
Rollup merge of #140700 - Kivooeo:new-fix-six, r=davidtwco,fmease
Don't crash on error codes passed to `--explain` which exceed our internal limit of 9999

removed panic in case where we do `--explain > 9999` and added check for it

now error looks like this instead of ICE
```
$ rustc.exe --explain E10000
error: E10000 is not a valid error code
```
fixes #140647
r? `@fmease`
2025-05-07 18:19:06 +02:00
Guillaume Gomez
32325e1dec
Rollup merge of #140671 - xizheyin:issue-140169, r=petrochenkov
Parser: Recover error from named params while parse_path

Fixes #140169

I added test to the first commit and the second added the code and changes to test.

r? `@petrochenkov`
2025-05-07 18:19:06 +02:00
Guillaume Gomez
f7a9c672f0
Rollup merge of #140614 - yuk1ty:fix-invalid-module-name-visibility, r=davidtwco
Correct warning message in restricted visibility

Fixes #131220
2025-05-07 18:19:05 +02:00
Guillaume Gomez
82c99c41c0
Rollup merge of #140234 - nnethercote:separate-Analysis-and-Results, r=davidtwco
Separate dataflow analysis and results

`Analysis` gets put into `Results` with `EntryStates`, by `iterate_to_fixpoint`. This has two problems:
- `Results` is passed various places where only `Analysis` is needed.
- `EntryStates` is passed around mutably everywhere even though it is immutable.

This commit mostly separates `Analysis` from `Results` and fixes these two problems.

r? `@davidtwco`
2025-05-07 18:19:04 +02:00
Michael Goulet
1f774d74b3 Only prefer param-env candidates if they remain non-global after norm 2025-05-07 16:00:21 +00:00
Michael Goulet
df13f7c1fa Require T: TypeFoldable in Binder<T> visit 2025-05-07 16:00:21 +00:00
xizheyin
bd88f3e3e3
Check & before suggest remove deref when trait_selection
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-07 23:23:25 +08:00
xizheyin
b922da3586 Use parse_param_general when parsing (T, U)->R in parse_path_segment
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>

Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2025-05-07 22:56:14 +08:00
bors
3ef8e64ce9 Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obk
Use thread local dep graph encoding

This adds thread local encoding of dep graph nodes. Each thread has a `MemEncoder` that gets flushed to the global `FileEncoder` when it exceeds 64 kB. Each thread also has a local cache of dep indices. This means there can now be empty gaps in `SerializedDepGraph`.

Indices are marked green and also allocated by the new atomic operation `DepNodeColorMap::try_mark_green` as the encoder lock is removed.
2025-05-07 12:39:54 +00:00
bors
db0e836148 Auto merge of #140735 - GuillaumeGomez:rollup-dlhbxsg, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #139518 (Stabilize precise capture syntax in style guide)
 - #140398 (Fix backtrace for cygwin)
 - #140719 (fix typo in autorefs lint doc example)
 - #140724 (Update `compiler-builtins` to 0.1.158)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-07 09:31:15 +00:00
Guillaume Gomez
763209e422
Rollup merge of #140719 - wyfo:patch-1, r=lcnr
fix typo in autorefs lint doc example

The documentation is talking about other way using only raw pointers, but the example was use `std::slice::from_raw_parts_mut` which also create a reference. `std::ptr::slice_from_raw_parts_mut` should be used instead, and it also highlights the benefit of raw pointer manipulation compared to dereference, as the function doesn't need to be unsafe anymore.

Moreover, [`unsafe_op_in_unsafe_fn`](https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html) warning has been enabled since Edition 2024, so I've updated the examples to use unsafe blocks.
2025-05-07 10:50:49 +02:00
bors
f76c7367c6 Auto merge of #137995 - hkBst:parse_format_reuse_unescape, r=nnethercote
Remove duplicate impl of string unescape from parse_format

r? `@nnethercote`
2025-05-07 06:18:39 +00:00