about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJared Wyles <wyles@adobe.com>2016-08-05 13:48:24 +1000
committerJared Wyles <wyles@adobe.com>2016-08-06 09:04:18 +1000
commit1cf5142248ca72d4cd1baeb011d665717c741126 (patch)
tree9aea4df8acf88b434f30df5cb27b25a81489e354
parenta0b4e6764809022433edbff275528ec2540bda73 (diff)
downloadrust-1cf5142248ca72d4cd1baeb011d665717c741126.tar.gz
rust-1cf5142248ca72d4cd1baeb011d665717c741126.zip
Updated error format for E0069
-rw-r--r--src/librustc_typeck/check/mod.rs6
-rw-r--r--src/test/compile-fail/E0069.rs4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 6062bd048b3..32688b258d0 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -3383,8 +3383,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                             // FIXME(#32730) propagate obligations
                             .map(|InferOk { obligations, .. }| assert!(obligations.is_empty()));
                         if eq_result.is_err() {
-                            span_err!(tcx.sess, expr.span, E0069,
-                                      "`return;` in a function whose return type is not `()`");
+                            struct_span_err!(tcx.sess, expr.span, E0069,
+                                     "`return;` in a function whose return type is not `()`")
+                                .span_label(expr.span, &format!("return type is not ()"))
+                                .emit();
                         }
                     }
                 }
diff --git a/src/test/compile-fail/E0069.rs b/src/test/compile-fail/E0069.rs
index d164d863487..00facc91728 100644
--- a/src/test/compile-fail/E0069.rs
+++ b/src/test/compile-fail/E0069.rs
@@ -9,7 +9,9 @@
 // except according to those terms.
 
 fn foo() -> u8 {
-    return; //~ ERROR E0069
+    return;
+    //~^ ERROR `return;` in a function whose return type is not `()`
+    //~| NOTE return type is not ()
 }
 
 fn main() {