@@ -18,6 +18,7 @@ use rustc::hir::def::{Def, CtorKind};
1818use rustc:: middle:: const_val:: ConstVal ;
1919use rustc:: ty:: { self , AdtKind , VariantDef , Ty } ;
2020use rustc:: ty:: cast:: CastKind as TyCastKind ;
21+ use rustc:: ty:: subst:: Subst ;
2122use rustc:: hir;
2223use syntax:: ptr:: P ;
2324
@@ -92,9 +93,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
9293 let kind = if let Some ( method) = overloaded {
9394 debug ! ( "make_mirror: overloaded autoderef (method={:?})" , method) ;
9495
95- // Method calls always have all late-bound regions
96- // fully instantiated.
97- ref_ty = cx. tcx . no_late_bound_regions ( & method. ty . fn_ret ( ) ) . unwrap ( ) ;
96+ ref_ty = method. sig . output ( ) ;
9897 let ( region, mutbl) = match ref_ty. sty {
9998 ty:: TyRef ( region, mt) => ( region, mt. mutbl ) ,
10099 _ => span_bug ! ( expr. span, "autoderef returned bad type" ) ,
@@ -265,14 +264,9 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
265264
266265 // rewrite f(u, v) into FnOnce::call_once(f, (u, v))
267266
267+ let sig = method. sig ;
268268 let method = method_callee ( cx, expr, method) ;
269269
270- let sig = method. ty . fn_sig ( ) ;
271-
272- let sig = cx. tcx
273- . no_late_bound_regions ( & sig)
274- . unwrap_or_else ( || span_bug ! ( expr. span, "method call has late-bound regions" ) ) ;
275-
276270 assert_eq ! ( sig. inputs( ) . len( ) , 2 ) ;
277271
278272 let tupled_args = Expr {
@@ -711,7 +705,7 @@ fn method_callee<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
711705 Expr {
712706 temp_lifetime : temp_lifetime,
713707 temp_lifetime_was_shrunk : was_shrunk,
714- ty : callee. ty ,
708+ ty : cx . tcx . type_of ( callee. def_id ) . subst ( cx . tcx , callee . substs ) ,
715709 span : expr. span ,
716710 kind : ExprKind :: Literal {
717711 literal : Literal :: Value {
@@ -1012,9 +1006,7 @@ fn overloaded_lvalue<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
10121006 // line up (this is because `*x` and `x[y]` represent lvalues):
10131007
10141008 // to find the type &T of the content returned by the method;
1015- let ref_ty = method. ty . fn_ret ( ) ;
1016- let ref_ty = cx. tcx . no_late_bound_regions ( & ref_ty) . unwrap ( ) ;
1017- // callees always have all late-bound regions fully instantiated,
1009+ let ref_ty = method. sig . output ( ) ;
10181010
10191011 // construct the complete expression `foo()` for the overloaded call,
10201012 // which will yield the &T type
0 commit comments