Skip to content

Commit 87d323c

Browse files
committed
Add closure labels
1 parent 03e9a38 commit 87d323c

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

Diff for: compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1423,10 +1423,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
14231423
// LL | Unit4
14241424
// | ^^^^^ expected `Unit3`, found `Unit4`
14251425
// |
1426-
diag.span_label(span, "");
1426+
diag.span_label(span, "this closure");
14271427
if !span.overlaps(obligation.cause.span) {
14281428
// Point at the binding corresponding to the closure where it is used.
1429-
diag.span_label(obligation.cause.span, "");
1429+
diag.span_label(obligation.cause.span, "closure used here");
14301430
}
14311431
}
14321432

Diff for: tests/ui/async-await/dont-ice-for-type-mismatch-in-closure-in-async.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ error[E0271]: expected `{closure@dont-ice-for-type-mismatch-in-closure-in-async.
2525
|
2626
LL | call(|| -> Option<()> {
2727
| ---- ------^^^^^^^^^^
28-
| | |
29-
| | expected `bool`, found `Option<()>`
28+
| | | |
29+
| | | expected `bool`, found `Option<()>`
30+
| | this closure
3031
| required by a bound introduced by this call
3132
|
3233
= note: expected type `bool`

Diff for: tests/ui/closures/return-type-doesnt-match-bound.stderr

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ error[E0271]: expected `{[email protected]:8:17}` to be
33
|
44
LL | f().or_else(|e| -> ! {
55
| ------- -------^
6-
| | |
7-
| | expected `Result<(), _>`, found `!`
6+
| | | |
7+
| | | expected `Result<(), _>`, found `!`
8+
| | this closure
89
| required by a bound introduced by this call
910
|
1011
= note: expected enum `Result<(), _>`
@@ -17,11 +18,12 @@ error[E0271]: expected `{[email protected]:18:13}` to be
1718
|
1819
LL | let c = |e| -> ! {
1920
| -------^
20-
| |
21-
| expected `Result<(), _>`, found `!`
21+
| | |
22+
| | expected `Result<(), _>`, found `!`
23+
| this closure
2224
...
2325
LL | f().or_else(c);
24-
| ------- -
26+
| ------- - closure used here
2527
| |
2628
| required by a bound introduced by this call
2729
|

Diff for: tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ LL | let v = Unit2.m(
3636
| - required by a bound introduced by this call
3737
LL | L {
3838
LL | f: |x| {
39-
| ---
39+
| --- this closure
4040
LL | drop(x);
4141
LL | Unit4
4242
| ^^^^^ expected `Unit3`, found `Unit4`

Diff for: tests/ui/never_type/fallback-closure-wrap.fallback.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0271]: expected `{[email protected]:18:40}` to be a closur
22
--> $DIR/fallback-closure-wrap.rs:19:9
33
|
44
LL | let error = Closure::wrap(Box::new(move || {
5-
| -------
5+
| ------- this closure
66
LL | panic!("Can't connect to server.");
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!`
88
|

0 commit comments

Comments
 (0)