Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various type and trans cleanups. #11252

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/librustc/back/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ pub static tydesc_field_size: uint = 0u;
pub static tydesc_field_align: uint = 1u;
pub static tydesc_field_take_glue: uint = 2u;
pub static tydesc_field_drop_glue: uint = 3u;
pub static tydesc_field_free_glue: uint = 4u;
pub static tydesc_field_visit_glue: uint = 5u;
pub static tydesc_field_borrow_offset: uint = 6u;
pub static tydesc_field_name_offset: uint = 7u;
pub static n_tydesc_fields: uint = 8u;
pub static tydesc_field_visit_glue: uint = 4u;
pub static tydesc_field_borrow_offset: uint = 5u;
pub static tydesc_field_name_offset: uint = 6u;
pub static n_tydesc_fields: uint = 7u;

// The two halves of a closure: code and environment.
pub static fn_field_code: uint = 0u;
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
'V' => {
let mt = parse_mt(st, |x,y| conv(x,y));
let v = parse_vstore(st, |x,y| conv(x,y));
return ty::mk_evec(st.tcx, mt, v);
return ty::mk_vec(st.tcx, mt, v);
}
'v' => {
let v = parse_vstore(st, |x,y| conv(x,y));
return ty::mk_estr(st.tcx, v);
return ty::mk_str(st.tcx, v);
}
'T' => {
assert_eq!(next(st), '[');
Expand Down Expand Up @@ -410,7 +410,6 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
let inner = parse_ty(st, |x,y| conv(x,y));
inner
}
'B' => ty::mk_opaque_box(st.tcx),
'a' => {
assert_eq!(next(st), '[');
let did = parse_def(st, NominalType, |x,y| conv(x,y));
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
enc_region(w, cx, r);
enc_mt(w, cx, mt);
}
ty::ty_evec(mt, v) => {
ty::ty_vec(mt, v) => {
mywrite!(w, "V");
enc_mt(w, cx, mt);
enc_vstore(w, cx, v);
}
ty::ty_estr(v) => {
ty::ty_str(v) => {
mywrite!(w, "v");
enc_vstore(w, cx, v);
}
Expand All @@ -331,7 +331,6 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
mywrite!(w, "C&");
enc_sigil(w, p);
}
ty::ty_opaque_box => mywrite!(w, "B"),
ty::ty_struct(def, ref substs) => {
mywrite!(w, "a[{}|", (cx.ds)(def));
enc_substs(w, cx, substs);
Expand Down
9 changes: 1 addition & 8 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,6 @@ fn encode_method_map_entry(ecx: &e::EncodeContext,
ebml_w.emit_struct_field("origin", 1u, |ebml_w| {
mme.origin.encode(ebml_w);
});
ebml_w.emit_struct_field("self_mode", 3, |ebml_w| {
mme.self_mode.encode(ebml_w);
});
})
}

Expand All @@ -602,11 +599,7 @@ impl<'a> read_method_map_entry_helper for reader::Decoder<'a> {
let method_origin: method_origin =
Decodable::decode(this);
method_origin.tr(xcx)
}),
self_mode: this.read_struct_field("self_mode", 3, |this| {
let self_mode: ty::SelfMode = Decodable::decode(this);
self_mode
}),
})
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/gather_loans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ impl<'a> GatherLoanCtxt<'a> {
*/

match ty::get(slice_ty).sty {
ty::ty_evec(slice_mt, ty::vstore_slice(slice_r)) => {
ty::ty_vec(slice_mt, ty::vstore_slice(slice_r)) => {
(slice_mt.mutbl, slice_r)
}

Expand Down
12 changes: 6 additions & 6 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
}
}
}
ty::ty_unboxed_vec(..) | ty::ty_evec(..) => {
ty::ty_unboxed_vec(..) | ty::ty_vec(..) => {
match *ctor {
vec(n) => Some(format!("vectors of length {}", n).to_managed()),
_ => None
Expand Down Expand Up @@ -274,10 +274,10 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
}
not_useful
}
ty::ty_evec(_, ty::vstore_fixed(n)) => {
ty::ty_vec(_, ty::vstore_fixed(n)) => {
is_useful_specialized(cx, m, v, vec(n), n, left_ty)
}
ty::ty_unboxed_vec(..) | ty::ty_evec(..) => {
ty::ty_unboxed_vec(..) | ty::ty_vec(..) => {
let max_len = m.rev_iter().fold(0, |max_len, r| {
match r[0].node {
PatVec(ref before, _, ref after) => {
Expand Down Expand Up @@ -437,7 +437,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
else if true_found { Some(val(const_bool(false))) }
else { Some(val(const_bool(true))) }
}
ty::ty_evec(_, ty::vstore_fixed(n)) => {
ty::ty_vec(_, ty::vstore_fixed(n)) => {
let mut missing = true;
let mut wrong = false;
for r in m.iter() {
Expand All @@ -460,7 +460,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
_ => None
}
}
ty::ty_unboxed_vec(..) | ty::ty_evec(..) => {
ty::ty_unboxed_vec(..) | ty::ty_vec(..) => {

// Find the lengths and slices of all vector patterns.
let mut vec_pat_lens = m.iter().filter_map(|r| {
Expand Down Expand Up @@ -525,7 +525,7 @@ fn ctor_arity(cx: &MatchCheckCtxt, ctor: &ctor, ty: ty::t) -> uint {
}
}
ty::ty_struct(cid, _) => ty::lookup_struct_fields(cx.tcx, cid).len(),
ty::ty_unboxed_vec(..) | ty::ty_evec(..) => {
ty::ty_unboxed_vec(..) | ty::ty_vec(..) => {
match *ctor {
vec(n) => n,
_ => 0u
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl EffectCheckVisitor {
debug!("effect: checking index with base type {}",
ppaux::ty_to_str(self.tcx, base_type));
match ty::get(base_type).sty {
ty::ty_estr(..) => {
ty::ty_str(..) => {
self.tcx.sess.span_err(e.span,
"modification of string types is not allowed");
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,13 +819,13 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
let mut n_uniq = 0;
ty::fold_ty(cx.tcx, ty, |t| {
match ty::get(t).sty {
ty::ty_box(_) | ty::ty_estr(ty::vstore_box) |
ty::ty_evec(_, ty::vstore_box) |
ty::ty_box(_) | ty::ty_str(ty::vstore_box) |
ty::ty_vec(_, ty::vstore_box) |
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
n_box += 1;
}
ty::ty_uniq(_) | ty::ty_estr(ty::vstore_uniq) |
ty::ty_evec(_, ty::vstore_uniq) |
ty::ty_uniq(_) | ty::ty_str(ty::vstore_uniq) |
ty::ty_vec(_, ty::vstore_uniq) |
ty::ty_trait(_, _, ty::UniqTraitStore, _, _) => {
n_uniq += 1;
}
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,31 +157,31 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
match ty::get(t).sty {
ty::ty_uniq(_) |
ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
ty::ty_evec(_, ty::vstore_uniq) |
ty::ty_estr(ty::vstore_uniq) |
ty::ty_vec(_, ty::vstore_uniq) |
ty::ty_str(ty::vstore_uniq) |
ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => {
Some(deref_ptr(uniq_ptr))
}

ty::ty_rptr(r, mt) |
ty::ty_evec(mt, ty::vstore_slice(r)) => {
ty::ty_vec(mt, ty::vstore_slice(r)) => {
Some(deref_ptr(region_ptr(mt.mutbl, r)))
}

ty::ty_trait(_, _, ty::RegionTraitStore(r), m, _) => {
Some(deref_ptr(region_ptr(m, r)))
}

ty::ty_estr(ty::vstore_slice(r)) |
ty::ty_str(ty::vstore_slice(r)) |
ty::ty_closure(ty::ClosureTy {sigil: ast::BorrowedSigil,
region: r, ..}) => {
Some(deref_ptr(region_ptr(ast::MutImmutable, r)))
}

ty::ty_box(_) |
ty::ty_evec(_, ty::vstore_box) |
ty::ty_vec(_, ty::vstore_box) |
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) |
ty::ty_estr(ty::vstore_box) => {
ty::ty_str(ty::vstore_box) => {
Some(deref_ptr(gc_ptr))
}

Expand All @@ -194,8 +194,8 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
Some(deref_interior(InteriorField(PositionalField(0))))
}

ty::ty_evec(_, ty::vstore_fixed(_)) |
ty::ty_estr(ty::vstore_fixed(_)) => {
ty::ty_vec(_, ty::vstore_fixed(_)) |
ty::ty_str(ty::vstore_fixed(_)) => {
Some(deref_interior(InteriorElement(element_kind(t))))
}

Expand Down Expand Up @@ -1247,8 +1247,8 @@ impl Repr for InteriorKind {

fn element_kind(t: ty::t) -> ElementKind {
match ty::get(t).sty {
ty::ty_evec(..) => VecElement,
ty::ty_estr(..) => StrElement,
ty::ty_vec(..) => VecElement,
ty::ty_str(..) => StrElement,
_ => OtherElement
}
}
Loading