Point at def span on incorrect panic or alloc error handler

This commit is contained in:
Esteban Küber 2018-08-30 16:00:09 -07:00
parent e6b35b0e11
commit 70ed4f972e
3 changed files with 6 additions and 8 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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