Point at function name span
This commit is contained in:
parent
1f65dc0770
commit
f62f540b4e
17 changed files with 132 additions and 77 deletions
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/consider-removing-last-semi.rs:1:11
|
||||
|
|
||||
LL | fn f() -> String { //~ ERROR mismatched types
|
||||
| ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| - ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | 0u8;
|
||||
LL | "bla".to_string();
|
||||
| - help: consider removing this semicolon
|
||||
|
|
@ -14,7 +16,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/consider-removing-last-semi.rs:6:11
|
||||
|
|
||||
LL | fn g() -> String { //~ ERROR mismatched types
|
||||
| ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| - ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | "this won't work".to_string();
|
||||
LL | "removeme".to_string();
|
||||
| - help: consider removing this semicolon
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-11714.rs:1:14
|
||||
|
|
||||
LL | fn blah() -> i32 { //~ ERROR mismatched types
|
||||
| ^^^ expected i32, found ()
|
||||
| ---- ^^^ expected i32, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
...
|
||||
LL | ;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-13428.rs:3:13
|
||||
|
|
||||
LL | fn foo() -> String { //~ ERROR mismatched types
|
||||
| ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| --- ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
...
|
||||
LL | ;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
@ -14,7 +16,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-13428.rs:11:13
|
||||
|
|
||||
LL | fn bar() -> String { //~ ERROR mismatched types
|
||||
| ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| --- ^^^^^^ expected struct `std::string::String`, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | "foobar".to_string()
|
||||
LL | ;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/break-while-condition.rs:3:11
|
||||
|
|
||||
LL | fn main() {
|
||||
| ^ expected !, found ()
|
||||
| ---- ^ expected !, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/coercion-missing-tail-expected-type.rs:3:24
|
||||
|
|
||||
LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types
|
||||
| ^^^ expected i32, found ()
|
||||
| -------- ^^^ expected i32, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | x + 1;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
|
|
@ -13,7 +15,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/coercion-missing-tail-expected-type.rs:7:13
|
||||
|
|
||||
LL | fn foo() -> Result<u8, u64> { //~ ERROR mismatched types
|
||||
| ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
|
||||
| --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | Ok(1);
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-10536.rs:11:15
|
||||
|
|
||||
LL | pub fn main() {
|
||||
| ^ expected bool, found ()
|
||||
| ---- ^ expected bool, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-32323.rs:5:30
|
||||
|
|
||||
LL | pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {}
|
||||
| ^^^^^^^^^^^^^^^^^^ expected associated type, found ()
|
||||
| - ^^^^^^^^^^^^^^^^^^ expected associated type, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `<T as Tr<'a>>::Out`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-43162.rs:1:13
|
||||
|
|
||||
LL | fn foo() -> bool {
|
||||
| ^^^^ expected bool, found ()
|
||||
| --- ^^^^ expected bool, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | //~^ ERROR E0308
|
||||
LL | break true; //~ ERROR E0268
|
||||
| - help: consider removing this semicolon
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-44023.rs:5:36
|
||||
|
|
||||
LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types
|
||||
| ^^^^^ expected isize, found ()
|
||||
| ------------------------ ^^^^^ expected isize, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/issue-6458-4.rs:1:20
|
||||
|
|
||||
LL | fn foo(b: bool) -> Result<bool,String> { //~ ERROR mismatched types
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
|
||||
| --- ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | Err("bar".to_string());
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/liveness-closure-require-ret.rs:2:37
|
||||
--> $DIR/liveness-closure-require-ret.rs:2:11
|
||||
|
|
||||
LL | fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types
|
||||
| ^^ expected isize, found ()
|
||||
| ---- ^ expected isize, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ error[E0308]: mismatched types
|
|||
--> $DIR/liveness-forgot-ret.rs:3:19
|
||||
|
|
||||
LL | fn f(a: isize) -> isize { if god_exists(a) { return 5; }; }
|
||||
| ^^^^^ expected isize, found () - expected because of this statement
|
||||
| - ^^^^^ - expected because of this statement
|
||||
| | |
|
||||
| | expected isize, found ()
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/liveness-issue-2163.rs:5:30
|
||||
--> $DIR/liveness-issue-2163.rs:3:11
|
||||
|
|
||||
LL | a.iter().all(|_| -> bool {
|
||||
| ______________________________^
|
||||
LL | | //~^ ERROR mismatched types
|
||||
LL | | });
|
||||
| |_____^ expected bool, found ()
|
||||
LL | fn main() {
|
||||
| ---- ^ expected bool, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/liveness-missing-ret2.rs:1:11
|
||||
|
|
||||
LL | fn f() -> isize { //~ ERROR mismatched types
|
||||
| ^^^^^ expected isize, found ()
|
||||
| - ^^^^^ expected isize, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ error[E0308]: mismatched types
|
|||
--> $DIR/liveness-return-last-stmt-semi.rs:4:41
|
||||
|
|
||||
LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } }
|
||||
| ^^^ - help: consider removing this semicolon
|
||||
| |
|
||||
| expected i32, found ()
|
||||
| --- ^^^ - help: consider removing this semicolon
|
||||
| | |
|
||||
| | expected i32, found ()
|
||||
| this function's body doesn't return the expected type
|
||||
...
|
||||
LL | test!();
|
||||
| -------- in this macro invocation
|
||||
|
|
@ -16,7 +17,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/liveness-return-last-stmt-semi.rs:7:19
|
||||
|
|
||||
LL | fn no_return() -> i32 {} //~ ERROR mismatched types
|
||||
| ^^^ expected i32, found ()
|
||||
| --------- ^^^ expected i32, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `()`
|
||||
|
|
@ -25,7 +28,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/liveness-return-last-stmt-semi.rs:9:19
|
||||
|
|
||||
LL | fn bar(x: u32) -> u32 { //~ ERROR mismatched types
|
||||
| ^^^ expected u32, found ()
|
||||
| --- ^^^ expected u32, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
LL | x * 2;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
|
|
@ -36,7 +41,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/liveness-return-last-stmt-semi.rs:13:19
|
||||
|
|
||||
LL | fn baz(x: u64) -> u32 { //~ ERROR mismatched types
|
||||
| ^^^ expected u32, found ()
|
||||
| --- ^^^ expected u32, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/missing-return.rs:3:11
|
||||
|
|
||||
LL | fn f() -> isize { }
|
||||
| ^^^^^ expected isize, found ()
|
||||
| - ^^^^^ expected isize, found ()
|
||||
| |
|
||||
| this function's body doesn't return the expected type
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found type `()`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue