Files
rust/tests
Guillaume Gomez 95cc3dfd92 Rollup merge of #156795 - P8L1:fix-generic-reborrow-expr-use-visitor, r=dingxiangfei2009
Handle generic reborrow in expression-use adjustment walking

Fixes an ICE in expression-use adjustment walking where `Adjust::GenericReborrow` could reach a match arm that assumed generic reborrow was unreachable.

`GenericReborrow` is already emitted by typeck and classified as rvalue-producing elsewhere in `expr_use_visitor.rs`, so the adjustment walker must handle it explicitly instead of panicking.

This PR models `GenericReborrow` as a borrow-like use of the source expression:
- `Mutability::Mut` is treated like an exclusive/mutable reborrow use.
- `Mutability::Not` is treated like a shared/coerce-shared borrow-like use.
- The source is not moved or treated as a mere copy.

cc @aapoalas
@rustbot label F-reborrow
Fixes https://github.com/rust-lang/rust/issues/156339
Tracking: https://github.com/rust-lang/rust/issues/145612
2026-06-18 20:30:23 +02:00
..