Add closure labels
This commit is contained in:
parent
03e9a38390
commit
87d323c81e
5 changed files with 14 additions and 11 deletions
|
@ -1423,10 +1423,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||||
// LL | Unit4
|
// LL | Unit4
|
||||||
// | ^^^^^ expected `Unit3`, found `Unit4`
|
// | ^^^^^ expected `Unit3`, found `Unit4`
|
||||||
// |
|
// |
|
||||||
diag.span_label(span, "");
|
diag.span_label(span, "this closure");
|
||||||
if !span.overlaps(obligation.cause.span) {
|
if !span.overlaps(obligation.cause.span) {
|
||||||
// Point at the binding corresponding to the closure where it is used.
|
// Point at the binding corresponding to the closure where it is used.
|
||||||
diag.span_label(obligation.cause.span, "");
|
diag.span_label(obligation.cause.span, "closure used here");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,9 @@ error[E0271]: expected `{closure@dont-ice-for-type-mismatch-in-closure-in-async.
|
||||||
|
|
|
|
||||||
LL | call(|| -> Option<()> {
|
LL | call(|| -> Option<()> {
|
||||||
| ---- ------^^^^^^^^^^
|
| ---- ------^^^^^^^^^^
|
||||||
| | |
|
| | | |
|
||||||
| | expected `bool`, found `Option<()>`
|
| | | expected `bool`, found `Option<()>`
|
||||||
|
| | this closure
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected type `bool`
|
= note: expected type `bool`
|
||||||
|
|
|
@ -3,8 +3,9 @@ error[E0271]: expected `{closure@return-type-doesnt-match-bound.rs:8:17}` to be
|
||||||
|
|
|
|
||||||
LL | f().or_else(|e| -> ! {
|
LL | f().or_else(|e| -> ! {
|
||||||
| ------- -------^
|
| ------- -------^
|
||||||
| | |
|
| | | |
|
||||||
| | expected `Result<(), _>`, found `!`
|
| | | expected `Result<(), _>`, found `!`
|
||||||
|
| | this closure
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected enum `Result<(), _>`
|
= note: expected enum `Result<(), _>`
|
||||||
|
@ -17,11 +18,12 @@ error[E0271]: expected `{closure@return-type-doesnt-match-bound.rs:18:13}` to be
|
||||||
|
|
|
|
||||||
LL | let c = |e| -> ! {
|
LL | let c = |e| -> ! {
|
||||||
| -------^
|
| -------^
|
||||||
| |
|
| | |
|
||||||
| expected `Result<(), _>`, found `!`
|
| | expected `Result<(), _>`, found `!`
|
||||||
|
| this closure
|
||||||
...
|
...
|
||||||
LL | f().or_else(c);
|
LL | f().or_else(c);
|
||||||
| ------- -
|
| ------- - closure used here
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ LL | let v = Unit2.m(
|
||||||
| - required by a bound introduced by this call
|
| - required by a bound introduced by this call
|
||||||
LL | L {
|
LL | L {
|
||||||
LL | f: |x| {
|
LL | f: |x| {
|
||||||
| ---
|
| --- this closure
|
||||||
LL | drop(x);
|
LL | drop(x);
|
||||||
LL | Unit4
|
LL | Unit4
|
||||||
| ^^^^^ expected `Unit3`, found `Unit4`
|
| ^^^^^ expected `Unit3`, found `Unit4`
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0271]: expected `{closure@fallback-closure-wrap.rs:18:40}` to be a closur
|
||||||
--> $DIR/fallback-closure-wrap.rs:19:9
|
--> $DIR/fallback-closure-wrap.rs:19:9
|
||||||
|
|
|
|
||||||
LL | let error = Closure::wrap(Box::new(move || {
|
LL | let error = Closure::wrap(Box::new(move || {
|
||||||
| -------
|
| ------- this closure
|
||||||
LL | panic!("Can't connect to server.");
|
LL | panic!("Can't connect to server.");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!`
|
||||||
|
|
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue