diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index fcb0e3136a7..640bd58156c 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -234,7 +234,7 @@ pub fn write_type(ecx: &EncodeContext, pub fn write_vstore(ecx: &EncodeContext, ebml_w: &mut Encoder, - vstore: ty::vstore) { + vstore: ty::Vstore) { let ty_str_ctxt = &tyencode::ctxt { diag: ecx.diag, ds: def_to_str, diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 599a1dad33d..61a686cea6e 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -145,19 +145,19 @@ fn parse_sigil(st: &mut PState) -> ast::Sigil { } } -fn parse_vstore(st: &mut PState, conv: conv_did) -> ty::vstore { +fn parse_vstore(st: &mut PState, conv: conv_did) -> ty::Vstore { assert_eq!(next(st), '/'); let c = peek(st); if '0' <= c && c <= '9' { let n = parse_uint(st); assert_eq!(next(st), '|'); - return ty::vstore_fixed(n); + return ty::VstoreFixed(n); } match next(st) { - '~' => ty::vstore_uniq, - '&' => ty::vstore_slice(parse_region(st, conv)), + '~' => ty::VstoreUniq, + '&' => ty::VstoreSlice(parse_region(st, conv)), c => st.tcx.sess.bug(format!("parse_vstore(): bad input '{}'", c)) } } diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 384c6907aed..0fb55f5e160 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -204,12 +204,12 @@ fn enc_bound_region(w: &mut MemWriter, cx: &ctxt, br: ty::BoundRegion) { } } -pub fn enc_vstore(w: &mut MemWriter, cx: &ctxt, v: ty::vstore) { +pub fn enc_vstore(w: &mut MemWriter, cx: &ctxt, v: ty::Vstore) { mywrite!(w, "/"); match v { - ty::vstore_fixed(u) => mywrite!(w, "{}|", u), - ty::vstore_uniq => mywrite!(w, "~"), - ty::vstore_slice(r) => { + ty::VstoreFixed(u) => mywrite!(w, "{}|", u), + ty::VstoreUniq => mywrite!(w, "~"), + ty::VstoreSlice(r) => { mywrite!(w, "&"); enc_region(w, cx, r); } diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 3529f2c57c0..d2fe70e08d7 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -823,7 +823,7 @@ impl<'a> get_ty_str_ctxt for e::EncodeContext<'a> { trait ebml_writer_helpers { fn emit_ty(&mut self, ecx: &e::EncodeContext, ty: ty::t); - fn emit_vstore(&mut self, ecx: &e::EncodeContext, vstore: ty::vstore); + fn emit_vstore(&mut self, ecx: &e::EncodeContext, vstore: ty::Vstore); fn emit_tys(&mut self, ecx: &e::EncodeContext, tys: &[ty::t]); fn emit_type_param_def(&mut self, ecx: &e::EncodeContext, @@ -840,7 +840,7 @@ impl<'a> ebml_writer_helpers for Encoder<'a> { self.emit_opaque(|this| Ok(e::write_type(ecx, this, ty))); } - fn emit_vstore(&mut self, ecx: &e::EncodeContext, vstore: ty::vstore) { + fn emit_vstore(&mut self, ecx: &e::EncodeContext, vstore: ty::Vstore) { self.emit_opaque(|this| Ok(e::write_vstore(ecx, this, vstore))); } diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index e18f8f530ee..f59b2efd1cd 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -279,7 +279,7 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful { } not_useful } - ty::ty_vec(_, ty::vstore_fixed(n)) => { + ty::ty_vec(_, ty::VstoreFixed(n)) => { is_useful_specialized(cx, m, v, vec(n), n, left_ty) } ty::ty_vec(..) => { @@ -441,7 +441,7 @@ fn missing_ctor(cx: &MatchCheckCtxt, else if true_found { Some(val(const_bool(false))) } else { Some(val(const_bool(true))) } } - ty::ty_vec(_, ty::vstore_fixed(n)) => { + ty::ty_vec(_, ty::VstoreFixed(n)) => { let mut missing = true; let mut wrong = false; for r in m.iter() { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 22182d7e87e..faa82463ef2 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -917,8 +917,8 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) { ty::ty_box(_) => { n_box += 1; } - ty::ty_uniq(_) | ty::ty_str(ty::vstore_uniq) | - ty::ty_vec(_, ty::vstore_uniq) | + ty::ty_uniq(_) | ty::ty_str(ty::VstoreUniq) | + ty::ty_vec(_, ty::VstoreUniq) | ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) => { n_uniq += 1; } @@ -1158,7 +1158,7 @@ fn check_unused_result(cx: &Context, s: &ast::Stmt) { fn check_deprecated_owned_vector(cx: &Context, e: &ast::Expr) { let t = ty::expr_ty(cx.tcx, e); match ty::get(t).sty { - ty::ty_vec(_, ty::vstore_uniq) => { + ty::ty_vec(_, ty::VstoreUniq) => { cx.span_lint(DeprecatedOwnedVector, e.span, "use of deprecated `~[]` vector; replaced by `std::vec::Vec`") } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index e376e66ca6f..97e9f6fd41d 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -170,14 +170,14 @@ pub fn opt_deref_kind(t: ty::t) -> Option { match ty::get(t).sty { ty::ty_uniq(_) | ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) | - ty::ty_vec(_, ty::vstore_uniq) | - ty::ty_str(ty::vstore_uniq) | + ty::ty_vec(_, ty::VstoreUniq) | + ty::ty_str(ty::VstoreUniq) | ty::ty_closure(~ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => { Some(deref_ptr(OwnedPtr)) } ty::ty_rptr(r, mt) | - ty::ty_vec(mt, ty::vstore_slice(r)) => { + ty::ty_vec(mt, ty::VstoreSlice(r)) => { let kind = ty::BorrowKind::from_mutbl(mt.mutbl); Some(deref_ptr(BorrowedPtr(kind, r))) } @@ -187,7 +187,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option { Some(deref_ptr(BorrowedPtr(kind, r))) } - ty::ty_str(ty::vstore_slice(r)) | + ty::ty_str(ty::VstoreSlice(r)) | ty::ty_closure(~ty::ClosureTy {sigil: ast::BorrowedSigil, region: r, ..}) => { Some(deref_ptr(BorrowedPtr(ty::ImmBorrow, r))) @@ -206,8 +206,8 @@ pub fn opt_deref_kind(t: ty::t) -> Option { Some(deref_interior(InteriorField(PositionalField(0)))) } - ty::ty_vec(_, ty::vstore_fixed(_)) | - ty::ty_str(ty::vstore_fixed(_)) => { + ty::ty_vec(_, ty::VstoreFixed(_)) | + ty::ty_str(ty::VstoreFixed(_)) => { Some(deref_interior(InteriorElement(element_kind(t)))) } @@ -882,7 +882,7 @@ impl MemCategorizationContext { */ match ty::get(slice_ty).sty { - ty::ty_vec(slice_mt, ty::vstore_slice(slice_r)) => { + ty::ty_vec(slice_mt, ty::VstoreSlice(slice_r)) => { (slice_mt.mutbl, slice_r) } diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 49163ce9699..55aa517ad66 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -1111,7 +1111,7 @@ fn extract_vec_elems<'a>( let slice_len = Sub(bcx, len, slice_len_offset); let slice_ty = ty::mk_vec(bcx.tcx(), ty::mt {ty: vt.unit_ty, mutbl: ast::MutImmutable}, - ty::vstore_slice(ty::ReStatic) + ty::VstoreSlice(ty::ReStatic) ); let scratch = rvalue_scratch_datum(bcx, slice_ty, ""); Store(bcx, slice_begin, @@ -1319,7 +1319,7 @@ fn compare_values<'a>( } match ty::get(rhs_t).sty { - ty::ty_str(ty::vstore_uniq) => { + ty::ty_str(ty::VstoreUniq) => { let scratch_lhs = alloca(cx, val_ty(lhs), "__lhs"); Store(cx, lhs, scratch_lhs); let scratch_rhs = alloca(cx, val_ty(rhs), "__rhs"); diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 69155f3df8e..0e6b8df0ef8 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -188,7 +188,7 @@ fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv, // FIXME #6750 ~Trait cannot be directly marked as // noalias because the actual object pointer is nested. ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) | - ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) => { + ty::ty_vec(_, ty::VstoreUniq) | ty::ty_str(ty::VstoreUniq) => { unsafe { llvm::LLVMAddReturnAttribute(llfn, lib::llvm::NoAliasAttribute as c_uint); } @@ -259,7 +259,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool, // FIXME #6750 ~Trait cannot be directly marked as // noalias because the actual object pointer is nested. ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) | - ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) | + ty::ty_vec(_, ty::VstoreUniq) | ty::ty_str(ty::VstoreUniq) | ty::ty_closure(~ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => { unsafe { llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint); @@ -657,8 +657,8 @@ pub fn iter_structural_ty<'r, } }) } - ty::ty_str(ty::vstore_fixed(_)) | - ty::ty_vec(_, ty::vstore_fixed(_)) => { + ty::ty_str(ty::VstoreFixed(_)) | + ty::ty_vec(_, ty::VstoreFixed(_)) => { let (base, len) = tvec::get_base_and_byte_len(cx, av, t); let unit_ty = ty::sequence_element_type(cx.tcx(), t); cx = tvec::iter_vec_raw(cx, base, unit_ty, len, f); diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 13fcaa486f1..372bba6d51c 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -654,7 +654,7 @@ pub fn trans_call_inner<'a>( match ty::get(ret_ty).sty { // `~` pointer return values never alias because ownership // is transferred - ty::ty_uniq(..) | ty::ty_vec(_, ty::vstore_uniq) => { + ty::ty_uniq(..) | ty::ty_vec(_, ty::VstoreUniq) => { attrs.push((0, NoAliasAttribute)); } _ => {} diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index d03b13b1b8f..b8f6d445c36 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -712,7 +712,7 @@ pub fn mono_data_classify(t: ty::t) -> MonoDataClass { match ty::get(t).sty { ty::ty_float(_) => MonoFloat, ty::ty_rptr(..) | ty::ty_uniq(..) | ty::ty_box(..) | - ty::ty_str(ty::vstore_uniq) | ty::ty_vec(_, ty::vstore_uniq) | + ty::ty_str(ty::VstoreUniq) | ty::ty_vec(_, ty::VstoreUniq) | ty::ty_bare_fn(..) => MonoNonNull, // Is that everything? Would closures or slices qualify? _ => MonoBits diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index cb16998f736..413b723589c 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -246,7 +246,7 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef assert_eq!(abi::slice_elt_base, 0); assert_eq!(abi::slice_elt_len, 1); match ty::get(ty).sty { - ty::ty_vec(_, ty::vstore_fixed(len)) => { + ty::ty_vec(_, ty::VstoreFixed(len)) => { llconst = C_struct(cx, [ llptr, C_uint(cx, len) @@ -436,10 +436,10 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr, let (arr, len) = match ty::get(bt).sty { ty::ty_vec(_, vstore) | ty::ty_str(vstore) => match vstore { - ty::vstore_fixed(u) => + ty::VstoreFixed(u) => (bv, C_uint(cx, u)), - ty::vstore_slice(_) => { + ty::VstoreSlice(_) => { let e1 = const_get_elt(cx, bv, [0]); (const_deref_ptr(cx, e1), const_get_elt(cx, bv, [1])) }, diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 8a7f30ee2c4..bfacc62cfe5 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -2128,14 +2128,14 @@ fn type_metadata(cx: &CrateContext, ty::ty_str(ref vstore) => { let i8_t = ty::mk_i8(); match *vstore { - ty::vstore_fixed(len) => { + ty::VstoreFixed(len) => { fixed_vec_metadata(cx, i8_t, len, usage_site_span) }, - ty::vstore_uniq => { + ty::VstoreUniq => { let vec_metadata = vec_metadata(cx, i8_t, usage_site_span); pointer_type_metadata(cx, t, vec_metadata) } - ty::vstore_slice(_region) => { + ty::VstoreSlice(_region) => { vec_slice_metadata(cx, t, i8_t, usage_site_span) } } @@ -2148,14 +2148,14 @@ fn type_metadata(cx: &CrateContext, }, ty::ty_vec(ref mt, ref vstore) => { match *vstore { - ty::vstore_fixed(len) => { + ty::VstoreFixed(len) => { fixed_vec_metadata(cx, mt.ty, len, usage_site_span) } - ty::vstore_uniq => { + ty::VstoreUniq => { let vec_metadata = vec_metadata(cx, mt.ty, usage_site_span); pointer_type_metadata(cx, t, vec_metadata) } - ty::vstore_slice(_) => { + ty::VstoreSlice(_) => { vec_slice_metadata(cx, t, mt.ty, usage_site_span) } } diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index c12c8c106cb..e61c4b05dc1 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -265,7 +265,7 @@ fn apply_adjustments<'a>(bcx: &'a Block<'a>, // real one, but it will have the same runtime representation let slice_ty = ty::mk_vec(tcx, ty::mt { ty: unit_ty, mutbl: ast::MutImmutable }, - ty::vstore_slice(ty::ReStatic)); + ty::VstoreSlice(ty::ReStatic)); let scratch = rvalue_scratch_datum(bcx, slice_ty, "__adjust"); Store(bcx, base, GEPi(bcx, scratch.val, [0u, abi::slice_elt_base])); diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index 5aee8b64848..5433a4c43b9 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -93,7 +93,7 @@ fn get_drop_glue_type(ccx: &CrateContext, t: ty::t) -> ty::t { } } - ty::ty_vec(mt, ty::vstore_uniq) if !ty::type_needs_drop(tcx, mt.ty) => + ty::ty_vec(mt, ty::VstoreUniq) if !ty::type_needs_drop(tcx, mt.ty) => ty::mk_uniq(tcx, ty::mk_i8()), _ => t @@ -289,7 +289,7 @@ fn make_drop_glue<'a>(bcx: &'a Block<'a>, v0: ValueRef, t: ty::t) -> &'a Block<' trans_exchange_free(bcx, llbox) }) } - ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) => { + ty::ty_vec(_, ty::VstoreUniq) | ty::ty_str(ty::VstoreUniq) => { let llbox = Load(bcx, v0); let not_null = IsNotNull(bcx, llbox); with_cond(bcx, not_null, |bcx| { diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index 0cfa4f5f6d5..cc2a946fde3 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -54,7 +54,7 @@ impl<'a> Reflector<'a> { // We're careful to not use first class aggregates here because that // will kick us off fast isel. (Issue #4352.) let bcx = self.bcx; - let str_vstore = ty::vstore_slice(ty::ReStatic); + let str_vstore = ty::VstoreSlice(ty::ReStatic); let str_ty = ty::mk_str(bcx.tcx(), str_vstore); let scratch = rvalue_scratch_datum(bcx, str_ty, ""); let len = C_uint(bcx.ccx(), s.get().len()); @@ -123,15 +123,15 @@ impl<'a> Reflector<'a> { pub fn vstore_name_and_extra(&mut self, t: ty::t, - vstore: ty::vstore) + vstore: ty::Vstore) -> (~str, Vec ) { match vstore { - ty::vstore_fixed(n) => { + ty::VstoreFixed(n) => { let extra = (vec!(self.c_uint(n))).append(self.c_size_and_align(t).as_slice()); (~"fixed", extra) } - ty::vstore_slice(_) => (~"slice", Vec::new()), - ty::vstore_uniq => (~"uniq", Vec::new()), + ty::VstoreSlice(_) => (~"slice", Vec::new()), + ty::VstoreUniq => (~"uniq", Vec::new()), } } diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 73370357a92..8d8511b883e 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -165,7 +165,7 @@ pub fn trans_slice_vstore<'a>( let fixed_ty = ty::mk_vec(bcx.tcx(), ty::mt {ty: vt.unit_ty, mutbl: ast::MutMutable}, - ty::vstore_fixed(count)); + ty::VstoreFixed(count)); let llfixed_ty = type_of::type_of(bcx.ccx(), fixed_ty).ptr_to(); let llfixed_casted = BitCast(bcx, llfixed, llfixed_ty); let cleanup_scope = cleanup::temporary_scope(bcx.tcx(), content_expr.id); @@ -244,7 +244,7 @@ pub fn trans_uniq_vstore<'a>(bcx: &'a Block<'a>, let llptrval = C_cstr(ccx, (*s).clone(), false); let llptrval = PointerCast(bcx, llptrval, Type::i8p(ccx)); let llsizeval = C_uint(ccx, s.get().len()); - let typ = ty::mk_str(bcx.tcx(), ty::vstore_uniq); + let typ = ty::mk_str(bcx.tcx(), ty::VstoreUniq); let lldestval = rvalue_scratch_datum(bcx, typ, ""); @@ -461,23 +461,23 @@ pub fn get_base_and_byte_len(bcx: &Block, let vstore = match ty::get(vec_ty).sty { ty::ty_str(vst) | ty::ty_vec(_, vst) => vst, - _ => ty::vstore_uniq + _ => ty::VstoreUniq }; match vstore { - ty::vstore_fixed(n) => { + ty::VstoreFixed(n) => { let base = GEPi(bcx, llval, [0u, 0u]); let len = Mul(bcx, C_uint(ccx, n), vt.llunit_size); (base, len) } - ty::vstore_slice(_) => { + ty::VstoreSlice(_) => { assert!(!type_is_immediate(bcx.ccx(), vec_ty)); let base = Load(bcx, GEPi(bcx, llval, [0u, abi::slice_elt_base])); let count = Load(bcx, GEPi(bcx, llval, [0u, abi::slice_elt_len])); let len = Mul(bcx, count, vt.llunit_size); (base, len) } - ty::vstore_uniq => { + ty::VstoreUniq => { assert!(type_is_immediate(bcx.ccx(), vec_ty)); let body = Load(bcx, llval); (get_dataptr(bcx, body), get_fill(bcx, body)) @@ -502,21 +502,21 @@ pub fn get_base_and_len(bcx: &Block, let vstore = match ty::get(vec_ty).sty { ty::ty_str(vst) | ty::ty_vec(_, vst) => vst, - _ => ty::vstore_uniq + _ => ty::VstoreUniq }; match vstore { - ty::vstore_fixed(n) => { + ty::VstoreFixed(n) => { let base = GEPi(bcx, llval, [0u, 0u]); (base, C_uint(ccx, n)) } - ty::vstore_slice(_) => { + ty::VstoreSlice(_) => { assert!(!type_is_immediate(bcx.ccx(), vec_ty)); let base = Load(bcx, GEPi(bcx, llval, [0u, abi::slice_elt_base])); let count = Load(bcx, GEPi(bcx, llval, [0u, abi::slice_elt_len])); (base, count) } - ty::vstore_uniq => { + ty::VstoreUniq => { assert!(type_is_immediate(bcx.ccx(), vec_ty)); let body = Load(bcx, llval); (get_dataptr(bcx, body), UDiv(bcx, get_fill(bcx, body), vt.llunit_size)) diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs index 5a4cb1a33ef..1861c414cca 100644 --- a/src/librustc/middle/trans/type_of.rs +++ b/src/librustc/middle/trans/type_of.rs @@ -116,15 +116,15 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type { ty::ty_uint(t) => Type::uint_from_ty(cx, t), ty::ty_float(t) => Type::float_from_ty(cx, t), - ty::ty_str(ty::vstore_uniq) | - ty::ty_vec(_, ty::vstore_uniq) | + ty::ty_str(ty::VstoreUniq) | + ty::ty_vec(_, ty::VstoreUniq) | ty::ty_box(..) | ty::ty_uniq(..) | ty::ty_ptr(..) | ty::ty_rptr(..) => Type::i8p(cx), - ty::ty_str(ty::vstore_slice(..)) | - ty::ty_vec(_, ty::vstore_slice(..)) => { + ty::ty_str(ty::VstoreSlice(..)) | + ty::ty_vec(_, ty::VstoreSlice(..)) => { Type::struct_(cx, [Type::i8p(cx), Type::i8p(cx)], false) } @@ -132,8 +132,8 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type { ty::ty_closure(..) => Type::struct_(cx, [Type::i8p(cx), Type::i8p(cx)], false), ty::ty_trait(..) => Type::opaque_trait(cx), - ty::ty_str(ty::vstore_fixed(size)) => Type::array(&Type::i8(cx), size as u64), - ty::ty_vec(mt, ty::vstore_fixed(size)) => { + ty::ty_str(ty::VstoreFixed(size)) => Type::array(&Type::i8(cx), size as u64), + ty::ty_vec(mt, ty::VstoreFixed(size)) => { Type::array(&sizing_type_of(cx, mt.ty), size as u64) } @@ -199,7 +199,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type { ty::ty_int(t) => Type::int_from_ty(cx, t), ty::ty_uint(t) => Type::uint_from_ty(cx, t), ty::ty_float(t) => Type::float_from_ty(cx, t), - ty::ty_str(ty::vstore_uniq) => { + ty::ty_str(ty::VstoreUniq) => { Type::vec(cx, &Type::i8(cx)).ptr_to() } ty::ty_enum(did, ref substs) => { @@ -217,28 +217,28 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type { ty::ty_uniq(typ) => { type_of(cx, typ).ptr_to() } - ty::ty_vec(ref mt, ty::vstore_uniq) => { + ty::ty_vec(ref mt, ty::VstoreUniq) => { Type::vec(cx, &type_of(cx, mt.ty)).ptr_to() } ty::ty_ptr(ref mt) => type_of(cx, mt.ty).ptr_to(), ty::ty_rptr(_, ref mt) => type_of(cx, mt.ty).ptr_to(), - ty::ty_vec(ref mt, ty::vstore_slice(_)) => { + ty::ty_vec(ref mt, ty::VstoreSlice(_)) => { let p_ty = type_of(cx, mt.ty).ptr_to(); let u_ty = Type::uint_from_ty(cx, ast::TyU); Type::struct_(cx, [p_ty, u_ty], false) } - ty::ty_str(ty::vstore_slice(_)) => { + ty::ty_str(ty::VstoreSlice(_)) => { // This means we get a nicer name in the output cx.tn.find_type("str_slice").unwrap() } - ty::ty_str(ty::vstore_fixed(n)) => { + ty::ty_str(ty::VstoreFixed(n)) => { Type::array(&Type::i8(cx), (n + 1u) as u64) } - ty::ty_vec(ref mt, ty::vstore_fixed(n)) => { + ty::ty_vec(ref mt, ty::VstoreFixed(n)) => { Type::array(&type_of(cx, mt.ty), n as u64) } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index a250c6c298b..729cff5167c 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -130,10 +130,10 @@ pub struct mt { } #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)] -pub enum vstore { - vstore_fixed(uint), - vstore_uniq, - vstore_slice(Region) +pub enum Vstore { + VstoreFixed(uint), + VstoreUniq, + VstoreSlice(Region) } #[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)] @@ -729,11 +729,11 @@ pub enum sty { ty_int(ast::IntTy), ty_uint(ast::UintTy), ty_float(ast::FloatTy), - ty_str(vstore), + ty_str(Vstore), ty_enum(DefId, substs), ty_box(t), ty_uniq(t), - ty_vec(mt, vstore), + ty_vec(mt, Vstore), ty_ptr(mt), ty_rptr(Region, mt), ty_bare_fn(BareFnTy), @@ -811,7 +811,7 @@ pub enum type_err { terr_regions_no_overlap(Region, Region), terr_regions_insufficiently_polymorphic(BoundRegion, Region), terr_regions_overly_polymorphic(BoundRegion, Region), - terr_vstores_differ(terr_vstore_kind, expected_found), + terr_vstores_differ(terr_vstore_kind, expected_found), terr_trait_stores_differ(terr_vstore_kind, expected_found), terr_in_field(@type_err, ast::Ident), terr_sorts(expected_found), @@ -1177,10 +1177,10 @@ pub fn mk_t(cx: &ctxt, st: sty) -> t { return f; } match &st { - &ty_str(vstore_slice(r)) => { + &ty_str(VstoreSlice(r)) => { flags |= rflags(r); } - &ty_vec(ref mt, vstore_slice(r)) => { + &ty_vec(ref mt, VstoreSlice(r)) => { flags |= rflags(r); flags |= get(mt.ty).flags; } @@ -1340,7 +1340,7 @@ pub fn mk_mach_float(tm: ast::FloatTy) -> t { #[inline] pub fn mk_char() -> t { mk_prim_t(&primitives::TY_CHAR) } -pub fn mk_str(cx: &ctxt, t: vstore) -> t { +pub fn mk_str(cx: &ctxt, t: Vstore) -> t { mk_t(cx, ty_str(t)) } @@ -1376,7 +1376,7 @@ pub fn mk_nil_ptr(cx: &ctxt) -> t { mk_ptr(cx, mt {ty: mk_nil(), mutbl: ast::MutImmutable}) } -pub fn mk_vec(cx: &ctxt, tm: mt, t: vstore) -> t { +pub fn mk_vec(cx: &ctxt, tm: mt, t: Vstore) -> t { mk_t(cx, ty_vec(tm, t)) } @@ -1597,8 +1597,8 @@ pub fn type_is_self(ty: t) -> bool { pub fn type_is_structural(ty: t) -> bool { match get(ty).sty { ty_struct(..) | ty_tup(_) | ty_enum(..) | ty_closure(_) | ty_trait(..) | - ty_vec(_, vstore_fixed(_)) | ty_str(vstore_fixed(_)) | - ty_vec(_, vstore_slice(_)) | ty_str(vstore_slice(_)) + ty_vec(_, VstoreFixed(_)) | ty_str(VstoreFixed(_)) | + ty_vec(_, VstoreSlice(_)) | ty_str(VstoreSlice(_)) => true, _ => false } @@ -1662,7 +1662,7 @@ pub fn type_is_unsafe_ptr(ty: t) -> bool { pub fn type_is_unique(ty: t) -> bool { match get(ty).sty { - ty_uniq(_) | ty_vec(_, vstore_uniq) | ty_str(vstore_uniq) => true, + ty_uniq(_) | ty_vec(_, VstoreUniq) | ty_str(VstoreUniq) => true, _ => false } } @@ -1736,8 +1736,8 @@ fn type_needs_unwind_cleanup_(cx: &ctxt, ty: t, !needs_unwind_cleanup } ty_uniq(_) | - ty_str(vstore_uniq) | - ty_vec(_, vstore_uniq) => { + ty_str(VstoreUniq) | + ty_vec(_, VstoreUniq) => { // Once we're inside a box, the annihilator will find // it and destroy it. if !encountered_box { @@ -2050,7 +2050,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { TC::None } - ty_str(vstore_uniq) => { + ty_str(VstoreUniq) => { TC::OwnsOwned } @@ -2079,24 +2079,24 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { borrowed_contents(r, mt.mutbl)) } - ty_vec(mt, vstore_uniq) => { + ty_vec(mt, VstoreUniq) => { tc_mt(cx, mt, cache).owned_pointer() } - ty_vec(ref mt, vstore_slice(r)) => { + ty_vec(ref mt, VstoreSlice(r)) => { tc_ty(cx, mt.ty, cache).reference( borrowed_contents(r, mt.mutbl)) } - ty_vec(mt, vstore_fixed(_)) => { + ty_vec(mt, VstoreFixed(_)) => { tc_mt(cx, mt, cache) } - ty_str(vstore_slice(r)) => { + ty_str(VstoreSlice(r)) => { borrowed_contents(r, ast::MutImmutable) } - ty_str(vstore_fixed(_)) => { + ty_str(VstoreFixed(_)) => { TC::None } @@ -2328,8 +2328,8 @@ pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool { // fixed length vectors need special treatment compared to // normal vectors, since they don't necessarily have the // possibilty to have length zero. - ty_vec(_, vstore_fixed(0)) => false, // don't need no contents - ty_vec(mt, vstore_fixed(_)) => type_requires(cx, seen, r_ty, mt.ty), + ty_vec(_, VstoreFixed(0)) => false, // don't need no contents + ty_vec(mt, VstoreFixed(_)) => type_requires(cx, seen, r_ty, mt.ty), ty_nil | ty_bot | @@ -2466,7 +2466,7 @@ pub fn is_type_representable(cx: &ctxt, ty: t) -> Representability { } // Fixed-length vectors. // FIXME(#11924) Behavior undecided for zero-length vectors. - ty_vec(mt, vstore_fixed(_)) => { + ty_vec(mt, VstoreFixed(_)) => { type_structurally_recursive(cx, seen, mt.ty) } @@ -2728,8 +2728,8 @@ pub fn ty_region(tcx: &ctxt, ty: t) -> Region { match get(ty).sty { ty_rptr(r, _) => r, - ty_vec(_, vstore_slice(r)) => r, - ty_str(vstore_slice(r)) => r, + ty_vec(_, VstoreSlice(r)) => r, + ty_str(VstoreSlice(r)) => r, ref s => { tcx.sess.span_bug( span, @@ -2946,11 +2946,11 @@ pub fn adjust_ty(cx: &ctxt, ty: ty::t) -> ty::t { match get(ty).sty { ty_vec(mt, _) => { - ty::mk_vec(cx, mt {ty: mt.ty, mutbl: m}, vstore_slice(r)) + ty::mk_vec(cx, mt {ty: mt.ty, mutbl: m}, VstoreSlice(r)) } ty_str(_) => { - ty::mk_str(cx, vstore_slice(r)) + ty::mk_str(cx, VstoreSlice(r)) } ref s => { @@ -4201,10 +4201,10 @@ pub fn normalize_ty(cx: &ctxt, t: t) -> t { return t_norm; } - fn fold_vstore(&mut self, vstore: vstore) -> vstore { + fn fold_vstore(&mut self, vstore: Vstore) -> Vstore { match vstore { - vstore_fixed(..) | vstore_uniq => vstore, - vstore_slice(_) => vstore_slice(ReStatic) + VstoreFixed(..) | VstoreUniq => vstore, + VstoreSlice(_) => VstoreSlice(ReStatic) } } @@ -4595,11 +4595,11 @@ pub fn hash_crate_independent(tcx: &ctxt, t: t, svh: &Svh) -> u64 { } } }; - let vstore = |state: &mut sip::SipState, v: vstore| { + let vstore = |state: &mut sip::SipState, v: Vstore| { match v { - vstore_fixed(_) => 0u8.hash(state), - vstore_uniq => 1u8.hash(state), - vstore_slice(r) => { + VstoreFixed(_) => 0u8.hash(state), + VstoreUniq => 1u8.hash(state), + VstoreSlice(r) => { 2u8.hash(state); region(state, r); } diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs index 8b14741f881..0564a492d9d 100644 --- a/src/librustc/middle/ty_fold.rs +++ b/src/librustc/middle/ty_fold.rs @@ -69,7 +69,7 @@ pub trait TypeFolder { r } - fn fold_vstore(&mut self, vstore: ty::vstore) -> ty::vstore { + fn fold_vstore(&mut self, vstore: ty::Vstore) -> ty::Vstore { super_fold_vstore(self, vstore) } @@ -194,12 +194,12 @@ pub fn super_fold_sty(this: &mut T, } pub fn super_fold_vstore(this: &mut T, - vstore: ty::vstore) - -> ty::vstore { + vstore: ty::Vstore) + -> ty::Vstore { match vstore { - ty::vstore_fixed(i) => ty::vstore_fixed(i), - ty::vstore_uniq => ty::vstore_uniq, - ty::vstore_slice(r) => ty::vstore_slice(this.fold_region(r)), + ty::VstoreFixed(i) => ty::VstoreFixed(i), + ty::VstoreUniq => ty::VstoreUniq, + ty::VstoreSlice(r) => ty::VstoreSlice(this.fold_region(r)), } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 82be7836168..317a67d262e 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -356,7 +356,7 @@ pub fn ast_ty_to_prim_ty(tcx: &ty::ctxt, ast_ty: &ast::Ty) -> Option { tcx.sess.span_err(ast_ty.span, "bare `str` is not a type"); // return /something/ so they can at least get more errors - Some(ty::mk_str(tcx, ty::vstore_uniq)) + Some(ty::mk_str(tcx, ty::VstoreUniq)) } } } @@ -386,15 +386,15 @@ pub fn ast_ty_to_ty( enum PointerTy { Box, - VStore(ty::vstore) + VStore(ty::Vstore) } impl PointerTy { - fn expect_vstore(&self, tcx: &ty::ctxt, span: Span, ty: &str) -> ty::vstore { + fn expect_vstore(&self, tcx: &ty::ctxt, span: Span, ty: &str) -> ty::Vstore { match *self { Box => { tcx.sess.span_err(span, format!("managed {} are not supported", ty)); // everything can be ~, so this is a worth substitute - ty::vstore_uniq + ty::VstoreUniq } VStore(vst) => vst } @@ -440,8 +440,8 @@ pub fn ast_ty_to_ty( let result = ast_path_to_trait_ref( this, rscope, trait_def_id, None, path); let trait_store = match ptr_ty { - VStore(ty::vstore_uniq) => ty::UniqTraitStore, - VStore(ty::vstore_slice(r)) => { + VStore(ty::VstoreUniq) => ty::UniqTraitStore, + VStore(ty::VstoreSlice(r)) => { ty::RegionTraitStore(r) } _ => { @@ -495,13 +495,13 @@ pub fn ast_ty_to_ty( } ast::TyUniq(ty) => { let mt = ast::MutTy { ty: ty, mutbl: ast::MutImmutable }; - mk_pointer(this, rscope, &mt, VStore(ty::vstore_uniq), + mk_pointer(this, rscope, &mt, VStore(ty::VstoreUniq), |tmt| ty::mk_uniq(tcx, tmt.ty)) } ast::TyVec(ty) => { tcx.sess.span_err(ast_ty.span, "bare `[]` is not a type"); // return /something/ so they can at least get more errors - ty::mk_vec(tcx, ast_ty_to_mt(this, rscope, ty), ty::vstore_uniq) + ty::mk_vec(tcx, ast_ty_to_mt(this, rscope, ty), ty::VstoreUniq) } ast::TyPtr(ref mt) => { ty::mk_ptr(tcx, ast_mt_to_mt(this, rscope, mt)) @@ -509,7 +509,7 @@ pub fn ast_ty_to_ty( ast::TyRptr(ref region, ref mt) => { let r = opt_ast_region_to_region(this, rscope, ast_ty.span, region); debug!("ty_rptr r={}", r.repr(this.tcx())); - mk_pointer(this, rscope, mt, VStore(ty::vstore_slice(r)), + mk_pointer(this, rscope, mt, VStore(ty::VstoreSlice(r)), |tmt| ty::mk_rptr(tcx, r, tmt)) } ast::TyTup(ref fields) => { @@ -612,10 +612,10 @@ pub fn ast_ty_to_ty( match *r { const_eval::const_int(i) => ty::mk_vec(tcx, ast_ty_to_mt(this, rscope, ty), - ty::vstore_fixed(i as uint)), + ty::VstoreFixed(i as uint)), const_eval::const_uint(i) => ty::mk_vec(tcx, ast_ty_to_mt(this, rscope, ty), - ty::vstore_fixed(i as uint)), + ty::VstoreFixed(i as uint)), _ => { tcx.sess.span_fatal( ast_ty.span, "expected constant expr for vector length"); diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index bcad3a87582..814c45da43f 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -620,8 +620,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { expected) { ty::ty_vec(mt, vstore) => { let region_var = match vstore { - ty::vstore_slice(r) => r, - ty::vstore_uniq => { + ty::VstoreSlice(r) => r, + ty::VstoreUniq => { fcx.type_error_message(pat.span, |_| { ~"unique vector patterns are no \ @@ -631,7 +631,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { None); default_region_var } - ty::vstore_fixed(_) => { + ty::VstoreFixed(_) => { default_region_var } }; @@ -668,7 +668,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { Some(slice_pat) => { let slice_ty = ty::mk_vec(tcx, ty::mt {ty: elt_type.ty, mutbl: elt_type.mutbl}, - ty::vstore_slice(region_var) + ty::VstoreSlice(region_var) ); check_pat(pcx, slice_pat, slice_ty); } diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 991e21ffab8..b9996a57929 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -770,10 +770,10 @@ impl<'a> LookupContext<'a> { autoderefs: autoderefs+1, autoref: Some(ty::AutoPtr(region, self_mt.mutbl))}) } - ty::ty_vec(self_mt, vstore_slice(_)) => { + ty::ty_vec(self_mt, VstoreSlice(_)) => { let region = self.infcx().next_region_var(infer::Autoref(self.span)); - (ty::mk_vec(tcx, self_mt, vstore_slice(region)), + (ty::mk_vec(tcx, self_mt, VstoreSlice(region)), ty::AutoDerefRef { autoderefs: autoderefs, autoref: Some(ty::AutoBorrowVec(region, self_mt.mutbl))}) @@ -821,15 +821,15 @@ impl<'a> LookupContext<'a> { let tcx = self.tcx(); let sty = ty::get(self_ty).sty.clone(); match sty { - ty_vec(mt, vstore_uniq) | - ty_vec(mt, vstore_slice(_)) | // NDM(#3148) - ty_vec(mt, vstore_fixed(_)) => { + ty_vec(mt, VstoreUniq) | + ty_vec(mt, VstoreSlice(_)) | + ty_vec(mt, VstoreFixed(_)) => { // First try to borrow to a slice let entry = self.search_for_some_kind_of_autorefd_method( AutoBorrowVec, autoderefs, [MutImmutable, MutMutable], |m,r| ty::mk_vec(tcx, ty::mt {ty:mt.ty, mutbl:m}, - vstore_slice(r))); + VstoreSlice(r))); if entry.is_some() { return entry; } @@ -839,7 +839,7 @@ impl<'a> LookupContext<'a> { |m,r| { let slice_ty = ty::mk_vec(tcx, ty::mt {ty:mt.ty, mutbl:m}, - vstore_slice(r)); + VstoreSlice(r)); // NB: we do not try to autoref to a mutable // pointer. That would be creating a pointer // to a temporary pointer (the borrowed @@ -849,18 +849,18 @@ impl<'a> LookupContext<'a> { }) } - ty_str(vstore_uniq) | - ty_str(vstore_fixed(_)) => { + ty_str(VstoreUniq) | + ty_str(VstoreFixed(_)) => { let entry = self.search_for_some_kind_of_autorefd_method( AutoBorrowVec, autoderefs, [MutImmutable], - |_m,r| ty::mk_str(tcx, vstore_slice(r))); + |_m,r| ty::mk_str(tcx, VstoreSlice(r))); if entry.is_some() { return entry; } self.search_for_some_kind_of_autorefd_method( AutoBorrowVecRef, autoderefs, [MutImmutable], |m,r| { - let slice_ty = ty::mk_str(tcx, vstore_slice(r)); + let slice_ty = ty::mk_str(tcx, VstoreSlice(r)); ty::mk_rptr(tcx, r, ty::mt {ty:slice_ty, mutbl:m}) }) } diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 9e0f3c9faa5..b4294c549a2 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -1287,10 +1287,10 @@ pub fn check_lit(fcx: &FnCtxt, lit: &ast::Lit) -> ty::t { let tcx = fcx.ccx.tcx; match lit.node { - ast::LitStr(..) => ty::mk_str(tcx, ty::vstore_slice(ty::ReStatic)), + ast::LitStr(..) => ty::mk_str(tcx, ty::VstoreSlice(ty::ReStatic)), ast::LitBinary(..) => { ty::mk_vec(tcx, ty::mt{ ty: ty::mk_u8(), mutbl: ast::MutImmutable }, - ty::vstore_slice(ty::ReStatic)) + ty::VstoreSlice(ty::ReStatic)) } ast::LitChar(_) => ty::mk_char(), ast::LitInt(_, t) => ty::mk_mach_int(t), @@ -3023,7 +3023,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, check_expr_has_type(fcx, *e, t); } let typ = ty::mk_vec(tcx, ty::mt {ty: t, mutbl: ast::MutImmutable}, - ty::vstore_fixed(args.len())); + ty::VstoreFixed(args.len())); fcx.write_ty(id, typ); } ast::ExprRepeat(element, count_expr) => { @@ -3040,7 +3040,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, } else { let t = ty::mk_vec(tcx, ty::mt {ty: t, mutbl: ast::MutImmutable}, - ty::vstore_fixed(count)); + ty::VstoreFixed(count)); fcx.write_ty(id, t); } } @@ -3855,18 +3855,18 @@ pub fn type_is_c_like_enum(fcx: &FnCtxt, sp: Span, typ: ty::t) -> bool { pub fn ast_expr_vstore_to_vstore(fcx: &FnCtxt, e: &ast::Expr, v: ast::ExprVstore) - -> ty::vstore { + -> ty::Vstore { match v { - ast::ExprVstoreUniq => ty::vstore_uniq, + ast::ExprVstoreUniq => ty::VstoreUniq, ast::ExprVstoreSlice | ast::ExprVstoreMutSlice => { match e.node { ast::ExprLit(..) => { // string literals and *empty slices* live in static memory - ty::vstore_slice(ty::ReStatic) + ty::VstoreSlice(ty::ReStatic) } ast::ExprVec(ref elements) if elements.len() == 0 => { // string literals and *empty slices* live in static memory - ty::vstore_slice(ty::ReStatic) + ty::VstoreSlice(ty::ReStatic) } ast::ExprRepeat(..) | ast::ExprVec(..) => { @@ -3874,11 +3874,11 @@ pub fn ast_expr_vstore_to_vstore(fcx: &FnCtxt, match fcx.tcx().region_maps.temporary_scope(e.id) { Some(scope) => { let r = ty::ReScope(scope); - ty::vstore_slice(r) + ty::VstoreSlice(r) } None => { // this slice occurs in a static somewhere - ty::vstore_slice(ty::ReStatic) + ty::VstoreSlice(ty::ReStatic) } } } diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index c8613fd7065..37b648c8b6c 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -923,8 +923,8 @@ fn constrain_index(rcx: &mut Rcx, let r_index_expr = ty::ReScope(index_expr.id); match ty::get(indexed_ty).sty { - ty::ty_str(ty::vstore_slice(r_ptr)) | - ty::ty_vec(_, ty::vstore_slice(r_ptr)) => { + ty::ty_str(ty::VstoreSlice(r_ptr)) | + ty::ty_vec(_, ty::VstoreSlice(r_ptr)) => { rcx.fcx.mk_subr(true, infer::IndexSlice(index_expr.span), r_index_expr, r_ptr); } diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs index febf47add43..e0d2d2252b0 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -101,7 +101,7 @@ pub fn relate_nested_regions(tcx: &ty::ctxt, fn fold_ty(&mut self, ty: ty::t) -> ty::t { match ty::get(ty).sty { ty::ty_rptr(r, ref mt) | - ty::ty_vec(ref mt, ty::vstore_slice(r)) => { + ty::ty_vec(ref mt, ty::VstoreSlice(r)) => { self.relate(r); self.stack.push(r); ty_fold::super_fold_ty(self, mt.ty); diff --git a/src/librustc/middle/typeck/infer/coercion.rs b/src/librustc/middle/typeck/infer/coercion.rs index 8a1662ca701..d37518c13d5 100644 --- a/src/librustc/middle/typeck/infer/coercion.rs +++ b/src/librustc/middle/typeck/infer/coercion.rs @@ -67,7 +67,7 @@ we may want to adjust precisely when coercions occur. use middle::ty::{AutoPtr, AutoBorrowVec, AutoBorrowFn, AutoBorrowObj}; use middle::ty::{AutoDerefRef}; -use middle::ty::{vstore_slice, vstore_uniq}; +use middle::ty::{VstoreSlice, VstoreUniq}; use middle::ty::{mt}; use middle::ty; use middle::typeck::infer::{CoerceResult, resolve_type, Coercion}; @@ -108,13 +108,13 @@ impl<'f> Coerce<'f> { }); } - ty::ty_str(vstore_slice(_)) => { + ty::ty_str(VstoreSlice(_)) => { return self.unpack_actual_value(a, |sty_a| { self.coerce_borrowed_string(a, sty_a, b) }); } - ty::ty_vec(mt_b, vstore_slice(_)) => { + ty::ty_vec(mt_b, VstoreSlice(_)) => { return self.unpack_actual_value(a, |sty_a| { self.coerce_borrowed_vector(a, sty_a, b, mt_b) }); @@ -260,14 +260,14 @@ impl<'f> Coerce<'f> { b.inf_str(self.get_ref().infcx)); match *sty_a { - ty::ty_str(vstore_uniq) => {} + ty::ty_str(VstoreUniq) => {} _ => { return self.subtype(a, b); } }; let r_a = self.get_ref().infcx.next_region_var(Coercion(self.get_ref().trace)); - let a_borrowed = ty::mk_str(self.get_ref().infcx.tcx, vstore_slice(r_a)); + let a_borrowed = ty::mk_str(self.get_ref().infcx.tcx, VstoreSlice(r_a)); if_ok!(self.subtype(a_borrowed, b)); Ok(Some(@AutoDerefRef(AutoDerefRef { autoderefs: 0, @@ -296,7 +296,7 @@ impl<'f> Coerce<'f> { let a_borrowed = ty::mk_vec(self.get_ref().infcx.tcx, mt {ty: ty_inner, mutbl: mt_b.mutbl}, - vstore_slice(r_borrow)); + VstoreSlice(r_borrow)); if_ok!(sub.tys(a_borrowed, b)); Ok(Some(@AutoDerefRef(AutoDerefRef { autoderefs: 0, diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index 749c1ee6938..8352688f4ae 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -264,15 +264,15 @@ pub trait Combine { fn vstores(&self, vk: ty::terr_vstore_kind, - a: ty::vstore, - b: ty::vstore) - -> cres { + a: ty::Vstore, + b: ty::Vstore) + -> cres { debug!("{}.vstores(a={:?}, b={:?})", self.tag(), a, b); match (a, b) { - (ty::vstore_slice(a_r), ty::vstore_slice(b_r)) => { + (ty::VstoreSlice(a_r), ty::VstoreSlice(b_r)) => { self.contraregions(a_r, b_r).and_then(|r| { - Ok(ty::vstore_slice(r)) + Ok(ty::VstoreSlice(r)) }) } diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index 91d9b264a88..7e7f48a351f 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -716,19 +716,18 @@ impl<'a> ConstraintContext<'a> { } } - /// Adds constraints appropriate for a vector with vstore `vstore` + /// Adds constraints appropriate for a vector with Vstore `vstore` /// appearing in a context with ambient variance `variance` fn add_constraints_from_vstore(&mut self, - vstore: ty::vstore, + vstore: ty::Vstore, variance: VarianceTermPtr<'a>) { match vstore { - ty::vstore_slice(r) => { + ty::VstoreSlice(r) => { let contra = self.contravariant(variance); self.add_constraints_from_region(r, contra); } - ty::vstore_fixed(_) | ty::vstore_uniq => { - } + ty::VstoreFixed(_) | ty::VstoreUniq => {} } } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 155ceadf0d8..ad60b67fff8 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -205,24 +205,24 @@ pub fn mt_to_str_wrapped(cx: &ctxt, before: &str, m: &mt, after: &str) -> ~str { return format!("{}{}{}{}", mstr, before, ty_to_str(cx, m.ty), after); } -pub fn vstore_to_str(cx: &ctxt, vs: ty::vstore) -> ~str { +pub fn vstore_to_str(cx: &ctxt, vs: ty::Vstore) -> ~str { match vs { - ty::vstore_fixed(n) => format!("{}", n), - ty::vstore_uniq => ~"~", - ty::vstore_slice(r) => region_ptr_to_str(cx, r) + ty::VstoreFixed(n) => format!("{}", n), + ty::VstoreUniq => ~"~", + ty::VstoreSlice(r) => region_ptr_to_str(cx, r) } } pub fn trait_store_to_str(cx: &ctxt, s: ty::TraitStore) -> ~str { match s { - ty::UniqTraitStore => ~"~", - ty::RegionTraitStore(r) => region_ptr_to_str(cx, r) + ty::UniqTraitStore => ~"~", + ty::RegionTraitStore(r) => region_ptr_to_str(cx, r) } } -pub fn vstore_ty_to_str(cx: &ctxt, mt: &mt, vs: ty::vstore) -> ~str { +pub fn vstore_ty_to_str(cx: &ctxt, mt: &mt, vs: ty::Vstore) -> ~str { match vs { - ty::vstore_fixed(_) => { + ty::VstoreFixed(_) => { format!("[{}, .. {}]", mt_to_str(cx, mt), vstore_to_str(cx, vs)) } _ => { @@ -885,7 +885,7 @@ impl Repr for ty::TraitStore { } } -impl Repr for ty::vstore { +impl Repr for ty::Vstore { fn repr(&self, tcx: &ctxt) -> ~str { vstore_to_str(tcx, *self) }