Point more places where expectation comes from

This commit is contained in:
Esteban Küber 2019-01-17 20:45:50 -08:00
parent 90507295db
commit 19255dc2e6
4 changed files with 10 additions and 5 deletions

View File

@ -1246,9 +1246,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
let parent = fcx.tcx.hir().get(fcx.tcx.hir().get_parent_node(parent_id));
if fcx.get_node_fn_decl(parent).is_some() {
if let Some(sp) = fcx.ret_coercion_span.borrow().as_ref() {
if !sp.overlaps(cause.span) {
db.span_label(*sp, reason_label);
}
db.span_label(*sp, reason_label);
}
}
}

View File

@ -15,7 +15,10 @@ error[E0308]: mismatched types
LL | fn f() -> isize {
| ----- expected `isize` because of return type
LL | (return 1, return 2) //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
| ^^^^^^^^^^^^^^^^^^-^
| | |
| | expected because of this statement
| expected isize, found tuple
|
= note: expected type `isize`
found type `(!, !)`

View File

@ -4,7 +4,10 @@ error[E0308]: mismatched types
LL | fn f() -> isize {
| ----- expected `isize` because of return type
LL | (return 1, return 2)
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
| ^^^^^^^^^^^^^^^^^^-^
| | |
| | expected because of this statement
| expected isize, found tuple
|
= note: expected type `isize`
found type `(!, !)`

View File

@ -25,6 +25,7 @@ error[E0308]: mismatched types
LL | / if false {
LL | | //~^ ERROR mismatched types
LL | | return 0i32;
| | ---- expected because of this statement
LL | | } else {
LL | | 1u32
LL | | }