File tree 2 files changed +6
-5
lines changed
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 {
895
895
We would get an error:
896
896
897
897
``` {ignore,notrust}
898
- note: consider removing this semicolon:
899
- x + 1;
900
- ^
901
898
error: not all control paths return a value
902
899
fn add_one(x: int) -> int {
903
900
x + 1;
904
901
}
902
+
903
+ note: consider removing this semicolon:
904
+ x + 1;
905
+ ^
905
906
```
906
907
907
908
Remember 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> {
1458
1458
} ,
1459
1459
_ => false
1460
1460
} ;
1461
+ self . ir . tcx . sess . span_err (
1462
+ sp, "not all control paths return a value" ) ;
1461
1463
if ends_with_stmt {
1462
1464
let last_stmt = body. stmts . last ( ) . unwrap ( ) ;
1463
1465
let original_span = original_sp ( last_stmt. span , sp) ;
@@ -1469,8 +1471,6 @@ impl<'a> Liveness<'a> {
1469
1471
self . ir . tcx . sess . span_note (
1470
1472
span_semicolon, "consider removing this semicolon:" ) ;
1471
1473
}
1472
- self . ir . tcx . sess . span_err (
1473
- sp, "not all control paths return a value" ) ;
1474
1474
}
1475
1475
}
1476
1476
}
You can’t perform that action at this time.
0 commit comments