Improve error message for type mismatch in generator arguments
This commit is contained in:
parent
c7dbe7a830
commit
cbd79836a5
4 changed files with 55 additions and 14 deletions
19
src/test/ui/generator/issue-88653.rs
Normal file
19
src/test/ui/generator/issue-88653.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Regression test for #88653, where a confusing warning about a
|
||||
// type mismatch in generator arguments was issued.
|
||||
|
||||
#![feature(generators, generator_trait)]
|
||||
|
||||
use std::ops::Generator;
|
||||
|
||||
fn foo(bar: bool) -> impl Generator<(bool,)> {
|
||||
//~^ ERROR: type mismatch in generator arguments [E0631]
|
||||
//~| NOTE: expected signature of `fn((bool,)) -> _`
|
||||
|bar| {
|
||||
//~^ NOTE: found signature of `fn(bool) -> _`
|
||||
if bar {
|
||||
yield bar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
12
src/test/ui/generator/issue-88653.stderr
Normal file
12
src/test/ui/generator/issue-88653.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0631]: type mismatch in generator arguments
|
||||
--> $DIR/issue-88653.rs:8:22
|
||||
|
|
||||
LL | fn foo(bar: bool) -> impl Generator<(bool,)> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `fn((bool,)) -> _`
|
||||
...
|
||||
LL | |bar| {
|
||||
| ----- found signature of `fn(bool) -> _`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0631`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue