Skip to content

Commit 3bad712

Browse files
committed
Remove mutability from unique boxes in the AST
1 parent b29c368 commit 3bad712

File tree

16 files changed

+30
-28
lines changed

16 files changed

+30
-28
lines changed

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
786786
's' => { return ast::sty_static; }
787787
'v' => { return ast::sty_value; }
788788
'@' => { return ast::sty_box(get_mutability(string[1])); }
789-
'~' => { return ast::sty_uniq(get_mutability(string[1])); }
789+
'~' => { return ast::sty_uniq; }
790790
'&' => {
791791
// FIXME(#4846) expl. region
792792
return ast::sty_region(None, get_mutability(string[1]));

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,8 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::explic
630630
ebml_w.writer.write(&[ '@' as u8 ]);
631631
encode_mutability(ebml_w, m);
632632
}
633-
sty_uniq(m) => {
633+
sty_uniq => {
634634
ebml_w.writer.write(&[ '~' as u8 ]);
635-
encode_mutability(ebml_w, m);
636635
}
637636
}
638637

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn check_expr(sess: Session,
9292
if is_const {
9393
match e.node {
9494
expr_unary(_, deref, _) => { }
95-
expr_unary(_, box(_), _) | expr_unary(_, uniq(_), _) => {
95+
expr_unary(_, box(_), _) | expr_unary(_, uniq, _) => {
9696
sess.span_err(e.span,
9797
"disallowed operator in constant expression");
9898
return;

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ fn visit_fn(fk: &visit::fn_kind,
368368
match *fk {
369369
fk_method(_, _, method) => {
370370
match method.explicit_self.node {
371-
sty_value | sty_region(*) | sty_box(_) | sty_uniq(_) => {
371+
sty_value | sty_region(*) | sty_box(_) | sty_uniq => {
372372
fn_maps.add_variable(Arg(method.self_id,
373373
special_idents::self_));
374374
}

src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: &ast::expr) -> ValueRef {
340340
let is_float = ty::type_is_fp(ty);
341341
return match u {
342342
ast::box(_) |
343-
ast::uniq(_) |
343+
ast::uniq |
344344
ast::deref => {
345345
let (dv, _dt) = const_deref(cx, te, ty, true);
346346
dv

src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ fn trans_unary_datum(bcx: block,
13141314
trans_boxed_expr(bcx, un_ty, sub_expr, sub_ty,
13151315
heap_managed)
13161316
}
1317-
ast::uniq(_) => {
1317+
ast::uniq => {
13181318
let heap = heap_for_unique(bcx, un_ty);
13191319
trans_boxed_expr(bcx, un_ty, sub_expr, sub_ty, heap)
13201320
}

src/librustc/middle/trans/meth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ pub fn trans_trait_callee(bcx: block,
532532
let llpair = match explicit_self {
533533
ast::sty_region(*) => Load(bcx, llpair),
534534
ast::sty_static | ast::sty_value |
535-
ast::sty_box(_) | ast::sty_uniq(_) => llpair
535+
ast::sty_box(_) | ast::sty_uniq => llpair
536536
};
537537

538538
let callee_ty = node_id_type(bcx, callee_id);
@@ -622,7 +622,7 @@ pub fn trans_trait_callee_from_llval(bcx: block,
622622

623623
self_mode = ty::ByRef;
624624
}
625-
ast::sty_uniq(_) => {
625+
ast::sty_uniq => {
626626
// Pass the unique pointer.
627627
match store {
628628
ty::UniqTraitStore => llself = llbox,

src/librustc/middle/trans/type_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ pub fn mark_for_method_call(cx: &Context, e_id: node_id, callee_id: node_id) {
278278
pub fn mark_for_expr(cx: &Context, e: &expr) {
279279
match e.node {
280280
expr_vstore(_, _) | expr_vec(_, _) | expr_struct(*) | expr_tup(_) |
281-
expr_unary(_, box(_), _) | expr_unary(_, uniq(_), _) |
281+
expr_unary(_, box(_), _) | expr_unary(_, uniq, _) |
282282
expr_binary(_, add, _, _) | expr_copy(_) | expr_repeat(*) => {
283283
node_type_needs(cx, use_repr, e.id);
284284
}

src/librustc/middle/typeck/astconv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,10 @@ fn ty_of_method_or_bare_fn<AC:AstConv,RS:region_scope + Copy + 'static>(
662662
ty::mt {ty: self_info.untransformed_self_ty,
663663
mutbl: mutability}))
664664
}
665-
ast::sty_uniq(mutability) => {
665+
ast::sty_uniq => {
666666
Some(ty::mk_uniq(this.tcx(),
667667
ty::mt {ty: self_info.untransformed_self_ty,
668-
mutbl: mutability}))
668+
mutbl: ast::m_imm}))
669669
}
670670
}
671671
}

src/librustc/middle/typeck/check/method.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,11 +1123,11 @@ impl<'self> LookupContext<'self> {
11231123
}
11241124
}
11251125

1126-
sty_uniq(m) => {
1126+
sty_uniq => {
11271127
debug!("(is relevant?) explicit self is a unique pointer");
11281128
match ty::get(rcvr_ty).sty {
11291129
ty::ty_uniq(mt) => {
1130-
mutability_matches(mt.mutbl, m) &&
1130+
mutability_matches(mt.mutbl, ast::m_imm) &&
11311131
self.fcx.can_mk_subty(mt.ty, candidate.rcvr_ty).is_ok()
11321132
}
11331133

0 commit comments

Comments
 (0)