Detect different borrowing in different sub-expressions the same expression and suggest borrowing when applicable #134219
Open
Description
opened on Dec 12, 2024
error[E0308]: mismatched types
--> compiler/rustc_middle/src/ty/context.rs:3212:73
|
3210 | match expr.kind {
| --------- this expression has type `rustc_hir::ExprKind<'_>`
3211 | hir::ExprKind::Path(qpath)
| ----- first introduced with type `rustc_hir::QPath<'_>` here
3212 | | hir::ExprKind::Call(hir::Expr { kind: hir::ExprKind::Path(qpath), .. }, []) => {
| ^^^^^ expected `QPath<'_>`, found `&QPath<'_>`
|
= note: in the same arm, a binding must have the same type in all alternatives
The above should suggest match &expr.kind
.
Activity