]> git.lizzy.rs Git - rust.git/commitdiff
Tweak wording of fn without explicit return
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 8 Aug 2019 21:53:00 +0000 (14:53 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Fri, 9 Aug 2019 14:18:05 +0000 (07:18 -0700)
15 files changed:
src/librustc_typeck/check/mod.rs
src/test/ui/block-result/consider-removing-last-semi.stderr
src/test/ui/block-result/issue-11714.stderr
src/test/ui/block-result/issue-13428.stderr
src/test/ui/coercion/coercion-missing-tail-expected-type.stderr
src/test/ui/issues/issue-32323.stderr
src/test/ui/issues/issue-43162.stderr
src/test/ui/issues/issue-44023.stderr
src/test/ui/issues/issue-6458-4.stderr
src/test/ui/liveness/liveness-forgot-ret.stderr
src/test/ui/liveness/liveness-missing-ret2.stderr
src/test/ui/liveness/liveness-return-last-stmt-semi.stderr
src/test/ui/missing/missing-return.stderr
src/test/ui/parser/issue-62881.stderr
src/test/ui/parser/issue-62895.stderr

index be2af2db66d595aa1d1db91138517c995959206b..726922c8e5346b573fdef97b01053c7941526657 100644 (file)
@@ -3709,7 +3709,10 @@ fn check_block_with_expected(
                             self.consider_hint_about_removing_semicolon(blk, expected_ty, err);
                         }
                         if let Some(fn_span) = fn_span {
-                            err.span_label(fn_span, "this function's body doesn't return a value");
+                            err.span_label(
+                                fn_span,
+                                "this function's body doesn't `return` a value",
+                            );
                         }
                     }, false);
                 }
index 7f8bb67c946e6e22c7ce5f84f2bfcee8ca785c34..f3dfc8b12eafe5f96086a6293b396a1f939867ad 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn f() -> String {
    |    -      ^^^^^^ expected struct `std::string::String`, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |     0u8;
 LL |     "bla".to_string();
    |                      - help: consider removing this semicolon
@@ -18,7 +18,7 @@ error[E0308]: mismatched types
 LL | fn g() -> String {
    |    -      ^^^^^^ expected struct `std::string::String`, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |     "this won't work".to_string();
 LL |     "removeme".to_string();
    |                           - help: consider removing this semicolon
index 569e012540c4f938a4c1cd4e30cf5a5e1c10a47b..021a25ece2f4daf786c67f1776f45216877c75cd 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn blah() -> i32 {
    |    ----      ^^^ expected i32, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 ...
 LL |     ;
    |     - help: consider removing this semicolon
index ca48910026d9a45888bd490703cfd963cd34e1a0..8fa6ae9c528b46537cb65972e5d705e67adf25ac 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn foo() -> String {
    |    ---      ^^^^^^ expected struct `std::string::String`, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 ...
 LL |     ;
    |     - help: consider removing this semicolon
@@ -18,7 +18,7 @@ error[E0308]: mismatched types
 LL | fn bar() -> String {
    |    ---      ^^^^^^ expected struct `std::string::String`, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |     "foobar".to_string()
 LL |     ;
    |     - help: consider removing this semicolon
index a7ac930ba670e40ef5c5ae24dfbf2ff7617fd5b6..6ecb1d3eaef4a533c7184afde3f3a5bd8b5e9f41 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn plus_one(x: i32) -> i32 {
    |    --------            ^^^ expected i32, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |     x + 1;
    |          - help: consider removing this semicolon
    |
@@ -17,7 +17,7 @@ error[E0308]: mismatched types
 LL | fn foo() -> Result<u8, u64> {
    |    ---      ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |     Ok(1);
    |          - help: consider removing this semicolon
    |
index 6b8bca078b5e6fb761d690fa431c1415e567b6c9..376676bda7dbfe82da0601b3f889b9e763dad8bc 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {}
    |        -                     ^^^^^^^^^^^^^^^^^^ expected associated type, found ()
    |        |
-   |        this function's body doesn't return a value
+   |        this function's body doesn't `return` a value
    |
    = note: expected type `<T as Tr<'a>>::Out`
               found type `()`
index fd62ac30ab1954f5e7437f19a539ddeedf47fd09..22d347778c8f47c49cd7f2221573b01cb9db0cb1 100644 (file)
@@ -16,7 +16,7 @@ error[E0308]: mismatched types
 LL | fn foo() -> bool {
    |    ---      ^^^^ expected bool, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |
 LL |     break true;
    |               - help: consider removing this semicolon
index cad202129a719aa2439eb2000ffda73790e6796a..7760af8145b073ec27864e1f4ea14806b417e6b4 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize {
    |    ------------------------        ^^^^^ expected isize, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
    |
    = note: expected type `isize`
               found type `()`
index d4f5b2ba41f69f6e21e081e6cc37e9c38013911a..e29be760874169c1767849ee1715bd1f9502b1d7 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn foo(b: bool) -> Result<bool,String> {
    |    ---             ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |     Err("bar".to_string());
    |                           - help: consider removing this semicolon
    |
index 6d917393663b04d498e0b180cf03cb26ad4e547d..68cbdb2cfdba6ec4ce8bd2221b814f68764dc206 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn f(a: isize) -> isize { if god_exists(a) { return 5; }; }
    |    -              ^^^^^ expected isize, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
    |
    = note: expected type `isize`
               found type `()`
index a71b9296702b75c440d4be2733a5df80748bdecf..62e0aa5d29d95d62705a4a5fa1797b54aae3f2ec 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn f() -> isize {
    |    -      ^^^^^ expected isize, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
    |
    = note: expected type `isize`
               found type `()`
index 3a0869917064354cc7d427092fc8b3e3f25a6b8b..c5018af74f347ae634b25e7bc41a24a2f6296454 100644 (file)
@@ -5,7 +5,7 @@ LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } }
    |                                ---      ^^^    - help: consider removing this semicolon
    |                                |        |
    |                                |        expected i32, found ()
-   |                                this function's body doesn't return a value
+   |                                this function's body doesn't `return` a value
 ...
 LL |     test!();
    |     -------- in this macro invocation
@@ -19,7 +19,7 @@ error[E0308]: mismatched types
 LL | fn no_return() -> i32 {}
    |    ---------      ^^^ expected i32, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
    |
    = note: expected type `i32`
               found type `()`
@@ -30,7 +30,7 @@ error[E0308]: mismatched types
 LL | fn bar(x: u32) -> u32 {
    |    ---            ^^^ expected u32, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
 LL |     x * 2;
    |          - help: consider removing this semicolon
    |
@@ -43,7 +43,7 @@ error[E0308]: mismatched types
 LL | fn baz(x: u64) -> u32 {
    |    ---            ^^^ expected u32, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
    |
    = note: expected type `u32`
               found type `()`
index c7d7116a9cd7cdc2197cbdd29b53c1d19aab1eea..4cd516ba81d6a9efd81c330d7182b98f8c4acff0 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL | fn f() -> isize { }
    |    -      ^^^^^ expected isize, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
    |
    = note: expected type `isize`
               found type `()`
index b2e2da35a2700599ba96812f68a8d03aa4108db1..11b8836a89a76da7a7feff90e6b813e6d07fea8a 100644 (file)
@@ -19,7 +19,7 @@ error[E0308]: mismatched types
 LL | fn f() -> isize { fn f() -> isize {} pub f<
    |                      -      ^^^^^ expected isize, found ()
    |                      |
-   |                      this function's body doesn't return a value
+   |                      this function's body doesn't `return` a value
    |
    = note: expected type `isize`
               found type `()`
index 6c3a8fb766c0a708c02d7868ec1125361c6b9608..d9d3baf6227080c7cc2309a755302240ecdb4bf1 100644 (file)
@@ -38,7 +38,7 @@ error[E0308]: mismatched types
 LL | fn v() -> isize {
    |    -      ^^^^^ expected isize, found ()
    |    |
-   |    this function's body doesn't return a value
+   |    this function's body doesn't `return` a value
    |
    = note: expected type `isize`
               found type `()`