Skip to content

Commit 1cf5142

Browse files
committed
Updated error format for E0069
1 parent a0b4e67 commit 1cf5142

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,8 +3383,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
33833383
// FIXME(#32730) propagate obligations
33843384
.map(|InferOk { obligations, .. }| assert!(obligations.is_empty()));
33853385
if eq_result.is_err() {
3386-
span_err!(tcx.sess, expr.span, E0069,
3387-
"`return;` in a function whose return type is not `()`");
3386+
struct_span_err!(tcx.sess, expr.span, E0069,
3387+
"`return;` in a function whose return type is not `()`")
3388+
.span_label(expr.span, &format!("return type is not ()"))
3389+
.emit();
33883390
}
33893391
}
33903392
}

src/test/compile-fail/E0069.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// except according to those terms.
1010

1111
fn foo() -> u8 {
12-
return; //~ ERROR E0069
12+
return;
13+
//~^ ERROR `return;` in a function whose return type is not `()`
14+
//~| NOTE return type is not ()
1315
}
1416

1517
fn main() {

0 commit comments

Comments
 (0)