Commit graph

21299 commits

Author SHA1 Message Date
bors
e100792918 Auto merge of #147662 - Zalathar:rollup-j8ci0f2, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#146277 (Enable `u64` limbs in `core::num::bignum`)
 - rust-lang/rust#146976 (constify basic Clone impls)
 - rust-lang/rust#147249 (Do two passes of `handle_opaque_type_uses_next`)
 - rust-lang/rust#147266 (fix 2 search graph bugs)
 - rust-lang/rust#147497 (`proc_macro` cleanups (3/N))
 - rust-lang/rust#147546 (Suppress unused_parens for labeled break)
 - rust-lang/rust#147548 (Fix ICE for never pattern as closure parameters)
 - rust-lang/rust#147594 (std: implement `pal::os::exit` for VEXos)
 - rust-lang/rust#147596 (Adjust the Arm targets in CI to reflect latest changes)
 - rust-lang/rust#147607 (GVN: Invalidate derefs at loop headers)
 - rust-lang/rust#147620 (Avoid redundant UB check in RangeFrom slice indexing)
 - rust-lang/rust#147647 (Hide vendoring and copyright in GHA group)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-14 12:32:31 +00:00
bors
2f7620a5cc Auto merge of #146414 - GuillaumeGomez:run-test-with-gcc-backend, r=Kobzol
Add a CI job that runs a subset of UI tests with the GCC backend

Part of https://github.com/rust-lang/compiler-team/issues/891.

r? `@Kobzol`
2025-10-14 09:21:23 +00:00
Stuart Cook
4fc3a05e54
Rollup merge of #147607 - dianqk:gvn-deref-loop, r=cjgillot
GVN: Invalidate derefs at loop headers

Fix a miscompiled case I found when re-reviewing rust-lang/rust#132527.

r? cjgillot
r? oli-obk
2025-10-14 16:31:02 +11:00
Stuart Cook
0a7f159111
Rollup merge of #147548 - chenyukang:yukang-fix-ice-141592, r=jackh726
Fix ICE for never pattern as closure parameters

Fixes rust-lang/rust#141592

`diverge` is set here for never pattern in parameter:
https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_typeck/src/check.rs#L87-L90

the assertion is too strict, I set it delay as bug for later error.
2025-10-14 16:31:00 +11:00
Stuart Cook
a49246a614
Rollup merge of #147546 - chenyukang:yukang-fix-break-label-147542, r=jackh726
Suppress unused_parens for labeled break

Fixes rust-lang/rust#147542
2025-10-14 16:30:59 +11:00
Stuart Cook
4321adfbe0
Rollup merge of #147266 - lcnr:fix-search_graph, r=BoxyUwU
fix 2 search graph bugs

wooooooooops, i should really run the fuzzer even when not changing the structure of the search graph as a whole :3 fixes the `ml-kem` ICE in the next-solver crater run

r? ````@BoxyUwU````
2025-10-14 16:30:58 +11:00
Stuart Cook
3a80521ad2
Rollup merge of #147249 - jackh726:opaque-type-fallback, r=lcnr
Do two passes of `handle_opaque_type_uses_next`

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

Also did a little bit of cleanup, can squash the commits if decided.

r? lcnr
2025-10-14 16:30:57 +11:00
yukang
d658bcfdfe Suppress unused_parens for labeled break 2025-10-14 12:32:51 +08:00
dianqk
2048b9c027
GVN: Invalidate derefs at loop headers 2025-10-14 08:09:32 +08:00
Jack Huey
d51f09e5ba Review comments. Move resolve_vars_if_possible into fn and add test minimizations. Update comment and test. 2025-10-13 20:25:01 +00:00
Guillaume Gomez
9d15d6615b Fix tests/ui/sanitizer/address.rs line 2025-10-13 21:23:38 +02:00
bors
4b94758d2b Auto merge of #147640 - matthiaskrgr:rollup-fio3d88, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#144266 (Supress swapping lhs and rhs in equality suggestion in extern macro )
 - rust-lang/rust#147471 (Assert that non-extended temporaries and `super let` bindings have scopes)
 - rust-lang/rust#147533 (Renumber return local after state transform)
 - rust-lang/rust#147566 (rewrite outlives placeholder constraints to outlives static when handling opaque types)
 - rust-lang/rust#147613 (Make logging filters work again by moving EnvFilter into its own layer)
 - rust-lang/rust#147615 (reduce calls to attr.span() in old doc attr parsing)
 - rust-lang/rust#147636 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-13 19:22:06 +00:00
bors
ed1d94311e Auto merge of #147541 - saethlin:transmute-carefully, r=scottmcm
Change int-to-ptr transmute lowering back to inttoptr

This is a revert of https://github.com/rust-lang/rust/pull/121282, but with a regression test to cover the reported miscompile in https://github.com/rust-lang/rust/issues/147265 that was caused by the way the code here combines with https://github.com/rust-lang/rust/pull/138759.
2025-10-13 15:24:11 +00:00
Matthias Krüger
7d0a0a3660
Rollup merge of #147566 - BoxyUwU:opaque_types_placeholder_outlives, r=lcnr
rewrite outlives placeholder constraints to outlives static when handling opaque types

Fixes rust-lang/rust#147529

r? lcnr

see test comment
2025-10-13 16:54:13 +02:00
Matthias Krüger
6dd08cbd45
Rollup merge of #147533 - cjgillot:coro-late-renumber, r=davidtwco
Renumber return local after state transform

The current implementation of `StateTransform` renames `_0` before analyzing liveness. This is inconsistent, as a `return` terminator hardcodes a read of `_0`.

This PR proposes to perform such rename *after* analyzing the body, in fact after the whole transform. The implementation is not much more complicated.
2025-10-13 16:54:13 +02:00
Matthias Krüger
852198534f
Rollup merge of #144266 - xizheyin:139050, r=nnethercote
Supress swapping lhs and rhs in equality suggestion in extern macro

Fixes rust-lang/rust#139050
2025-10-13 16:54:11 +02:00
Boxy Uwu
30bedc74d4 in opaque type handling lift region vars to static if they outlive placeholders 2025-10-13 15:26:22 +01:00
Guillaume Gomez
a8051a6ca3 Ignore more failing ui tests for GCC backend 2025-10-13 15:30:26 +02:00
Guillaume Gomez
2ad443c849 Ignore failing debuginfo tests with gcc backend 2025-10-13 15:20:49 +02:00
Guillaume Gomez
5ff7ca2e22 Ignore failing incremental tests for GCC backend 2025-10-13 15:20:49 +02:00
Guillaume Gomez
35e104a173 Ignore some mir-opt tests because GCC backend does not support unwinding from inline asm 2025-10-13 15:20:49 +02:00
Guillaume Gomez
1c075acfb5 Ignoring working crahes test in GCC backend 2025-10-13 15:20:49 +02:00
Guillaume Gomez
97eaf45e31 Ignore more failing ui tests in GCC backend 2025-10-13 15:20:49 +02:00
Guillaume Gomez
3938f42bb1
Rollup merge of #147608 - Zalathar:debuginfo, r=nnethercote
cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression`

- Part of rust-lang/rust#134001
- Follow-up to rust-lang/rust#146763

---

This PR dismantles the somewhat complicated `LLVMRustDIBuilderCreateStaticVariable` function, and replaces it with equivalent calls to `LLVMDIBuilderCreateGlobalVariableExpression` and `LLVMGlobalSetMetadata`.

A key difference is that the new code does not replicate the attempted downcast of `InitVal`. As far as I can tell, those downcasts were actually dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran.

I have also confirmed that if the calls to `create_static_variable` are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage.

The new `DIBuilder` methods have been added via an extension trait, not as inherent methods, to avoid impeding rust-lang/rust#142897.
2025-10-13 11:25:23 +02:00
Guillaume Gomez
4a7e152511
Rollup merge of #147514 - RalfJung:transparent-nonexhaustive-normalize, r=lcnr
repr_transparent_external_private_fields: normalize types during traversal

Determining whether a type is a 1-ZST will internally do full normalization, so we better do the same when scanning for non-exhaustive types.

r? ``@lcnr``
2025-10-13 11:25:21 +02:00
bors
36e4f5d1fe Auto merge of #146096 - adwinwhite:handle_normalization_overflow_in_mono1, r=saethlin
Fix normalization overflow ICEs in monomorphization

Fixes rust-lang/rust#92004
Fixes rust-lang/rust#92470
Fixes rust-lang/rust#95134
Fixes rust-lang/rust#105275
Fixes rust-lang/rust#105937
Fixes rust-lang/rust#117696-2
Fixes rust-lang/rust#118590
Fixes rust-lang/rust#122823
Fixes rust-lang/rust#131342
Fixes rust-lang/rust#139659

## Analysis:
The causes of these issues are similar. They contain generic recursive functions that can be instantiated with different args infinitely at monomorphization stage.
Ideally this should be caught by the [`check_recursion_limit`](c0bb3b98bb/compiler/rustc_monomorphize/src/collector.rs (L468)) function. The reality is that normalization can reach recursion limit earlier than monomorphization's check because they calculate depths in different ways.
Since normalization is called everywhere, ICEs appear in different locations.

## Fix:
If we abort on overflow with `TypingMode::PostAnalysis` in the trait solver, it would also catch these errors.
The main challenge is providing good diagnostics for them. So it's quite natural to put the check right before these normalization happening.
I first tried to check the whole MIR body's normalization and `references_error`. (As elaborate_drop handles normalization failure by [returning `ty::Error`](c0bb3b98bb/compiler/rustc_mir_transform/src/elaborate_drop.rs (L514-L519)).)
It turns out that checking all `Local`s seems sufficient.
These types are gonna be normalized anyway. So with cache, these checks shouldn't be expensive.

This fixes these ICEs for both the next and old solver, though I'm not sure the change I made to the old solver is proper. Its overflow handling looks convoluted thus I didn't try to fix it more "upstream".
2025-10-13 00:20:10 +00:00
Matthias Krüger
ae356cb673
Rollup merge of #147597 - JohnTitor:issue-72207, r=chenyukang
Add a regression test for #72207

Closes rust-lang/rust#72207
2025-10-12 19:07:48 +02:00
bors
ff6dc928c5 Auto merge of #142390 - cjgillot:mir-liveness, r=davidtwco
Perform unused assignment and unused variables lints on MIR.

Rebase of https://github.com/rust-lang/rust/pull/101500

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

The first commit moves detection of uninhabited types from the current liveness pass to MIR building.

In order to keep the same level of diagnostics, I had to instrument MIR a little more:
- keep for which original local a guard local is created;
- store in the `VarBindingForm` the list of introducer places and whether this was a shorthand pattern.

I am not very proud of the handling of self-assignments. The proposed scheme is in two parts: first detect probable self-assignments, by pattern matching on MIR, and second treat them specially during dataflow analysis. I welcome ideas.

Please review carefully the changes in tests. There are many small changes to behaviour, and I'm not sure all of them are desirable.
2025-10-12 13:00:04 +00:00
dianqk
64c023bad8
Add miscompiled test cases 2025-10-12 20:14:22 +08:00
Zalathar
10393a8052 Add LLDB commands to tests/debuginfo/basic-types-globals.rs 2025-10-12 21:44:13 +11:00
Matthias Krüger
f58eab74c6
Rollup merge of #145897 - Oneirical:uncountable-integer-11, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#4 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-10-12 10:13:13 +02:00
Camille Gillot
be46a90a8b Bless x86_64 test. 2025-10-12 03:15:18 +00:00
bors
3be68033b6 Auto merge of #145513 - beepster4096:erasedereftemps, r=saethlin,cjgillot
Validate CopyForDeref and DerefTemps better and remove them from runtime MIR

(split from my WIP rust-lang/rust#145344)

This PR:
- Removes `Rvalue::CopyForDeref` and `LocalInfo::DerefTemp` from runtime MIR
    - Using a new mir pass `EraseDerefTemps`
    - `CopyForDeref(x)` is turned into `Use(Copy(x))`
    - `DerefTemp` is turned into `Boring`
        - Not sure if this part is actually necessary, it made more sense in rust-lang/rust#145344 with `DerefTemp` storing actual data that I wanted to keep from having to be kept in sync with the rest of the body in runtime MIR
- Checks in validation that `CopyForDeref` and `DerefTemp` are only used together
- Removes special handling for `CopyForDeref` from many places
- Removes `CopyForDeref` from `custom_mir` reverting rust-lang/rust#111587
    - In runtime MIR simple copies can be used instead
    - In post cleanup analysis MIR it was already wrong to use due to the lack of support for creating `DerefTemp` locals
    - Possibly this should be its own PR?
 - Adds an argument to `deref_finder` to avoid creating new `DerefTemp`s and `CopyForDeref` in runtime MIR.
     - Ideally we would just avoid making intermediate derefs instead of fixing it at the end of a pass / during shim building
 - Removes some usages of `deref_finder` that I found out don't actually do anything

r? oli-obk
2025-10-12 02:34:20 +00:00
Oneirical
6ca69812cd Add test batch 4 2025-10-11 21:59:51 -04:00
Yuki Okushi
e0b7b2350e Add a regression test for #72207 2025-10-12 08:24:39 +09:00
Adwin White
08f16a9c46 check normalization overflow in monomorphization 2025-10-12 06:59:10 +08:00
Camille Gillot
4419d890c6 Bless ui asm. 2025-10-11 20:50:21 +00:00
Camille Gillot
c653430714 Suggest unit struct and constants. 2025-10-11 20:50:21 +00:00
Camille GILLOT
ca0379d6cd Diagnose liveness on MIR. 2025-10-11 20:50:21 +00:00
Camille GILLOT
9df2003860 Record for each MIR local where it has been introduced. 2025-10-11 20:50:20 +00:00
Camille GILLOT
aacf9a612a Add test for uninhabited std::mem::uninitialized uses. 2025-10-11 20:50:20 +00:00
Camille GILLOT
5620c82e53 Report uninhabited call return types on MIR. 2025-10-11 20:50:20 +00:00
beepster4096
2da55cdb2c remove copyforderef from custom_mir
it did not create DerefTemp locals when used, so it was never actually correct.
2025-10-10 20:30:19 -07:00
beepster4096
1bd490113c slightly less trivial blessings
some optimization is behaving slightly differently on box derefs after this change, but the difference is irrelevant
2025-10-10 20:30:18 -07:00
beepster4096
33cc7787bf trivial test blessings 2025-10-10 18:40:00 -07:00
Ben Kimock
029579d177 Change int-to-ptr transmute lowering back to inttoptr 2025-10-10 20:14:23 -04:00
dianqk
0ef3d203e8
Rollup merge of #147544 - cjgillot:nodeinit, r=saethlin
Remove StatementKind::Deinit.

It is a remnant from the time we deaggreated MIR.

Now, it is only constructed by the `LargeEnums` MIR pass, which is disabled by default.
2025-10-11 07:05:58 +08:00
dianqk
fce1bea078
Rollup merge of #147525 - dianqk:ref_prop_debuginfo, r=cjgillot
Replace locals in debuginfo records during ref_prop and dest_prop

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

r? cjgillot
2025-10-11 07:05:58 +08:00
dianqk
486fae11ca
Rollup merge of #145651 - borsakv:139093, r=cjgillot
Regression test for const promotion with Option<Ordering>

https://rust.godbolt.org/z/EjxqE8WcT

Fixes rust-lang/rust#139093

Add a regression test to ensure that comparing `Option<Ordering>` to
`Some(Ordering::Equal)` does not trigger unnecessary const promotion
in MIR.

Previously, inlined constants like `Some(Ordering::Equal)` would get
promoted, leading to more complex MIR and redundant LLVM IR checks.
This test verifies that both the direct form and the `let`-binding form
now generate equivalent, simplified MIR.

r? cjgillot
2025-10-11 07:05:53 +08:00
dianqk
1ee2c58e89
Replace locals in debuginfo records during dest_prop 2025-10-10 22:06:04 +08:00