mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
add regression test for closure return ICE
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// Regression test for https://github.com/rust-lang/rust/issues/155893.
|
||||
|
||||
fn func(_f: impl Fn()) {
|
||||
func(|| return 2)
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,15 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/return-in-closure-with-fn-bound.rs:4:20
|
||||
|
|
||||
LL | func(|| return 2)
|
||||
| ^ expected `()`, found integer
|
||||
|
|
||||
note: return type inferred to be `()` here
|
||||
--> $DIR/return-in-closure-with-fn-bound.rs:4:20
|
||||
|
|
||||
LL | func(|| return 2)
|
||||
| ^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Reference in New Issue
Block a user