File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -462,7 +462,7 @@ impl InferenceContext<'_> {
462
462
}
463
463
464
464
fn expr_ty ( & mut self , expr : ExprId ) -> Ty {
465
- self . infer_expr_no_expect ( expr)
465
+ self . result [ expr] . clone ( )
466
466
}
467
467
468
468
fn is_upvar ( & self , place : & HirPlace ) -> bool {
Original file line number Diff line number Diff line change @@ -1067,6 +1067,23 @@ fn parse_arule() {
1067
1067
)
1068
1068
}
1069
1069
1070
+ #[ test]
1071
+ fn nested_closure ( ) {
1072
+ check_types (
1073
+ r#"
1074
+ //- minicore: fn, option
1075
+
1076
+ fn map<T, U>(o: Option<T>, f: impl FnOnce(T) -> U) -> Option<U> { loop {} }
1077
+
1078
+ fn test() {
1079
+ let o = Some(Some(2));
1080
+ map(o, |s| map(s, |x| x));
1081
+ // ^ i32
1082
+ }
1083
+ "# ,
1084
+ ) ;
1085
+ }
1086
+
1070
1087
#[ test]
1071
1088
fn call_expected_type_closure ( ) {
1072
1089
check_types (
You can’t perform that action at this time.
0 commit comments