diff options
Diffstat (limited to 'src/librustc_trans/trans/consts.rs')
| -rw-r--r-- | src/librustc_trans/trans/consts.rs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs index a3861e71d83..f9b14e1de4f 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/trans/consts.rs @@ -54,7 +54,7 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: &ast::Lit) _ => cx.sess().span_bug(lit.span, format!("integer literal has type {} (expected int \ or uint)", - ty_to_string(cx.tcx(), lit_int_ty))[]) + ty_to_string(cx.tcx(), lit_int_ty)).index(&FullRange)) } } ast::LitFloat(ref fs, t) => { @@ -74,7 +74,7 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: &ast::Lit) } ast::LitBool(b) => C_bool(cx, b), ast::LitStr(ref s, _) => C_str_slice(cx, (*s).clone()), - ast::LitBinary(ref data) => C_binary_slice(cx, data[]), + ast::LitBinary(ref data) => C_binary_slice(cx, data.index(&FullRange)), } } @@ -93,9 +93,9 @@ fn const_vec(cx: &CrateContext, e: &ast::Expr, .collect::<Vec<_>>(); // If the vector contains enums, an LLVM array won't work. let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) { - C_struct(cx, vs[], false) + C_struct(cx, vs.index(&FullRange), false) } else { - C_array(llunitty, vs[]) + C_array(llunitty, vs.index(&FullRange)) }; (v, llunitty) } @@ -149,13 +149,13 @@ fn const_deref<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, v: ValueRef, } _ => { cx.sess().bug(format!("unexpected dereferenceable type {}", - ty_to_string(cx.tcx(), t))[]) + ty_to_string(cx.tcx(), t)).index(&FullRange)) } } } None => { cx.sess().bug(format!("cannot dereference const of type {}", - ty_to_string(cx.tcx(), t))[]) + ty_to_string(cx.tcx(), t)).index(&FullRange)) } } } @@ -252,7 +252,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr) } _ => cx.sess().span_bug(e.span, format!("unimplemented type in const unsize: {}", - ty_to_string(cx.tcx(), ty))[]) + ty_to_string(cx.tcx(), ty)).index(&FullRange)) } } _ => { @@ -260,7 +260,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr) .span_bug(e.span, format!("unimplemented const \ autoref {}", - autoref)[]) + autoref).index(&FullRange)) } } } @@ -281,7 +281,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr) } cx.sess().bug(format!("const {} of type {} has size {} instead of {}", e.repr(cx.tcx()), ty_to_string(cx.tcx(), ety), - csize, tsize)[]); + csize, tsize).index(&FullRange)); } (llconst, ety_adjusted) } @@ -431,7 +431,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { _ => cx.sess().span_bug(base.span, format!("index-expr base must be a vector \ or string type, found {}", - ty_to_string(cx.tcx(), bt))[]) + ty_to_string(cx.tcx(), bt)).index(&FullRange)) }, ty::ty_rptr(_, mt) => match mt.ty.sty { ty::ty_vec(_, Some(u)) => { @@ -440,12 +440,12 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { _ => cx.sess().span_bug(base.span, format!("index-expr base must be a vector \ or string type, found {}", - ty_to_string(cx.tcx(), bt))[]) + ty_to_string(cx.tcx(), bt)).index(&FullRange)) }, _ => cx.sess().span_bug(base.span, format!("index-expr base must be a vector \ or string type, found {}", - ty_to_string(cx.tcx(), bt))[]) + ty_to_string(cx.tcx(), bt)).index(&FullRange)) }; let len = llvm::LLVMConstIntGetZExtValue(len) as u64; @@ -546,8 +546,8 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { ast::ExprTup(ref es) => { let ety = ty::expr_ty(cx.tcx(), e); let repr = adt::represent_type(cx, ety); - let vals = map_list(es[]); - adt::trans_const(cx, &*repr, 0, vals[]) + let vals = map_list(es.index(&FullRange)); + adt::trans_const(cx, &*repr, 0, vals.index(&FullRange)) } ast::ExprStruct(_, ref fs, ref base_opt) => { let ety = ty::expr_ty(cx.tcx(), e); @@ -578,7 +578,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { } } }).collect::<Vec<_>>(); - adt::trans_const(cx, &*repr, discr, cs[]) + adt::trans_const(cx, &*repr, discr, cs.index(&FullRange)) }) } ast::ExprVec(ref es) => { @@ -595,9 +595,9 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { }; let vs: Vec<_> = repeat(const_expr(cx, &**elem).0).take(n).collect(); if vs.iter().any(|vi| val_ty(*vi) != llunitty) { - C_struct(cx, vs[], false) + C_struct(cx, vs.index(&FullRange), false) } else { - C_array(llunitty, vs[]) + C_array(llunitty, vs.index(&FullRange)) } } ast::ExprPath(_) => { @@ -645,8 +645,8 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { Some(def::DefStruct(_)) => { let ety = ty::expr_ty(cx.tcx(), e); let repr = adt::represent_type(cx, ety); - let arg_vals = map_list(args[]); - adt::trans_const(cx, &*repr, 0, arg_vals[]) + let arg_vals = map_list(args.index(&FullRange)); + adt::trans_const(cx, &*repr, 0, arg_vals.index(&FullRange)) } Some(def::DefVariant(enum_did, variant_did, _)) => { let ety = ty::expr_ty(cx.tcx(), e); @@ -654,11 +654,11 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef { let vinfo = ty::enum_variant_with_id(cx.tcx(), enum_did, variant_did); - let arg_vals = map_list(args[]); + let arg_vals = map_list(args.index(&FullRange)); adt::trans_const(cx, &*repr, vinfo.disr_val, - arg_vals[]) + arg_vals.index(&FullRange)) } _ => cx.sess().span_bug(e.span, "expected a struct or variant def") } |
