Treat vars created for opaque subtyping as live everywhere
Fixesrust-lang/rust#160669
r? lqd
Let's look at a minimal variant of rust-lang/rust#160669
```rust
fn minimal(short: (), out: &'static ()) -> impl Sized {
if true {
return &short; //~ ERROR `short` does not live long enough
}
out
}
```
That has the following (simplified) MIR:
```rust
fn foo(_1: (), _2: &'?4 ()) -> Opaque(DefId(foo::{opaque#0}), []) {
bb0: { switchInt(move _4) -> [0: bb2, otherwise: bb1]; }
bb1: {
_0 = &'?2 _1; // bb1[0]
goto -> bb3;
}
bb2: {
_0 = &'?3 (*_2); // bb2[3]
goto -> bb3;
}
bb3: {
return;
}
}
```
And the following region constraints:
<img width="236" height="583" alt="image" src="https://github.com/user-attachments/assets/4c450ccd-1c5c-4a9c-a4f1-0875cf0e5553" />
Note `'?5` and `'?6`: these don't show up in the MIR graph because they arise from the `enable_subtyping` closure in [`relate_opaques`](c9b7f17889/compiler/rustc_borrowck/src/type_check/relate_tys.rs (L116)). Importantly (today), these regions are related to each other (and to other regions in hidden types) *at a single point*, but **are not live at any point**.
For NLL this is not a problem (since liveness does not matter for outlives constraint propagation. For Polonius, this is an issue.
The fix here is fairly simple: consider these lifetimes live at all points. This may be an *overestimate* of liveness, but this is all code that doesn't get called with the next solver.
This is also the same reason that this is not an issue with the next solver. Opaque types are normalized in HIR typeck, so these hacky regions are never created.
There are a couple alternative fixes that I think are ultimately not as good:
1) Equate the previous hidden type with the new hidden type using `Locations::All` - when [registering the goals](c9b7f17889/compiler/rustc_borrowck/src/type_check/relate_tys.rs (L161)) from equating these two, force `Locations::All` instead of `Locations::Single`.
2) [**Equate all uses, not just the final defining use, in borrowck**](59a4c62a0e) - this has us store any duplicates in `insert_hidden_type`, which then get equated with the "expected" hidden type in `apply_definition_site_hidden_types` with `Locations::All`. I think this is fine, but a lot less "local" logic.
I'll note that for the next solver, we equate the hidden types with the return type in the signature with`Locations::Single`:
<img width="289" height="586" alt="image" src="https://github.com/user-attachments/assets/34d15820-06e3-4205-9278-e82465dca139" />
(note, this MIR is slightly different: `'5` is `short`'s lifetime; `'6` is the lifetime from the normalized opaque (`&'?6 ()`); `'4` is the renumbered lifetime for the MIR body)
Given that, perhaps (1) is the most faithful to the spirit of the next solver (that there is one hidden type that things get related to), but this seems like a *slightly* smaller-in-scope fix.
In any case, I think any solution here is mostly just a waiting game for the next solver.
Remove jdno from infra-ci rotation
Triagebot keeps assigning JD to infra PRs, but I don't think that he has been active in reviewing for the past few months. So I think it's better to remove him from the rotation, to avoid unnecessary rerolls.
CC @jdno
r? marcoieni
Move `LateParamRegion` to `rustc_type_ir`
Move `LateParamRegion` to `rustc_type_ir`. As per feedback, I created a `TrivialLiftImpls!` mirroring `rustc_middle`'s variant which is creates an identity function for `lift_to_interner(...)`.
Spun off from; https://github.com/rust-lang/rust/pull/160509
r? @lcnr
implement <IpAddr, SocketAddr>::unspecified_from()
Tracking issue: rust-lang/rust#158975
I went ahead with an initial implementation, since there are still two unresolved questions in the tracking issue.
Library lock file update
This PR contains the following updates:
| Update | Change |
|---|---|
| lockFileMaintenance | All locks refreshed |
r? dep-bumps
🔧 This Pull Request updates lock files to use the latest dependency versions.
---
### Configuration
📅 **Schedule**: (UTC)
- Branch creation
- Between 12:00 AM and 03:59 AM, only on Monday (`* 0-3 * * 1`)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rust-lang/rust).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yOS41IiwidXBkYXRlZEluVmVyIjoiNDQuMjkuNSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
atomic volatile: add intrinsics
Extend the atomic load/store intrinsics to also support volatile atomic load/store.
Tracking issue: https://github.com/rust-lang/rust/issues/158947.
Library APIs that use these intrinsics will be added inn a future PR.
The GCC and cranelift implementations ignore the volatile flag, not sure how that should be implemented for them.
Subtree sync for rustc_codegen_cranelift
The main highlight this time is removing a patch file to make changes to portable-simd a bit easier to do.
r? @ghost
@rustbot label +A-codegen +A-cranelift +T-compiler +subtree-sync
Rollup of 6 pull requests
Successful merges:
- rust-lang/rust#160497 (Fix: WF ICE assumptions on binders)
- rust-lang/rust#160845 (Better comments on small copy lists, explaining the limitations better)
- rust-lang/rust#160869 (Add nightly-only support for Cargo unremap trim-paths files in `rust-lldb`)
- rust-lang/rust#161214 (Reduce minimum LLDB to 21.1.0 for `lldb-repr` tests)
- rust-lang/rust#161216 (Clean up some `lldb_batchmode` lints)
- rust-lang/rust#161219 (bootstrap: Make various things non-pub)
bootstrap: Make various things non-pub
- Previously: https://github.com/rust-lang/rust/pull/161157
---
During my quest to move things out of bootstrap's `lib.rs`, I have found several clusters of code that start to emit dead-code warnings when `lib.rs` is cleared out.
This PR aims to pre-emptively resolve some of those clusters, by making various things non-pub and dealing with the resulting warnings.
There should be no change to bootstrap behaviour.
Clean up some `lldb_batchmode` lints
Notably, this also removes all(?) of the python 2 compatibility stuff. Since we're pinning CI LLDB/GDB anyway, and neither support python 2 anymore afaik, it shouldn't cause any issues.
r? @jieyouxu , @Kobzol
Reduce minimum LLDB to 21.1.0 for `lldb-repr` tests
I wrote `lldb-repr` against LLDB 22, but i don't think i actually use any 22-specific features. PR CI currently uses 21 iirc, so i'm curious if they pass there.
r? @Kobzol , @jieyouxu
Add nightly-only support for Cargo unremap trim-paths files in `rust-lldb`
Same as rust-lang/rust#160560 but for `rust-lldb`.
This PR adds support in `rust-lldb` for the un-remapping file produced by Cargo with `-Ztrim-paths` (https://github.com/rust-lang/cargo/pull/17303). This support is nightly-only, and only activated when `RUST_LLDB_TRIM_PATHS=unstable` is set.
The processing is identical to the GDB script, the differences are regarding the interaction with LLDB and the need to setup a background thread.
Better comments on small copy lists, explaining the limitations better
r? @nnethercote
> [!NOTE]
> I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.
Fix: WF ICE assumptions on binders
Fixesrust-lang/rust#160293
`-Zassumptions-on-binders` ICEs because the solver's `well_formed_goals` passes terms with resolvable inference variables to `unnormalized_obligations`, which asserts they're already resolved (unlike other callers).
Resolve inference variables before computing WF obligations.
The overflow path in __hexagon_fmadf5 computed the round-mode predicate
(inf vs. largest-finite) into p0, but then overwrote p0 with
`dfcmp.eq(ATMP,ATMP)` before consuming it. Since ATMP is +inf,
`dfcmp.eq(ATMP,ATMP)` is always true, so CTMP was unconditionally set to
infinity and the rounding-mode decision was discarded.
As a result, a finite-magnitude overflow returned +/-inf in every
rounding mode.
Signed-off-by: Zain Siddavatam <zsiddava@qti.qualcomm.com>