about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-08-30 16:00:09 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-08-30 16:00:09 -0700
commit70ed4f972e73f5fe8c11c4ac0cf98d13b30083b9 (patch)
treee164b20293e7dad67f0bf739b43cc5eacd4a861f
parente6b35b0e1115f008796e8313574e4a4739b6d39d (diff)
downloadrust-70ed4f972e73f5fe8c11c4ac0cf98d13b30083b9.tar.gz
rust-70ed4f972e73f5fe8c11c4ac0cf98d13b30083b9.zip
Point at def span on incorrect panic or alloc error handler
-rw-r--r--src/librustc_typeck/check/mod.rs2
-rw-r--r--src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr6
-rw-r--r--src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr6
3 files changed, 6 insertions, 8 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index bbb45c04e4e..9db0f9052d7 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -1178,6 +1178,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
                         }
                     }
                 } else {
+                    let span = fcx.tcx.sess.source_map().def_span(span);
                     fcx.tcx.sess.span_err(span, "function should have one argument");
                 }
             } else {
@@ -1226,6 +1227,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
                         }
                     }
                 } else {
+                    let span = fcx.tcx.sess.source_map().def_span(span);
                     fcx.tcx.sess.span_err(span, "function should have one argument");
                 }
             } else {
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
index 9b792c46c24..e7885537b06 100644
--- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
@@ -1,10 +1,8 @@
 error: function should have one argument
   --> $DIR/alloc-error-handler-bad-signature-3.rs:20:1
    |
-LL | / fn oom() -> ! { //~ ERROR function should have one argument
-LL | |     loop {}
-LL | | }
-   | |_^
+LL | fn oom() -> ! { //~ ERROR function should have one argument
+   | ^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr
index 0eb0d4e1000..5d0395e17f5 100644
--- a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr
+++ b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr
@@ -1,10 +1,8 @@
 error: function should have one argument
   --> $DIR/panic-handler-bad-signature-3.rs:20:1
    |
-LL | / fn panic() -> ! { //~ ERROR function should have one argument
-LL | |     loop {}
-LL | | }
-   | |_^
+LL | fn panic() -> ! { //~ ERROR function should have one argument
+   | ^^^^^^^^^^^^^^^
 
 error: aborting due to previous error