File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -895,13 +895,14 @@ fn add_one(x: int) -> int {
895895We would get an error:
896896
897897``` {ignore,notrust}
898- note: consider removing this semicolon:
899- x + 1;
900- ^
901898error: not all control paths return a value
902899fn add_one(x: int) -> int {
903900 x + 1;
904901}
902+
903+ note: consider removing this semicolon:
904+ x + 1;
905+ ^
905906```
906907
907908Remember our earlier discussions about semicolons and ` () ` ? Our function claims
Original file line number Diff line number Diff line change @@ -1458,6 +1458,8 @@ impl<'a> Liveness<'a> {
14581458 } ,
14591459 _ => false
14601460 } ;
1461+ self . ir . tcx . sess . span_err (
1462+ sp, "not all control paths return a value" ) ;
14611463 if ends_with_stmt {
14621464 let last_stmt = body. stmts . last ( ) . unwrap ( ) ;
14631465 let original_span = original_sp ( last_stmt. span , sp) ;
@@ -1469,8 +1471,6 @@ impl<'a> Liveness<'a> {
14691471 self . ir . tcx . sess . span_note (
14701472 span_semicolon, "consider removing this semicolon:" ) ;
14711473 }
1472- self . ir . tcx . sess . span_err (
1473- sp, "not all control paths return a value" ) ;
14741474 }
14751475 }
14761476 }
You can’t perform that action at this time.
0 commit comments