-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #84244 - ABouttefeux:closure-return-conflict-suggest, r…
…=estebank fix incomplete diagnostic notes when closure returns conflicting for genric type fixes #84128 Correctly report the span on for conflicting return type in closures
- Loading branch information
Showing
4 changed files
with
60 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// test for issue 84128 | ||
// missing suggestion for similar ADT type with diffetent generic paramenter | ||
// on closure ReturnNoExpression | ||
|
||
struct Foo<T>(T); | ||
|
||
fn main() { | ||
|| { | ||
if false { | ||
return Foo(0); | ||
} | ||
|
||
Foo(()) | ||
//~^ ERROR mismatched types [E0308] | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-84128.rs:13:13 | ||
| | ||
LL | Foo(()) | ||
| ^^ expected integer, found `()` | ||
| | ||
note: return type inferred to be `{integer}` here | ||
--> $DIR/issue-84128.rs:10:20 | ||
| | ||
LL | return Foo(0); | ||
| ^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |