@@ -111,7 +111,7 @@ pub trait AstConv<'tcx> {
111
111
}
112
112
113
113
/// What type should we use when a type is omitted?
114
- fn ty_infer ( & self , span : Span ) -> Ty < ' tcx > ;
114
+ fn ty_infer ( & self , default : Option < Ty < ' tcx > > , span : Span ) -> Ty < ' tcx > ;
115
115
116
116
/// Projecting an associated type from a (potentially)
117
117
/// higher-ranked trait reference is more complicated, because of
@@ -403,7 +403,7 @@ fn create_substs_for_ast_path<'tcx>(
403
403
// they were optional (e.g. paths inside expressions).
404
404
let mut type_substs = if param_mode == PathParamMode :: Optional &&
405
405
types_provided. is_empty ( ) {
406
- ( 0 ..formal_ty_param_count ) . map ( |_ | this. ty_infer ( span) ) . collect ( )
406
+ ty_param_defs . iter ( ) . map ( |p | this. ty_infer ( p . default , span) ) . collect ( )
407
407
} else {
408
408
types_provided
409
409
} ;
@@ -1661,7 +1661,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
1661
1661
// values in a ExprClosure, or as
1662
1662
// the type of local variables. Both of these cases are
1663
1663
// handled specially and will not descend into this routine.
1664
- this. ty_infer ( ast_ty. span )
1664
+ this. ty_infer ( None , ast_ty. span )
1665
1665
}
1666
1666
} ;
1667
1667
@@ -1677,7 +1677,7 @@ pub fn ty_of_arg<'tcx>(this: &AstConv<'tcx>,
1677
1677
{
1678
1678
match a. ty . node {
1679
1679
ast:: TyInfer if expected_ty. is_some ( ) => expected_ty. unwrap ( ) ,
1680
- ast:: TyInfer => this. ty_infer ( a. ty . span ) ,
1680
+ ast:: TyInfer => this. ty_infer ( None , a. ty . span ) ,
1681
1681
_ => ast_ty_to_ty ( this, rscope, & * a. ty ) ,
1682
1682
}
1683
1683
}
@@ -1796,7 +1796,7 @@ fn ty_of_method_or_bare_fn<'a, 'tcx>(this: &AstConv<'tcx>,
1796
1796
1797
1797
let output_ty = match decl. output {
1798
1798
ast:: Return ( ref output) if output. node == ast:: TyInfer =>
1799
- ty:: FnConverging ( this. ty_infer ( output. span ) ) ,
1799
+ ty:: FnConverging ( this. ty_infer ( None , output. span ) ) ,
1800
1800
ast:: Return ( ref output) =>
1801
1801
ty:: FnConverging ( convert_ty_with_lifetime_elision ( this,
1802
1802
implied_output_region,
@@ -1936,7 +1936,7 @@ pub fn ty_of_closure<'tcx>(
1936
1936
_ if is_infer && expected_ret_ty. is_some ( ) =>
1937
1937
expected_ret_ty. unwrap ( ) ,
1938
1938
_ if is_infer =>
1939
- ty:: FnConverging ( this. ty_infer ( decl. output . span ( ) ) ) ,
1939
+ ty:: FnConverging ( this. ty_infer ( None , decl. output . span ( ) ) ) ,
1940
1940
ast:: Return ( ref output) =>
1941
1941
ty:: FnConverging ( ast_ty_to_ty ( this, & rb, & * * output) ) ,
1942
1942
ast:: DefaultReturn ( ..) => unreachable ! ( ) ,
0 commit comments