Commit Graph

341213 Commits

Author SHA1 Message Date
Roland Xu
af2ca5267d Rollup merge of #163170 - mejrs:hir_imports, r=oli-obk
Update deprecated rustc_hir imports

Followup to https://github.com/rust-lang/rust/pull/160336

That's ~half of them, I'm not doing it all in one go to reduce conflicts.
2026-09-23 09:55:44 +08:00
bors
1a82b5d4f4 Auto merge of #163178 - JonathanBrouwer:rollup-NTC54oC, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#156949 (Detect missing else in let statement)
 - rust-lang/rust#160436 (stabilize `Box::take`)
 - rust-lang/rust#160570 (macro_metavar_expr_concat: support concatenating into string literals)
 - rust-lang/rust#162837 (Dedicated Display type for CStr::display)
 - rust-lang/rust#163099 (Use wrapping arithmetic in `from_str_radix`)
 - rust-lang/rust#163166 (Tiny cleanups to deferred liveness)
 - rust-lang/rust#161667 (Add `f16` inline ASM support for `nvptx64-nvidia-cuda`)
 - rust-lang/rust#163063 (Restore `Send` and `Sync` for `BorrowedCursor`)
 - rust-lang/rust#163097 (OpenBSD/sparc64 has switched from GCC to Clang)
 - rust-lang/rust#163126 (Skip redundant storage-conflict updates during coroutine layout)
 - rust-lang/rust#163135 (librustdoc: remove stale dep on base64)
 - rust-lang/rust#163146 (tests: Update `f16b` codegen test for LoongArch and RISC-V)
 - rust-lang/rust#163159 (treat inductive cycles as ambig)
2026-09-22 22:27:20 +00:00
mejrs
78d478a7e4 Update deprecated rustc_hir imports 2026-09-22 23:31:09 +02:00
Jonathan Brouwer
f3aca55a43 Rollup merge of #163159 - lcnr:inductive-cycles-ambig, r=oli-obk
treat inductive cycles as ambig

We needed inductive cycles to be `NoSolution` for proper `ParamEnv` normalization. With rust-lang/rust#158643 this is no longer necessary, so lets make the stabilization of the new solver as small as possible.

r? types
2026-09-22 22:50:38 +02:00
Jonathan Brouwer
4ae1ff393b Rollup merge of #163146 - heiher:ignore-f16b-la-rv, r=lqd
tests: Update `f16b` codegen test for LoongArch and RISC-V

Fixes rust-lang/rust#163145
2026-09-22 22:50:37 +02:00
Jonathan Brouwer
5586b8f14d Rollup merge of #163135 - durin42:base64-upgrade, r=Urgau
librustdoc: remove stale dep on base64

This appears to have become unused in August 2025. I noticed today because of trying to consolidate versions of things in the toolchain.
2026-09-22 22:50:36 +02:00
Jonathan Brouwer
50ee4f4d26 Rollup merge of #163126 - charliermarsh:charlie/conflicts, r=oli-obk
Skip redundant storage-conflict updates during coroutine layout

## Summary

When computing coroutine storage conflicts, we currently record conflicts between every pair in the live set. This PR instead remembers the last live set whose conflicts were recorded; if the current set is a subset, we skip the matrix updates. For example, after recording `{a, b, c}`, observing `{a, b}` adds no new conflicts.

I used an LLM to profile this change, and saw a compiler CPU reduction in the following projects:

- Codex: 2.69%
- Ruff: 2.84%
- uv: 5.28%
- ty: 3.28%
2026-09-22 22:50:35 +02:00
Jonathan Brouwer
f651c1ef25 Rollup merge of #163097 - brad0:librustc_llvm_sparc64, r=folkertdev
OpenBSD/sparc64 has switched from GCC to Clang
2026-09-22 22:50:34 +02:00
Jonathan Brouwer
164929d02d Rollup merge of #163063 - Ddystopia:borrowed-cursor-send-sync, r=clarfonthey
Restore `Send` and `Sync` for `BorrowedCursor`

In rust-lang/rust#160563 `Send` and `Sync` was accidentally [removed] from `BorrowedCursor`, now they're added back. This is fine because they're used equivalently to `&mut T`.

[removed]: https://github.com/rust-lang/rust/pull/160563#issuecomment-5747025806
2026-09-22 22:50:33 +02:00
Jonathan Brouwer
c81d09ca81 Rollup merge of #161667 - beetrees:f16-inline-asm-nvptx, r=folkertdev
Add `f16` inline ASM support for `nvptx64-nvidia-cuda`

This PR adds `f16` inline ASM support for `nvptx64-nvidia-cuda`.

Ping target maintainers: @kjetilkjeka @kulst

Tracking issues:
`f16` inline ASM: rust-lang/rust#125398 (part of rust-lang/rust#116909)
PTX inline ASM: rust-lang/rust#93335
2026-09-22 22:50:32 +02:00
Jonathan Brouwer
0ca8d6e96d Rollup merge of #163166 - lqd:deferred-liveness, r=jackh726
Tiny cleanups to deferred liveness

As discussed on zulip, this is the first batch of a handful of tiny cleanups about deferred liveness:
- some renamings
- some simplifications
- some comments

r? @jackh726
2026-09-22 22:50:31 +02:00
Jonathan Brouwer
fa0d183f6f Rollup merge of #163099 - maxdexh:int-from-str-loop-unchecked, r=Darksonn
Use wrapping arithmetic in `from_str_radix`

Uses wrapping arithmetic in the fast/unchecked loop of `from_str_radix`.

Originally this PR was written using unchecked arithmetic:
This generates identical assembly when compiling with `-O`: https://godbolt.org/z/Gvb7G9YEM
However, it significantly simplifies the asm of `-O -Coverflow-checks` (e.g. RfL): https://godbolt.org/z/Pah9fMfrd
More precisely, the `-O -Coverflow-checks` output becomes identical to the `-O` one: https://godbolt.org/z/WoYMThP8e
In conclusion, it makes more sense to use wrapping operations here.
2026-09-22 22:50:30 +02:00
Jonathan Brouwer
6d10830164 Rollup merge of #162837 - clarfonthey:c-str-display, r=Darksonn
Dedicated Display type for CStr::display

Tracking issue: rust-lang/rust#139984

Should resolve the FCP concern.
2026-09-22 22:50:29 +02:00
Jonathan Brouwer
9c60af04d0 Rollup merge of #160570 - mejrs:concat_str, r=petrochenkov
macro_metavar_expr_concat: support concatenating into string literals

Usually if you want to concatenate string literals in macros you expand into some combination of concat! and stringify! invocations. However this does not work in nested MetaItems, since those are never expanded (unlike `#[path = EXPR]` attributes like `#[doc = include_str!("README.md")]`.

This PR adds support for that using `${concat_str(...)}`, similar to `${concat(...)}`. It is unstable under the same `macro_metavar_expr_concat` feature. See the tests in this PR for examples.

My motivation for adding this is that I've seen (and had myself) some cases where this would have been really useful. Thus I'd like to add this experimentally.
2026-09-22 22:50:28 +02:00
Jonathan Brouwer
1b7b9eaf79 Rollup merge of #160436 - edwloef:stabilize-box-take, r=Darksonn
stabilize `Box::take`

Tracking issue: rust-lang/rust#147212

There hasn't been any activity on the tracking issue for a while, and this is a pretty small feature, so opening this to hopefully get a FCP started.

Closes: rust-lang/rust#147212
2026-09-22 22:50:28 +02:00
Jonathan Brouwer
bcf6cb7e9f Rollup merge of #156949 - bb1yd:detect-missing-else, r=estebank
Detect missing else in let statement

Fixes rust-lang/rust#135857

I add the help message in rustc_resolve. It now will display something like this:
```rust
error: expected identifier, found keyword `return`
 --> ./test.rs:8:24
  |
8 |      let Some(a) = bar{return;};
  |                    --- ^^^^^^ expected identifier, found keyword
  |                    |
  |                    while parsing this struct
  |
help: escape `return` to use it as an identifier
  |
8 |      let Some(a) = bar{r#return;};
  |                        ++

error[E0574]: expected struct, variant or union type, found local variable `bar`
 --> ./test.rs:8:20
  |
8 |      let Some(a) = bar{return;};
  |                    ^^^ not a struct, variant or union type
  |
help: try adding `else` here:
  |
8 |      let Some(a) = bar else {return;};
  |                        ++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0574`.
```
r? estebank
2026-09-22 22:50:27 +02:00
Max Dexheimer
84a341bb5c Use wrapping arithmetic in from_str_radix 2026-09-22 20:25:21 +02:00
bors
6bb1652a02 Auto merge of #163165 - JonathanBrouwer:rollup-qpPoMbu, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#162628 (Move `Const` from `rustc_middle` to `rustc_type_ir`)
 - rust-lang/rust#159589 (Avoid leaking opaque hidden types via auto trait candidates)
 - rust-lang/rust#147790 (constify comparison traits on sliced types)
 - rust-lang/rust#162325 (powerpc64-ibm-aix: fix cfg(target_abi) value)
 - rust-lang/rust#162786 (regression test for GCE inherent projection ICE)
 - rust-lang/rust#163065 (windows Dir::rename: remove incorrect is_dir query)
 - rust-lang/rust#163138 (feat(time): add `Duration::{WEEK, DAY, HOUR, MINUTE}`)
 - rust-lang/rust#163162 (Remove unused `make3.sh` CI script)
2026-09-22 17:35:56 +00:00
Charlie Marsh
501b40c89d Document coroutine storage-conflict fast path 2026-09-22 13:15:17 -04:00
WANG Rui
41ae947f50 tests: Update f16b codegen test for LoongArch and RISC-V
Add target-specific revisions to the `f16b` codegen test to account for
LoongArch and RISC-V lowering `f16b` to LLVM `half` rather than `bfloat`.
2026-09-23 00:57:13 +08:00
mejrs
6c0f3aacde macro_metavar_expr_concat: support concatenating into string literals 2026-09-22 17:57:52 +02:00
Rémy Rakic
9a3ab6566b add comment 2026-09-22 17:27:03 +02:00
Jonathan Brouwer
ac9633ba5e Rollup merge of #163162 - GuillaumeGomez:rm-unused-script, r=marcoieni
Remove unused `make3.sh` CI script

This file is unused so we can remove it.
2026-09-22 17:06:48 +02:00
Jonathan Brouwer
3641daf4a9 Rollup merge of #163138 - sorairolake:feature/more-duration-constants, r=clarfonthey
feat(time): add `Duration::{WEEK, DAY, HOUR, MINUTE}`

- Tracking issue: rust-lang/rust#57391

This pull request adds associated constants for representing one week, one day, one hour, or one minute to `Duration`.

In the same way as rust-lang/rust#162195 and rust-lang/rust#162199, the exact number of seconds corresponding to one week, one day, one hour, and one minute are clearly specified in the documentation. Documentation tests are used to verify the correctness of these descriptions.

I initially proposed this as an ACP. However, the `duration_constants` feature is still unstable, and the ACP simply adds associated constants for units larger than the second to the feature, I determined that it could be incorporated into the feature.

By making `Duration::WEEK` and `Duration::DAY` dependent on the `duration_constructors` feature, these associated constants can be removed if `Duration::from_weeks` and `Duration::from_days` are not stabilized. Therefore, even if the `duration_constructors` feature is not stabilized, the `duration_constants` feature can be stabilized.

```rust
impl Duration {
    pub const WEEK: Duration = Duration::from_weeks(1);
    pub const DAY: Duration = Duration::from_days(1);
    pub const HOUR: Duration = Duration::from_hours(1);
    pub const MINUTE: Duration = Duration::from_mins(1);
}
```

- See also: rust-lang/libs-team#869
2026-09-22 17:06:48 +02:00
Jonathan Brouwer
beaba5284a Rollup merge of #163065 - RalfJung:win-is-dir, r=ChrisDenton
windows Dir::rename: remove incorrect is_dir query

Hopefully fixes https://github.com/rust-lang/rust/issues/163022
r? @ChrisDenton

try-jobs: test-x86_64-msvc-1
2026-09-22 17:06:47 +02:00
Jonathan Brouwer
6977d523b0 Rollup merge of #162786 - malezjaa:regression-test-159561, r=fee1-dead
regression test for GCE inherent projection ICE

Closes https://github.com/rust-lang/rust/issues/159561
The issue no longer reproduces
2026-09-22 17:06:46 +02:00
Jonathan Brouwer
4d635106d9 Rollup merge of #162325 - RalfJung:aix-abi, r=beetrees
powerpc64-ibm-aix: fix cfg(target_abi) value

Our powerpc64-ibm-aix target currently sets `cfg_abi` to "vec-extabi", which means that programs compiled for this target *think* they use that ABI. Even our inline asm logic trusts this field. But that's a lie, we're actually using the default ABI since we are never setting `EnableAIXExtendedAltivecABI` on the LLVM side. We should fix that discrepancy.

Between changing how we generate the code, and changing the label we put into `cfg_abi`, the latter is the less risky change. So let's do that.

This has been tried before in https://github.com/rust-lang/rust/pull/153830. We then decided to wait a bit while the target maintainers investigate whether they want to change the ABI or not. I think we have waited long enough. The last comment from them that I found is [this one](https://github.com/rust-lang/rust/issues/153876#issuecomment-4101480953) which says "I'd conclude the extend vector ABI should be disabled for now"; there have been further questions but no further communication. We can always still change the ABI in the future, but for now let's fix the obvious bug where the ABI we report in `cfg_abi` does not match the actual ABI we are compiling for.

Cc @Gelbpunkt @daltenty @gilamn5tr @amy-kwan @taiki-e
2026-09-22 17:06:45 +02:00
Jonathan Brouwer
e5cde7f7ba Rollup merge of #147790 - npmccallum:slices, r=clarfonthey
constify comparison traits on sliced types

Constify comparison traits for `str`, `CStr`, `ByteStr`, and `Location`.

The slice comparison traits originally included here have since landed independently, so this update drops that already-merged commit and rebases the remaining constifications.

r? clarfonthey

Tracking issue rust-lang/rust#143800
2026-09-22 17:06:44 +02:00
Jonathan Brouwer
cd992b4ac3 Rollup merge of #159589 - bit-aloo:2026-07-29-opaque-type, r=lcnr
Avoid leaking opaque hidden types via auto trait candidates

closes: rust-lang/rust#134578
2026-09-22 17:06:43 +02:00
Jonathan Brouwer
ba87438e1f Rollup merge of #162628 - Jamesbarford:chore/move-const-pt1, r=lcnr
Move `Const` from `rustc_middle` to `rustc_type_ir`

Split by commit;
- Firstly move the type and methods
- From `I::Const` -> `Const<I>`
- Import `ConstExt` in all places that require the extension trait methods in compiler
- Import `ConstExt` in all places that require the extension trait methods in clippy

r? @lcnr
2026-09-22 17:06:42 +02:00
Rémy Rakic
6241eb0b89 remove allocation to create the local use map 2026-09-22 17:01:35 +02:00
bors
b794652dc7 Auto merge of #163157 - JonathanBrouwer:rollup-E6PKhEB, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#147876 (Check tainted_by_error in LateLint)
 - rust-lang/rust#162998 (Avoid generating overlapping assignments in DSE)
 - rust-lang/rust#163136 (library: prune allowed lints)
 - rust-lang/rust#163102 (remove unnecessary restriction with next-solver)
 - rust-lang/rust#163106 (emit the constant pattern note for raw identifier bindings)
 - rust-lang/rust#163118 (add `feature(field_projections)` fixme)
 - rust-lang/rust#163148 (Clean up diagnostic hashing)
2026-09-22 14:27:30 +00:00
Rémy Rakic
d72a519a5a remove unneeded type ascription 2026-09-22 16:26:57 +02:00
Rémy Rakic
3438e6f4ff clarify some names in record_legacy_polonius_drop_facts 2026-09-22 16:13:13 +02:00
Bee
baf4778d7c Add f16 inline ASM support for nvptx64-nvidia-cuda 2026-09-22 14:40:53 +01:00
Guillaume Gomez
a35e5a6272 Remove unused make3.sh CI script 2026-09-22 15:03:57 +02:00
bit-aloo
bae45db91d Add unreachable for modes which never adds opaque types 2026-09-22 13:00:32 +00:00
James Barford-Evans
5e56705e41 Add better code comments for peculiarities 2026-09-22 13:04:46 +01:00
James Barford-Evans
c582470472 Use ConstExt in clippy 2026-09-22 13:04:46 +01:00
James Barford-Evans
af2f1f375c use ConstExt for methods that do not yet exist in rustc_type_ir 2026-09-22 13:04:44 +01:00
James Barford-Evans
51e2875c33 Remap I::Const -> Const<I> 2026-09-22 12:59:34 +01:00
James Barford-Evans
e83bfcabca Move Const from rustc_middle to rustc_type_ir 2026-09-22 12:59:33 +01:00
lcnr
622fd6a3f8 treat inductive cycles as ambig 2026-09-22 13:51:10 +02:00
Jonathan Brouwer
cecc1019f5 Rollup merge of #163148 - nnethercote:improve-Diag-hashing, r=oli-obk
Clean up diagnostic hashing

`DiagInner` impls `PartialEq` and `Hash`, as you'd expect for storing it in a hash table. But there's a couple of strange things.

- We only store the hash value of the `DiagInner` to do deduplication, not the `DiagInner` itself, which means the `PartialEq` impl is unused.

- The `Hash` impl only considers some of the fields. Some of the ignored fields are clearly deliberate (there are comments) but for some it is unclear if it is deliberate.

This commit:

- Removes the unused `PartialEq` impl.

- Inlines and removes `keys` now that it's not needed for `PartialEq`.

- Uses struct deconstruction to ensure no fields can be accidentally ignored. I have preserved existing behaviour by assuming that all the ignored fields are supposed to be ignored.

- Renames `hash` as an inherent method `dedup_hash` to indicate that it's not a typical hash function, and simplifies it to just return `Hash128` instead of being generic.

- Replaces the unnecessary `collect` on `args` with `as_slice`.

- Improves the comment on `emitted_diagnostics`.

r? @oli-obk
2026-09-22 13:23:40 +02:00
Jonathan Brouwer
e16d8d5d02 Rollup merge of #163118 - lcnr:field_types-fixme, r=oli-obk
add `feature(field_projections)` fixme

see the added fixme :>

r? types
2026-09-22 13:23:39 +02:00
Jonathan Brouwer
72ccf9bcb3 Rollup merge of #163106 - Albab-Hasan:const-pattern-note-raw-idents, r=oli-obk
emit the constant pattern note for raw identifier bindings

`is_const_pat_that_looks_like_binding` matched the pattern snippet against a plain identifier so the `#` in `let r#x = 0` rejected it and the binding lost both the label pointing at `const x` and the `introduce a variable instead` suggestion. strip a leading `r#` before the check and render the const name with `to_ident_string` in the label so a keyword name prints as `r#fn`.

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

r? @oli-obk
2026-09-22 13:23:38 +02:00
Jonathan Brouwer
3a7b5aaa3e Rollup merge of #163102 - lcnr:opaque-type-modulo-regions, r=oli-obk
remove unnecessary restriction with next-solver

We previously FCP'd to forbid uses of opaque types which only differ in their lifetime arguments during MIR borrowck in https://github.com/rust-lang/rust/pull/116935#issuecomment-1807243974. This actually did not end up being necessary after all. Will explain this a bit more in the stabilization documentation for the new solver

r? types
2026-09-22 13:23:37 +02:00
Jonathan Brouwer
923f22ad6c Rollup merge of #163136 - mejrs:lint_maintenance, r=jhpratt
library: prune allowed lints
2026-09-22 13:23:36 +02:00
Jonathan Brouwer
1c6030f386 Rollup merge of #162998 - saethlin:dse-ret-is-arg, r=oli-obk
Avoid generating overlapping assignments in DSE

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

Considering we also had https://github.com/rust-lang/rust/pull/155680, I really wonder if this pass should be using LivenessTransferFunction at all.
2026-09-22 13:23:35 +02:00
Jonathan Brouwer
1d7ce9f430 Rollup merge of #147876 - Shunpoco:lint-check-tainted-error, r=oli-obk
Check tainted_by_error in LateLint

## Context
This PR continues from https://github.com/rust-lang/rust/pull/138679#discussion_r2436522856.
In the last PR, I introduced typeck result's tainted_by_error in check_pat. But as we've discussed, I should put the check to a better place which all lints get benefit from the check.

## Change
Since visit_nested_body in late.rs is the starting point of late lint for a nested body, I moved the error check to the function.
I also rename one ui test case which I introduced in the last PR. I think the new name describes what the test wants to check more.

This PR fixes rust-lang/rust#138361 .

Note that we need to use actually_rustdoc to call typeck_body() in visit_nested_body. Otherwise rustdoc returns an error. However, as its comment describes we shouldn't use actually_rustdoc if there is an alternative solution. So far I only come up with using actually_rustdoc (this change), or checking tainted_by_error in each check_xxx functions (e.g., check on check_pat in rust-lang/rust#138679, and on check_expr for rust-lang/rust#138361).
2026-09-22 13:23:34 +02:00