diff options
| author | bors <bors@rust-lang.org> | 2021-04-17 07:17:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-17 07:17:31 +0000 |
| commit | 080d30235fff4373fc5ce9f84875e3be91d1a09e (patch) | |
| tree | f1da91768e919820854f574625fe0d4c08b306d6 /src | |
| parent | 57e28ef86fdf528d1e348312f5b2775d9de2cbd0 (diff) | |
| parent | af90cac0e15de4479c8880f6ab80194a8d2b7291 (diff) | |
| download | rust-080d30235fff4373fc5ce9f84875e3be91d1a09e.tar.gz rust-080d30235fff4373fc5ce9f84875e3be91d1a09e.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/closures/issue-84128.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/closures/issue-84128.stderr | 15 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/closures/issue-84128.rs b/src/test/ui/closures/issue-84128.rs new file mode 100644 index 00000000000..f81d7cfaa65 --- /dev/null +++ b/src/test/ui/closures/issue-84128.rs @@ -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] + }; +} diff --git a/src/test/ui/closures/issue-84128.stderr b/src/test/ui/closures/issue-84128.stderr new file mode 100644 index 00000000000..70d9273ddf7 --- /dev/null +++ b/src/test/ui/closures/issue-84128.stderr @@ -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`. |
