@@ -936,37 +936,55 @@ fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
936936fn constrain_autoderefs < ' a , ' tcx > ( rcx : & mut Rcx < ' a , ' tcx > ,
937937 deref_expr : & ast:: Expr ,
938938 derefs : uint ,
939- mut derefd_ty : Ty < ' tcx > ) {
939+ mut derefd_ty : Ty < ' tcx > )
940+ {
941+ debug ! ( "constrain_autoderefs(deref_expr={}, derefs={}, derefd_ty={})" ,
942+ deref_expr. repr( rcx. tcx( ) ) ,
943+ derefs,
944+ derefd_ty. repr( rcx. tcx( ) ) ) ;
945+
940946 let r_deref_expr = ty:: ReScope ( CodeExtent :: from_node_id ( deref_expr. id ) ) ;
941947 for i in range ( 0 u, derefs) {
942- debug ! ( "constrain_autoderefs(deref_expr=?, derefd_ty={}, derefs={}/{}" ,
943- rcx. fcx. infcx( ) . ty_to_string( derefd_ty) ,
944- i, derefs) ;
945-
946948 let method_call = MethodCall :: autoderef ( deref_expr. id , i) ;
949+ debug ! ( "constrain_autoderefs: method_call={:?} (of {:?} total)" , method_call, derefs) ;
950+
947951 derefd_ty = match rcx. fcx . inh . method_map . borrow ( ) . get ( & method_call) {
948952 Some ( method) => {
953+ debug ! ( "constrain_autoderefs: #{} is overloaded, method={}" ,
954+ i, method. repr( rcx. tcx( ) ) ) ;
955+
949956 // Treat overloaded autoderefs as if an AutoRef adjustment
950957 // was applied on the base type, as that is always the case.
951958 let fn_sig = ty:: ty_fn_sig ( method. ty ) ;
952- let self_ty = fn_sig. 0 . inputs [ 0 ] ;
959+ let fn_sig = // late-bound regions should have been instantiated
960+ ty:: assert_no_late_bound_regions ( rcx. tcx ( ) , fn_sig) ;
961+ let self_ty = fn_sig. inputs [ 0 ] ;
953962 let ( m, r) = match self_ty. sty {
954963 ty:: ty_rptr( r, ref m) => ( m. mutbl , r) ,
955- _ => rcx. tcx ( ) . sess . span_bug ( deref_expr. span ,
964+ _ => {
965+ rcx. tcx ( ) . sess . span_bug (
966+ deref_expr. span ,
956967 & format ! ( "bad overloaded deref type {}" ,
957- method. ty. repr( rcx. tcx( ) ) ) [ ] )
968+ method. ty. repr( rcx. tcx( ) ) ) [ ] )
969+ }
958970 } ;
971+
972+ debug ! ( "constrain_autoderefs: receiver r={:?} m={:?}" ,
973+ r. repr( rcx. tcx( ) ) , m) ;
974+
959975 {
960976 let mc = mc:: MemCategorizationContext :: new ( rcx. fcx ) ;
961977 let self_cmt = ignore_err ! ( mc. cat_expr_autoderefd( deref_expr, i) ) ;
978+ debug ! ( "constrain_autoderefs: self_cmt={:?}" ,
979+ self_cmt. repr( rcx. tcx( ) ) ) ;
962980 link_region ( rcx, deref_expr. span , * r,
963981 ty:: BorrowKind :: from_mutbl ( m) , self_cmt) ;
964982 }
965983
966984 // Specialized version of constrain_call.
967985 type_must_outlive ( rcx, infer:: CallRcvr ( deref_expr. span ) ,
968986 self_ty, r_deref_expr) ;
969- match fn_sig. 0 . output {
987+ match fn_sig. output {
970988 ty:: FnConverging ( return_type) => {
971989 type_must_outlive ( rcx, infer:: CallReturn ( deref_expr. span ) ,
972990 return_type, r_deref_expr) ;
@@ -1185,7 +1203,7 @@ fn link_region_from_node_type<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
11851203 id : ast:: NodeId ,
11861204 mutbl : ast:: Mutability ,
11871205 cmt_borrowed : mc:: cmt < ' tcx > ) {
1188- debug ! ( "link_region_from_node_type(id={}, mutbl={}, cmt_borrowed={})" ,
1206+ debug ! ( "link_region_from_node_type(id={:? }, mutbl={:? }, cmt_borrowed={})" ,
11891207 id, mutbl, cmt_borrowed. repr( rcx. tcx( ) ) ) ;
11901208
11911209 let rptr_ty = rcx. resolve_node_type ( id) ;
0 commit comments