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<'_> {
462462 }
463463
464464 fn expr_ty ( & mut self , expr : ExprId ) -> Ty {
465- self . infer_expr_no_expect ( expr)
465+ self . result [ expr] . clone ( )
466466 }
467467
468468 fn is_upvar ( & self , place : & HirPlace ) -> bool {
Original file line number Diff line number Diff line change @@ -1067,6 +1067,23 @@ fn parse_arule() {
10671067 )
10681068}
10691069
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+
10701087#[ test]
10711088fn call_expected_type_closure ( ) {
10721089 check_types (
You can’t perform that action at this time.
0 commit comments