Skip to content

Commit ad27695

Browse files
committed
---
yaml --- r: 30359 b: refs/heads/incoming c: 5e36a99 h: refs/heads/master i: 30357: 5f18a55 30355: 60509b6 30351: 0e8f2f1 v: v3
1 parent 519b51a commit ad27695

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6457
-5111
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: adc1427282b4da8f963550e87cdbe512157958b4
9+
refs/heads/incoming: 5e36a997945ddc3964a1fe937bc5390cc5b526c8
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ endif
100100
ifdef TIME_LLVM_PASSES
101101
CFG_RUSTC_FLAGS += -Z time-llvm-passes
102102
endif
103+
ifdef TRACE
104+
CFG_RUSTC_FLAGS += -Z trace
105+
endif
103106

104107
# platform-specific auto-configuration
105108
include $(CFG_SRC_DIR)mk/platform.mk

branches/incoming/src/libcore/util.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ mod tests {
6565
fn identity_crisis() {
6666
// Writing a test for the identity function. How did it come to this?
6767
let x = ~[(5, false)];
68-
assert x.eq(id(copy x));
68+
//FIXME #3387 assert x.eq(id(copy x));
69+
let y = copy x;
70+
assert x.eq(id(y));
6971
}
7072
#[test]
7173
fn test_swap() {

branches/incoming/src/libstd/getopts.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,11 @@ mod tests {
800800
let rs = getopts(args, opts);
801801
match rs {
802802
Ok(m) => {
803-
assert (opt_present(m, ~"test"));
804-
assert (opt_str(m, ~"test") == ~"20");
805-
assert (opt_strs(m, ~"test")[0] == ~"20");
806-
assert (opt_strs(m, ~"test")[1] == ~"30");
803+
assert (opt_present(m, ~"test"));
804+
assert (opt_str(m, ~"test") == ~"20");
805+
let pair = opt_strs(m, ~"test");
806+
assert (pair[0] == ~"20");
807+
assert (pair[1] == ~"30");
807808
}
808809
_ => fail
809810
}
@@ -854,8 +855,9 @@ mod tests {
854855
Ok(m) => {
855856
assert (opt_present(m, ~"t"));
856857
assert (opt_str(m, ~"t") == ~"20");
857-
assert (opt_strs(m, ~"t")[0] == ~"20");
858-
assert (opt_strs(m, ~"t")[1] == ~"30");
858+
let pair = opt_strs(m, ~"t");
859+
assert (pair[0] == ~"20");
860+
assert (pair[1] == ~"30");
859861
}
860862
_ => fail
861863
}
@@ -903,10 +905,12 @@ mod tests {
903905
assert (opt_present(m, ~"flag"));
904906
assert (opt_str(m, ~"long") == ~"30");
905907
assert (opt_present(m, ~"f"));
906-
assert (opt_strs(m, ~"m")[0] == ~"40");
907-
assert (opt_strs(m, ~"m")[1] == ~"50");
908-
assert (opt_strs(m, ~"n")[0] == ~"-A B");
909-
assert (opt_strs(m, ~"n")[1] == ~"-60 70");
908+
let pair = opt_strs(m, ~"m");
909+
assert (pair[0] == ~"40");
910+
assert (pair[1] == ~"50");
911+
let pair = opt_strs(m, ~"n");
912+
assert (pair[0] == ~"-A B");
913+
assert (pair[1] == ~"-60 70");
910914
assert (!opt_present(m, ~"notpresent"));
911915
}
912916
_ => fail

branches/incoming/src/libstd/par.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const min_granularity : uint = 1024u;
1919
* like map or alli.
2020
*/
2121
fn map_slices<A: copy send, B: copy send>(
22-
xs: ~[A],
22+
xs: &[A],
2323
f: fn() -> fn~(uint, v: &[A]) -> B)
2424
-> ~[B] {
2525

@@ -104,7 +104,7 @@ fn mapi<A: copy send, B: copy send>(xs: ~[A],
104104
* inner elements. This is to skirt the need for copy constructors.
105105
*/
106106
fn mapi_factory<A: copy send, B: copy send>(
107-
xs: ~[A], f: fn() -> fn~(uint, A) -> B) -> ~[B] {
107+
xs: &[A], f: fn() -> fn~(uint, A) -> B) -> ~[B] {
108108
let slices = map_slices(xs, || {
109109
let f = f();
110110
fn~(base: uint, slice : &[A], move f) -> ~[B] {

branches/incoming/src/libsyntax/print/pprust.rs

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,29 +1169,38 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
11691169
None => ()
11701170
}
11711171
word_space(s, ~"=>");
1172+
11721173
// Extract the expression from the extra block the parser adds
1173-
assert arm.body.node.view_items.is_empty();
1174-
assert arm.body.node.stmts.is_empty();
1175-
assert arm.body.node.rules == ast::default_blk;
1176-
match arm.body.node.expr {
1177-
Some(expr) => {
1178-
match expr.node {
1179-
ast::expr_block(blk) => {
1180-
// the block will close the pattern's ibox
1181-
print_block_unclosed_indent(s, blk, alt_indent_unit);
1182-
}
1183-
_ => {
1184-
end(s); // close the ibox for the pattern
1185-
print_expr(s, expr);
1186-
}
1187-
}
1188-
if !expr_is_simple_block(expr)
1189-
&& i < len - 1 {
1190-
word(s.s, ~",");
1174+
// in the case of foo => expr
1175+
if arm.body.node.view_items.is_empty() &&
1176+
arm.body.node.stmts.is_empty() &&
1177+
arm.body.node.rules == ast::default_blk &&
1178+
arm.body.node.expr.is_some()
1179+
{
1180+
match arm.body.node.expr {
1181+
Some(expr) => {
1182+
match expr.node {
1183+
ast::expr_block(blk) => {
1184+
// the block will close the pattern's ibox
1185+
print_block_unclosed_indent(
1186+
s, blk, alt_indent_unit);
1187+
}
1188+
_ => {
1189+
end(s); // close the ibox for the pattern
1190+
print_expr(s, expr);
1191+
}
1192+
}
1193+
if !expr_is_simple_block(expr)
1194+
&& i < len - 1 {
1195+
word(s.s, ~",");
1196+
}
1197+
end(s); // close enclosing cbox
1198+
}
1199+
None => fail
11911200
}
1192-
end(s); // close enclosing cbox
1193-
}
1194-
None => fail
1201+
} else {
1202+
// the block will close the pattern's ibox
1203+
print_block_unclosed_indent(s, arm.body, alt_indent_unit);
11951204
}
11961205
}
11971206
bclose_(s, expr.span, alt_indent_unit);

branches/incoming/src/rt/rust_upcall.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ extern "C" CDECL void
147147
upcall_s_exchange_malloc(s_exchange_malloc_args *args) {
148148
rust_task *task = args->task;
149149
LOG_UPCALL_ENTRY(task);
150-
LOG(task, mem, "upcall exchange malloc(0x%" PRIxPTR ")", args->td);
151150

152151
size_t total_size = get_box_size(args->size, args->td->align);
153152
// FIXME--does this have to be calloc? (Issue #2682)
@@ -159,6 +158,9 @@ upcall_s_exchange_malloc(s_exchange_malloc_args *args) {
159158
header->prev = 0;
160159
header->next = 0;
161160

161+
LOG(task, mem, "exchange malloced %p of size %" PRIuPTR,
162+
header, args->size);
163+
162164
args->retval = (uintptr_t)header;
163165
}
164166

@@ -187,6 +189,7 @@ extern "C" CDECL void
187189
upcall_s_exchange_free(s_exchange_free_args *args) {
188190
rust_task *task = args->task;
189191
LOG_UPCALL_ENTRY(task);
192+
LOG(task, mem, "exchange freed %p", args->ptr);
190193
task->kernel->free(args->ptr);
191194
}
192195

branches/incoming/src/rustc/lib/llvm.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,11 @@ extern mod llvm {
456456
ValueRef;
457457
fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) ->
458458
ValueRef;
459-
fn LLVMConstGEP(ConstantVal: ValueRef, ConstantIndices: *uint,
459+
fn LLVMConstGEP(ConstantVal: ValueRef,
460+
ConstantIndices: *ValueRef,
460461
NumIndices: c_uint) -> ValueRef;
461-
fn LLVMConstInBoundsGEP(ConstantVal: ValueRef, ConstantIndices: *uint,
462+
fn LLVMConstInBoundsGEP(ConstantVal: ValueRef,
463+
ConstantIndices: *ValueRef,
462464
NumIndices: c_uint) -> ValueRef;
463465
fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
464466
fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
@@ -493,10 +495,10 @@ extern mod llvm {
493495
fn LLVMConstShuffleVector(VectorAConstant: ValueRef,
494496
VectorBConstant: ValueRef,
495497
MaskConstant: ValueRef) -> ValueRef;
496-
fn LLVMConstExtractValue(AggConstant: ValueRef, IdxList: *uint,
498+
fn LLVMConstExtractValue(AggConstant: ValueRef, IdxList: *c_uint,
497499
NumIdx: c_uint) -> ValueRef;
498500
fn LLVMConstInsertValue(AggConstant: ValueRef,
499-
ElementValueConstant: ValueRef, IdxList: *uint,
501+
ElementValueConstant: ValueRef, IdxList: *c_uint,
500502
NumIdx: c_uint) -> ValueRef;
501503
fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char,
502504
Constraints: *c_char, HasSideEffects: Bool,

branches/incoming/src/rustc/middle/borrowck.rs

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ use syntax::visit;
220220
use syntax::ast_util;
221221
use syntax::ast_map;
222222
use syntax::codemap::span;
223-
use util::ppaux::{ty_to_str, region_to_str, explain_region};
223+
use util::ppaux::{ty_to_str, region_to_str, explain_region,
224+
note_and_explain_region};
224225
use std::map::{int_hash, hashmap, set};
225226
use std::list;
226227
use std::list::{List, Cons, Nil};
@@ -464,6 +465,7 @@ impl borrowck_ctxt {
464465
err.cmt.span,
465466
fmt!("illegal borrow: %s",
466467
self.bckerr_code_to_str(err.code)));
468+
self.note_and_explain_bckerr(err.code);
467469
}
468470

469471
fn span_err(s: span, m: ~str) {
@@ -488,37 +490,65 @@ impl borrowck_ctxt {
488490

489491
fn bckerr_code_to_str(code: bckerr_code) -> ~str {
490492
match code {
491-
err_mutbl(req, act) => {
492-
fmt!("creating %s alias to aliasable, %s memory",
493-
self.mut_to_str(req), self.mut_to_str(act))
494-
}
495-
err_mut_uniq => {
496-
~"unique value in aliasable, mutable location"
497-
}
498-
err_mut_variant => {
499-
~"enum variant in aliasable, mutable location"
500-
}
501-
err_root_not_permitted => {
502-
// note: I don't expect users to ever see this error
503-
// message, reasons are discussed in attempt_root() in
504-
// preserve.rs.
505-
~"rooting is not permitted"
506-
}
507-
err_out_of_root_scope(super_scope, sub_scope) => {
508-
fmt!("managed value would have to be rooted for %s, \
509-
but can only be rooted for %s",
510-
explain_region(self.tcx, sub_scope),
511-
explain_region(self.tcx, super_scope))
512-
}
513-
err_out_of_scope(super_scope, sub_scope) => {
514-
fmt!("borrowed pointer must be valid for %s, \
515-
but the borrowed value is only valid for %s",
516-
explain_region(self.tcx, sub_scope),
517-
explain_region(self.tcx, super_scope))
493+
err_mutbl(req, act) => {
494+
fmt!("creating %s alias to aliasable, %s memory",
495+
self.mut_to_str(req), self.mut_to_str(act))
496+
}
497+
err_mut_uniq => {
498+
~"unique value in aliasable, mutable location"
499+
}
500+
err_mut_variant => {
501+
~"enum variant in aliasable, mutable location"
502+
}
503+
err_root_not_permitted => {
504+
// note: I don't expect users to ever see this error
505+
// message, reasons are discussed in attempt_root() in
506+
// preserve.rs.
507+
~"rooting is not permitted"
508+
}
509+
err_out_of_root_scope(*) => {
510+
~"cannot root managed value long enough"
511+
}
512+
err_out_of_scope(*) => {
513+
~"borrowed value does not live long enough"
514+
}
515+
}
516+
}
517+
518+
fn note_and_explain_bckerr(code: bckerr_code) {
519+
match code {
520+
err_mutbl(*) | err_mut_uniq | err_mut_variant |
521+
err_root_not_permitted => {}
522+
523+
err_out_of_root_scope(super_scope, sub_scope) => {
524+
note_and_explain_region(
525+
self.tcx,
526+
~"managed value would have to be rooted for ",
527+
sub_scope,
528+
~"...");
529+
note_and_explain_region(
530+
self.tcx,
531+
~"...but can only be rooted for ",
532+
super_scope,
533+
~"");
534+
}
535+
536+
err_out_of_scope(super_scope, sub_scope) => {
537+
note_and_explain_region(
538+
self.tcx,
539+
~"borrowed pointer must be valid for ",
540+
sub_scope,
541+
~"...");
542+
note_and_explain_region(
543+
self.tcx,
544+
~"...but borrowed value is only valid for ",
545+
super_scope,
546+
~"");
518547
}
519548
}
520549
}
521550

551+
522552
fn cmt_to_str(cmt: cmt) -> ~str {
523553
let mc = &mem_categorization_ctxt {tcx: self.tcx,
524554
method_map: self.method_map};

branches/incoming/src/rustc/middle/borrowck/check_loans.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ impl check_loan_ctxt {
423423
e.cmt.span,
424424
fmt!("illegal borrow unless pure: %s",
425425
self.bccx.bckerr_code_to_str(e.code)));
426+
self.bccx.note_and_explain_bckerr(e.code);
426427
self.tcx().sess.span_note(
427428
sp,
428429
fmt!("impure due to %s", msg));
@@ -484,10 +485,14 @@ impl check_loan_ctxt {
484485
// when there is an outstanding loan. In that case, it is not
485486
// safe to consider the use a last_use.
486487
fn check_last_use(expr: @ast::expr) {
488+
debug!("Checking last use of expr %?", expr.id);
487489
let cmt = self.bccx.cat_expr(expr);
488490
let lp = match cmt.lp {
489-
None => return,
490-
Some(lp) => lp
491+
None => {
492+
debug!("Not a loanable expression");
493+
return;
494+
}
495+
Some(lp) => lp
491496
};
492497
for self.walk_loans_of(cmt.id, lp) |_loan| {
493498
debug!("Removing last use entry %? due to outstanding loan",
@@ -592,6 +597,9 @@ fn check_loans_in_local(local: @ast::local,
592597
fn check_loans_in_expr(expr: @ast::expr,
593598
&&self: check_loan_ctxt,
594599
vt: visit::vt<check_loan_ctxt>) {
600+
debug!("check_loans_in_expr(expr=%?/%s)",
601+
expr.id, pprust::expr_to_str(expr, self.tcx().sess.intr()));
602+
595603
self.check_for_conflicting_loans(expr.id);
596604

597605
match expr.node {

0 commit comments

Comments
 (0)