From 19255dc2e670085a7bf6864feccb323077309325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 17 Jan 2019 20:45:50 -0800 Subject: [PATCH] Point more places where expectation comes from --- src/librustc_typeck/check/coercion.rs | 4 +--- src/test/ui/diverging-tuple-parts-39485.stderr | 5 ++++- src/test/ui/issues/issue-10176.stderr | 5 ++++- .../ui/point-to-type-err-cause-on-impl-trait-return.stderr | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index d1c54f824fe..28114b52793 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -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); } } } diff --git a/src/test/ui/diverging-tuple-parts-39485.stderr b/src/test/ui/diverging-tuple-parts-39485.stderr index c399650d325..f8da9282f5f 100644 --- a/src/test/ui/diverging-tuple-parts-39485.stderr +++ b/src/test/ui/diverging-tuple-parts-39485.stderr @@ -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 `(!, !)` diff --git a/src/test/ui/issues/issue-10176.stderr b/src/test/ui/issues/issue-10176.stderr index 45482447ebe..592c84bd17d 100644 --- a/src/test/ui/issues/issue-10176.stderr +++ b/src/test/ui/issues/issue-10176.stderr @@ -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 `(!, !)` diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr index 54f7b108c3d..b94a9f4df48 100644 --- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr @@ -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 | | }