Skip to content

Commit f207feb

Browse files
committed
---
yaml --- r: 140237 b: refs/heads/try2 c: ef6b24d h: refs/heads/master i: 140235: 7139566 v: v3
1 parent 1ea5e52 commit f207feb

File tree

4 files changed

+30
-56
lines changed

4 files changed

+30
-56
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 14bf5c4fe7eb110fc124a710b40bc7c5a7801e25
8+
refs/heads/try2: ef6b24d1350ad658faee68f7eddd2c05a56900ce
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ pub fn root_pats_as_necessary(bcx: block,
966966
967967
let datum = Datum {val: val, ty: node_id_type(bcx, pat_id),
968968
mode: ByRef, source: ZeroMem};
969-
bcx = datum.root(bcx, br.pats[col].span, root_info);
969+
bcx = datum.root(bcx, br.pats[col].span, key, root_info);
970970
// If we kept going, we'd only re-root the same value, so
971971
// return now.
972972
return bcx;

branches/try2/src/librustc/middle/trans/datum.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,17 @@ pub impl Datum {
517517
}
518518
}
519519

520-
fn root(&self, mut bcx: block, span: span, root_info: RootInfo) -> block {
520+
fn root(&self, mut bcx: block, span: span,
521+
root_key: root_map_key, root_info: RootInfo) -> block {
521522
/*!
522523
*
523524
* In some cases, borrowck will decide that an @T/@[]/@str
524525
* value must be rooted for the program to be safe. In that
525526
* case, we will call this function, which will stash a copy
526527
* away until we exit the scope `scope_id`. */
527528

528-
debug!("root(root_info=%?, self=%?)",
529-
root_info, self.to_str(bcx.ccx()));
529+
debug!("root(root_map_key=%?, root_info=%?, self=%?)",
530+
root_key, root_info, self.to_str(bcx.ccx()));
530531

531532
if bcx.sess().trace() {
532533
trans_trace(
@@ -674,7 +675,7 @@ pub impl Datum {
674675
let key = root_map_key { id: expr_id, derefs: derefs };
675676
let bcx = match ccx.maps.root_map.find(&key) {
676677
None => bcx,
677-
Some(&root_info) => self.root(bcx, span, root_info)
678+
Some(&root_info) => self.root(bcx, span, key, root_info)
678679
};
679680

680681
// Perform the write guard, if necessary.

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 23 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -821,57 +821,30 @@ fn trans_lvalue_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
821821

822822
trace_span!(bcx, expr.span, @shorten(bcx.expr_to_str(expr)));
823823

824-
let unrooted_datum = unpack_datum!(bcx, unrooted(bcx, expr));
825-
826-
// If the lvalue must remain rooted, create a scratch datum, copy
827-
// the lvalue in there, and then arrange for it to be cleaned up
828-
// at the end of the scope with id `scope_id`:
829-
let root_key = root_map_key { id: expr.id, derefs: 0u };
830-
for bcx.ccx().maps.root_map.find(&root_key).each |&root_info| {
831-
bcx = unrooted_datum.root(bcx, expr.span, *root_info);
832-
}
833-
834-
return DatumBlock {bcx: bcx, datum: unrooted_datum};
835-
836-
fn unrooted(bcx: block, expr: @ast::expr) -> DatumBlock {
837-
/*!
838-
*
839-
* Translates `expr`. Note that this version generally
840-
* yields an unrooted, unmoved version. Rooting and possible
841-
* moves are dealt with above in trans_lvalue_unadjusted().
842-
*
843-
* One exception is if `expr` refers to a local variable,
844-
* in which case the source may already be FromMovedLvalue
845-
* if appropriate.
846-
*/
847-
848-
let mut bcx = bcx;
849-
850-
match expr.node {
851-
ast::expr_paren(e) => {
852-
return unrooted(bcx, e);
853-
}
854-
ast::expr_path(_) => {
855-
return trans_def_lvalue(bcx, expr, bcx.def(expr.id));
856-
}
857-
ast::expr_field(base, ident, _) => {
858-
return trans_rec_field(bcx, base, ident);
859-
}
860-
ast::expr_index(base, idx) => {
861-
return trans_index(bcx, expr, base, idx);
862-
}
863-
ast::expr_unary(ast::deref, base) => {
864-
let basedatum = unpack_datum!(bcx, trans_to_datum(bcx, base));
865-
return basedatum.deref(bcx, base, 0);
866-
}
867-
_ => {
868-
bcx.tcx().sess.span_bug(
869-
expr.span,
870-
fmt!("trans_lvalue reached fall-through case: %?",
871-
expr.node));
872-
}
824+
return match expr.node {
825+
ast::expr_paren(e) => {
826+
unrooted(bcx, e)
873827
}
874-
}
828+
ast::expr_path(_) => {
829+
trans_def_lvalue(bcx, expr, bcx.def(expr.id))
830+
}
831+
ast::expr_field(base, ident, _) => {
832+
trans_rec_field(bcx, base, ident)
833+
}
834+
ast::expr_index(base, idx) => {
835+
trans_index(bcx, expr, base, idx)
836+
}
837+
ast::expr_unary(ast::deref, base) => {
838+
let basedatum = unpack_datum!(bcx, trans_to_datum(bcx, base));
839+
basedatum.deref(bcx, base, 0)
840+
}
841+
_ => {
842+
bcx.tcx().sess.span_bug(
843+
expr.span,
844+
fmt!("trans_lvalue reached fall-through case: %?",
845+
expr.node));
846+
}
847+
};
875848

876849
fn trans_rec_field(bcx: block,
877850
base: @ast::expr,

0 commit comments

Comments
 (0)