Skip to content

Commit 9a6d414

Browse files
chenyukangestebank
andcommitted
Update compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
Co-authored-by: Esteban Kuber <[email protected]>
1 parent e3a7cc3 commit 9a6d414

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
789789
}
790790
}
791791
ExprKind::Path(..) | ExprKind::Lit(_) if parent_is_closure => {
792-
err.span_suggestion(
792+
err.span_suggestion_verbose(
793793
expression.span.shrink_to_lo(),
794794
"consider ignoring the value",
795795
"_ = ",

Diff for: tests/ui/typeck/closure-ty-mismatch-issue-128561.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ error[E0308]: mismatched types
22
--> $DIR/closure-ty-mismatch-issue-128561.rs:2:32
33
|
44
LL | b"abc".iter().for_each(|x| x);
5-
| ^
6-
| |
7-
| expected `()`, found `&u8`
8-
| help: consider ignore the value here: `_ =`
5+
| ^ expected `()`, found `&u8`
6+
|
7+
help: consider ignoring the value
8+
|
9+
LL | b"abc".iter().for_each(|x| _ = x);
10+
| +++
911

1012
error[E0308]: mismatched types
1113
--> $DIR/closure-ty-mismatch-issue-128561.rs:4:32

0 commit comments

Comments
 (0)