Skip to content

Commit 19255dc

Browse files
committed
Point more places where expectation comes from
1 parent 9050729 commit 19255dc

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/librustc_typeck/check/coercion.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
12461246
let parent = fcx.tcx.hir().get(fcx.tcx.hir().get_parent_node(parent_id));
12471247
if fcx.get_node_fn_decl(parent).is_some() {
12481248
if let Some(sp) = fcx.ret_coercion_span.borrow().as_ref() {
1249-
if !sp.overlaps(cause.span) {
1250-
db.span_label(*sp, reason_label);
1251-
}
1249+
db.span_label(*sp, reason_label);
12521250
}
12531251
}
12541252
}

src/test/ui/diverging-tuple-parts-39485.stderr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ error[E0308]: mismatched types
1515
LL | fn f() -> isize {
1616
| ----- expected `isize` because of return type
1717
LL | (return 1, return 2) //~ ERROR mismatched types
18-
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
18+
| ^^^^^^^^^^^^^^^^^^-^
19+
| | |
20+
| | expected because of this statement
21+
| expected isize, found tuple
1922
|
2023
= note: expected type `isize`
2124
found type `(!, !)`

src/test/ui/issues/issue-10176.stderr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ error[E0308]: mismatched types
44
LL | fn f() -> isize {
55
| ----- expected `isize` because of return type
66
LL | (return 1, return 2)
7-
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
7+
| ^^^^^^^^^^^^^^^^^^-^
8+
| | |
9+
| | expected because of this statement
10+
| expected isize, found tuple
811
|
912
= note: expected type `isize`
1013
found type `(!, !)`

src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ error[E0308]: mismatched types
2525
LL | / if false {
2626
LL | | //~^ ERROR mismatched types
2727
LL | | return 0i32;
28+
| | ---- expected because of this statement
2829
LL | | } else {
2930
LL | | 1u32
3031
LL | | }

0 commit comments

Comments
 (0)