Closed
Description
Just encountered the following output:
error[E0308]: mismatched types
--> compiler/rustc_passes/src/loops.rs:152:40
|
152 | ... if let hir::ExprKind::Path(hir::QPath::Resolved(
| ______________________________^
153 | | ... None,
154 | | ... Path { ident, res: hir::def::Res::Err, .. },
155 | | ... )) = break_expr
| | ^ ---------- this expression has type `&&rustc_hir::Expr<'_>`
| |________________________|
| expected struct `rustc_hir::Expr`, found enum `rustc_hir::ExprKind`
It would be nice if we could peek at the fields of break_expr
and provide an appropriate structured suggestion:
error[E0308]: mismatched types
--> compiler/rustc_passes/src/loops.rs:152:40
|
152 | ... if let hir::ExprKind::Path(hir::QPath::Resolved(
| ______________________________^
153 | | ... None,
154 | | ... Path { ident, res: hir::def::Res::Err, .. },
155 | | ... )) = break_expr
| | ^ ---------- this expression has type `&&rustc_hir::Expr<'_>`
| |________________________|
| expected struct `rustc_hir::Expr`, found enum `rustc_hir::ExprKind`
|
help: you might have meant to use field `kind` of type `rustc_hir::ExprKind`
|
155 | ... )) = break_expr.kind
| ^^^^^