Skip to content

Commit d6d9c2e

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

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

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

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)