-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`A-type-systemArea: Type systemArea: Type systemD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
| ^^^^^
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`A-type-systemArea: Type systemArea: Type systemD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.