diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-05-09 20:49:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-09 20:49:31 +0200 |
| commit | 985ea2248977f90df2dcfbaef8281273ccb46fe7 (patch) | |
| tree | 1f86aec71b45a49ac5e035cbed793453f5d6fe9c /tests/ui/closures | |
| parent | e4c82501c2240a09bd082a3ddc03b68dab83f532 (diff) | |
| parent | 02856110968903bf50a32184db200ccd9b6cc8b6 (diff) | |
| download | rust-985ea2248977f90df2dcfbaef8281273ccb46fe7.tar.gz rust-985ea2248977f90df2dcfbaef8281273ccb46fe7.zip | |
Rollup merge of #111021 - c410-f3r:dqewdas, r=petrochenkov
Move some tests r? ``@petrochenkov``
Diffstat (limited to 'tests/ui/closures')
| -rw-r--r-- | tests/ui/closures/issue-868.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/closures/issue-868.rs b/tests/ui/closures/issue-868.rs new file mode 100644 index 00000000000..ce0a3c7ca52 --- /dev/null +++ b/tests/ui/closures/issue-868.rs @@ -0,0 +1,18 @@ +// run-pass +#![allow(unused_parens)] +// pretty-expanded FIXME #23616 + +fn f<T, F>(g: F) -> T where F: FnOnce() -> T { g() } + +pub fn main() { + let _x = f( | | { 10 }); + // used to be: cannot determine a type for this expression + f(| | { }); + // ditto + f( | | { ()}); + // always worked + let _: () = f(| | { }); + // empty block with no type info should compile too + let _ = f(||{}); + let _ = (||{}); +} |
