Skip to content

Commit

Permalink
Remove remnants of mutable fields from mem_categorization, borrowck.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed May 9, 2013
1 parent 15164cc commit e18ed77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ pub impl BorrowckCtxt {
}
}

LpExtend(lp_base, _, LpInterior(mc::interior_field(fld, _))) => {
LpExtend(lp_base, _, LpInterior(mc::interior_field(fld))) => {
self.append_loan_path_to_str_from_interior(lp_base, out);
str::push_char(out, '.');
str::push_str(out, *self.tcx.sess.intr().get(fld));
Expand Down
23 changes: 8 additions & 15 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub enum categorization {
cat_local(ast::node_id), // local variable
cat_arg(ast::node_id), // formal argument
cat_deref(cmt, uint, ptr_kind), // deref of a ptr
cat_interior(cmt, interior_kind), // something interior
cat_interior(cmt, interior_kind), // something interior
cat_discr(cmt, ast::node_id), // match discriminant (see preserve())
cat_self(ast::node_id), // explicit `self`
}
Expand Down Expand Up @@ -94,8 +94,7 @@ pub enum interior_kind {
interior_anon_field, // anonymous field (in e.g.
// struct Foo(int, int);
interior_variant(ast::def_id), // internals to a variant of given enum
interior_field(ast::ident, // name of field
ast::mutability), // declared mutability of field
interior_field(ast::ident), // name of field
interior_index(ty::t, // type of vec/str/etc being deref'd
ast::mutability) // mutability of vec content
}
Expand Down Expand Up @@ -395,8 +394,7 @@ pub impl mem_categorization_ctxt {
assert!(!self.method_map.contains_key(&expr.id));

let base_cmt = self.cat_expr(base);
self.cat_field(expr, base_cmt, f_name,
self.expr_ty(expr), expr.id)
self.cat_field(expr, base_cmt, f_name, self.expr_ty(expr))
}

ast::expr_index(base, _) => {
Expand Down Expand Up @@ -579,16 +577,12 @@ pub impl mem_categorization_ctxt {
node: N,
base_cmt: cmt,
f_name: ast::ident,
f_ty: ty::t,
field_id: ast::node_id) -> cmt {
let f_mutbl = m_imm;
let m = self.inherited_mutability(base_cmt.mutbl, f_mutbl);
let f_interior = interior_field(f_name, f_mutbl);
f_ty: ty::t) -> cmt {
@cmt_ {
id: node.id(),
span: node.span(),
cat: cat_interior(base_cmt, f_interior),
mutbl: m,
cat: cat_interior(base_cmt, interior_field(f_name)),
mutbl: base_cmt.mutbl.inherit(),
ty: f_ty
}
}
Expand Down Expand Up @@ -886,8 +880,7 @@ pub impl mem_categorization_ctxt {
// {f1: p1, ..., fN: pN}
for field_pats.each |fp| {
let field_ty = self.pat_ty(fp.pat); // see (*)
let cmt_field = self.cat_field(pat, cmt, fp.ident,
field_ty, pat.id);
let cmt_field = self.cat_field(pat, cmt, fp.ident, field_ty);
self.cat_pattern(cmt_field, fp.pat, op);
}
}
Expand Down Expand Up @@ -1141,7 +1134,7 @@ pub fn ptr_sigil(ptr: ptr_kind) -> ~str {
impl Repr for interior_kind {
fn repr(&self, tcx: ty::ctxt) -> ~str {
match *self {
interior_field(fld, _) => copy *tcx.sess.str_of(fld),
interior_field(fld) => copy *tcx.sess.str_of(fld),
interior_index(*) => ~"[]",
interior_tuple => ~"()",
interior_anon_field => ~"<anonymous field>",
Expand Down

1 comment on commit e18ed77

@graydon
Copy link

@graydon graydon commented on e18ed77 May 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ p=10

thanks!

Please sign in to comment.