Skip to content

Commit 8e1b96a

Browse files
authored
Rollup merge of rust-lang#35351 - jaredwy:update-error-69, r=jonathandturner
Updated error format for E0069 Fixes rust-lang#35219 which is part of the error bonanza at rust-lang#35233 r? @jonathandturner
2 parents bb1ff9d + 1cf5142 commit 8e1b96a

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
@@ -3406,8 +3406,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
34063406
// FIXME(#32730) propagate obligations
34073407
.map(|InferOk { obligations, .. }| assert!(obligations.is_empty()));
34083408
if eq_result.is_err() {
3409-
span_err!(tcx.sess, expr.span, E0069,
3410-
"`return;` in a function whose return type is not `()`");
3409+
struct_span_err!(tcx.sess, expr.span, E0069,
3410+
"`return;` in a function whose return type is not `()`")
3411+
.span_label(expr.span, &format!("return type is not ()"))
3412+
.emit();
34113413
}
34123414
}
34133415
}

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)