Don't point out return span on every E0308
This commit is contained in:
parent
1b57946a40
commit
c62a8ea9df
5 changed files with 59 additions and 28 deletions
|
|
@ -6,11 +6,6 @@ LL | Foo(())
|
|||
| |
|
||||
| arguments to this struct are incorrect
|
||||
|
|
||||
note: return type inferred to be `{integer}` here
|
||||
--> $DIR/issue-84128.rs:10:20
|
||||
|
|
||||
LL | return Foo(0);
|
||||
| ^^^^^^
|
||||
note: tuple struct defined here
|
||||
--> $DIR/issue-84128.rs:5:8
|
||||
|
|
||||
|
|
|
|||
18
src/test/ui/mismatched_types/dont-point-return-on-E0308.rs
Normal file
18
src/test/ui/mismatched_types/dont-point-return-on-E0308.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// edition:2021
|
||||
|
||||
async fn f(_: &()) {}
|
||||
//~^ NOTE function defined here
|
||||
//~| NOTE
|
||||
// Second note is the span of the underlined argument, I think...
|
||||
|
||||
fn main() {
|
||||
(|| async {
|
||||
Err::<(), ()>(())?;
|
||||
f(());
|
||||
//~^ ERROR mismatched types
|
||||
//~| NOTE arguments to this function are incorrect
|
||||
//~| NOTE expected `&()`, found `()`
|
||||
//~| HELP consider borrowing here
|
||||
Ok::<(), ()>(())
|
||||
})();
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/dont-point-return-on-E0308.rs:10:11
|
||||
|
|
||||
LL | f(());
|
||||
| - ^^
|
||||
| | |
|
||||
| | expected `&()`, found `()`
|
||||
| | help: consider borrowing here: `&()`
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/dont-point-return-on-E0308.rs:3:10
|
||||
|
|
||||
LL | async fn f(_: &()) {}
|
||||
| ^ ------
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue