Skip to content

Commit

Permalink
Point at def span on incorrect panic or alloc error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Aug 30, 2018
1 parent e6b35b0 commit 70ed4f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 70ed4f9

Please sign in to comment.