/// Invoked on any index expression that occurs. Checks that if this is a slice being indexed, the
/// lifetime of the pointer includes the deref expr.
Invoked on any index expression that occurs. Checks that if this is a slice being indexed, the
lifetime of the pointer includes the deref expr.
Invoked on any index expression that occurs . Checks that if this is a slice being indexed the lifetime of the pointer includes the deref expr .
fn constrain_index<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                             index_expr: &hir::Expr,
                             indexed_ty: Ty<'tcx>)
{
    debug!("constrain_index(index_expr=?, indexed_ty={}",
           rcx.fcx.infcx().ty_to_string(indexed_ty));
    let r_index_expr = ty::ReScope(rcx.tcx().region_maps.node_extent(index_expr.id));
    if let ty::TyRef(r_ptr, mt) = indexed_ty.sty {
        match mt.ty.sty {
            ty::TySlice(_) | ty::TyStr => {
                rcx.fcx.mk_subr(infer::IndexSlice(index_expr.span),
                                r_index_expr, *r_ptr);
            }
            _ => {}
        }
    }
}
fn constrain_index < ' a , ' tcx > ( rcx : & mut Rcx < ' a , ' tcx > , index_expr : & hir :: Expr , indexed_ty : Ty < ' tcx > ) { debug ! ( " " rcx fcx infcx ( ) ty_to_string ( indexed_ty ) ) ; let r_index_expr = ty :: ReScope ( rcx . tcx ( ) . region_maps . node_extent ( index_expr . id ) ) ; if let ty :: TyRef ( r_ptr , mt ) = indexed_ty . sty { match mt . ty . sty { ty :: TySlice ( _ ) | ty :: TyStr => { rcx . fcx . mk_subr ( infer :: IndexSlice ( index_expr . span ) , r_index_expr , * r_ptr ) ; } _ => { } } } }
Invoked on any index expression that occurs.
Invoked on any index expression that occurs .
rcx
&mut Rcx<'a, 'tcx>
index_expr
&hir::Expr
indexed_ty
Ty<'tcx>