We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f41053 commit 5cff355Copy full SHA for 5cff355
crates/hir_ty/src/tests/regression.rs
@@ -1094,3 +1094,23 @@ fn parse_arule() {
1094
"#,
1095
)
1096
}
1097
+
1098
+#[test]
1099
+fn call_expected_type_closure() {
1100
+ check_types(
1101
+ r#"
1102
+//- minicore: fn, option
1103
1104
+fn map<T, U>(o: Option<T>, f: impl FnOnce(T) -> U) -> Option<U> { loop {} }
1105
+struct S {
1106
+ field: u32
1107
+}
1108
1109
+fn test() {
1110
+ let o = Some(S { field: 2 });
1111
+ let _: Option<()> = map(o, |s| { s.field; });
1112
+ // ^^^^^^^ u32
1113
1114
+ "#,
1115
+ );
1116
0 commit comments