@@ -109,7 +109,7 @@ pub trait AstConv<'tcx> {
109
109
}
110
110
111
111
/// What type should we use when a type is omitted?
112
- fn ty_infer ( & self , span : Span ) -> Ty < ' tcx > ;
112
+ fn ty_infer ( & self , default : Option < Ty < ' tcx > > , span : Span ) -> Ty < ' tcx > ;
113
113
114
114
/// Projecting an associated type from a (potentially)
115
115
/// higher-ranked trait reference is more complicated, because of
@@ -401,7 +401,7 @@ fn create_substs_for_ast_path<'tcx>(
401
401
// they were optional (e.g. paths inside expressions).
402
402
let mut type_substs = if param_mode == PathParamMode :: Optional &&
403
403
types_provided. is_empty ( ) {
404
- ( 0 ..formal_ty_param_count ) . map ( |_ | this. ty_infer ( span) ) . collect ( )
404
+ ty_param_defs . iter ( ) . map ( |p | this. ty_infer ( p . default , span) ) . collect ( )
405
405
} else {
406
406
types_provided
407
407
} ;
@@ -1665,7 +1665,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
1665
1665
// values in a ExprClosure, or as
1666
1666
// the type of local variables. Both of these cases are
1667
1667
// handled specially and will not descend into this routine.
1668
- this. ty_infer ( ast_ty. span )
1668
+ this. ty_infer ( None , ast_ty. span )
1669
1669
}
1670
1670
} ;
1671
1671
@@ -1681,7 +1681,7 @@ pub fn ty_of_arg<'tcx>(this: &AstConv<'tcx>,
1681
1681
{
1682
1682
match a. ty . node {
1683
1683
ast:: TyInfer if expected_ty. is_some ( ) => expected_ty. unwrap ( ) ,
1684
- ast:: TyInfer => this. ty_infer ( a. ty . span ) ,
1684
+ ast:: TyInfer => this. ty_infer ( None , a. ty . span ) ,
1685
1685
_ => ast_ty_to_ty ( this, rscope, & * a. ty ) ,
1686
1686
}
1687
1687
}
@@ -1800,7 +1800,7 @@ fn ty_of_method_or_bare_fn<'a, 'tcx>(this: &AstConv<'tcx>,
1800
1800
1801
1801
let output_ty = match decl. output {
1802
1802
ast:: Return ( ref output) if output. node == ast:: TyInfer =>
1803
- ty:: FnConverging ( this. ty_infer ( output. span ) ) ,
1803
+ ty:: FnConverging ( this. ty_infer ( None , output. span ) ) ,
1804
1804
ast:: Return ( ref output) =>
1805
1805
ty:: FnConverging ( convert_ty_with_lifetime_elision ( this,
1806
1806
implied_output_region,
@@ -1940,7 +1940,7 @@ pub fn ty_of_closure<'tcx>(
1940
1940
_ if is_infer && expected_ret_ty. is_some ( ) =>
1941
1941
expected_ret_ty. unwrap ( ) ,
1942
1942
_ if is_infer =>
1943
- ty:: FnConverging ( this. ty_infer ( decl. output . span ( ) ) ) ,
1943
+ ty:: FnConverging ( this. ty_infer ( None , decl. output . span ( ) ) ) ,
1944
1944
ast:: Return ( ref output) =>
1945
1945
ty:: FnConverging ( ast_ty_to_ty ( this, & rb, & * * output) ) ,
1946
1946
ast:: DefaultReturn ( ..) => unreachable ! ( ) ,
0 commit comments