Skip to content

Commit

Permalink
Rollup merge of rust-lang#35351 - jaredwy:update-error-69, r=jonathan…
Browse files Browse the repository at this point in the history
…dturner

Updated error format for E0069

Fixes rust-lang#35219 which is part of the error bonanza at rust-lang#35233

r? @jonathandturner
  • Loading branch information
eddyb committed Aug 6, 2016
2 parents bb1ff9d + 1cf5142 commit 8e1b96a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3406,8 +3406,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();
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0069.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 8e1b96a

Please sign in to comment.