Skip to content

Commit e18ed77

Browse files
committed
Remove remnants of mutable fields from mem_categorization, borrowck.
1 parent 15164cc commit e18ed77

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/librustc/middle/borrowck/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ pub impl BorrowckCtxt {
615615
}
616616
}
617617

618-
LpExtend(lp_base, _, LpInterior(mc::interior_field(fld, _))) => {
618+
LpExtend(lp_base, _, LpInterior(mc::interior_field(fld))) => {
619619
self.append_loan_path_to_str_from_interior(lp_base, out);
620620
str::push_char(out, '.');
621621
str::push_str(out, *self.tcx.sess.intr().get(fld));

src/librustc/middle/mem_categorization.rs

+8-15
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub enum categorization {
6666
cat_local(ast::node_id), // local variable
6767
cat_arg(ast::node_id), // formal argument
6868
cat_deref(cmt, uint, ptr_kind), // deref of a ptr
69-
cat_interior(cmt, interior_kind), // something interior
69+
cat_interior(cmt, interior_kind), // something interior
7070
cat_discr(cmt, ast::node_id), // match discriminant (see preserve())
7171
cat_self(ast::node_id), // explicit `self`
7272
}
@@ -94,8 +94,7 @@ pub enum interior_kind {
9494
interior_anon_field, // anonymous field (in e.g.
9595
// struct Foo(int, int);
9696
interior_variant(ast::def_id), // internals to a variant of given enum
97-
interior_field(ast::ident, // name of field
98-
ast::mutability), // declared mutability of field
97+
interior_field(ast::ident), // name of field
9998
interior_index(ty::t, // type of vec/str/etc being deref'd
10099
ast::mutability) // mutability of vec content
101100
}
@@ -395,8 +394,7 @@ pub impl mem_categorization_ctxt {
395394
assert!(!self.method_map.contains_key(&expr.id));
396395

397396
let base_cmt = self.cat_expr(base);
398-
self.cat_field(expr, base_cmt, f_name,
399-
self.expr_ty(expr), expr.id)
397+
self.cat_field(expr, base_cmt, f_name, self.expr_ty(expr))
400398
}
401399

402400
ast::expr_index(base, _) => {
@@ -579,16 +577,12 @@ pub impl mem_categorization_ctxt {
579577
node: N,
580578
base_cmt: cmt,
581579
f_name: ast::ident,
582-
f_ty: ty::t,
583-
field_id: ast::node_id) -> cmt {
584-
let f_mutbl = m_imm;
585-
let m = self.inherited_mutability(base_cmt.mutbl, f_mutbl);
586-
let f_interior = interior_field(f_name, f_mutbl);
580+
f_ty: ty::t) -> cmt {
587581
@cmt_ {
588582
id: node.id(),
589583
span: node.span(),
590-
cat: cat_interior(base_cmt, f_interior),
591-
mutbl: m,
584+
cat: cat_interior(base_cmt, interior_field(f_name)),
585+
mutbl: base_cmt.mutbl.inherit(),
592586
ty: f_ty
593587
}
594588
}
@@ -886,8 +880,7 @@ pub impl mem_categorization_ctxt {
886880
// {f1: p1, ..., fN: pN}
887881
for field_pats.each |fp| {
888882
let field_ty = self.pat_ty(fp.pat); // see (*)
889-
let cmt_field = self.cat_field(pat, cmt, fp.ident,
890-
field_ty, pat.id);
883+
let cmt_field = self.cat_field(pat, cmt, fp.ident, field_ty);
891884
self.cat_pattern(cmt_field, fp.pat, op);
892885
}
893886
}
@@ -1141,7 +1134,7 @@ pub fn ptr_sigil(ptr: ptr_kind) -> ~str {
11411134
impl Repr for interior_kind {
11421135
fn repr(&self, tcx: ty::ctxt) -> ~str {
11431136
match *self {
1144-
interior_field(fld, _) => copy *tcx.sess.str_of(fld),
1137+
interior_field(fld) => copy *tcx.sess.str_of(fld),
11451138
interior_index(*) => ~"[]",
11461139
interior_tuple => ~"()",
11471140
interior_anon_field => ~"<anonymous field>",

0 commit comments

Comments
 (0)