Skip to content

Commit b2a1cf0

Browse files
committed
---
yaml --- r: 39197 b: refs/heads/incoming c: b6f1e30 h: refs/heads/master i: 39195: e5f87f3 v: v3
1 parent d0d4614 commit b2a1cf0

Some content is hidden

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

63 files changed

+915
-347
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 05e51e6f7f4f70ede2164e8da325f60c64f79616
9+
refs/heads/incoming: b6f1e3084fccac7bada780f285ea048ec8a56521
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/AUTHORS.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Aleksander Balicki <[email protected]>
1010
Alex Rønne Petersen <[email protected]>
1111
Alexander Stavonin <[email protected]>
1212
Andreas Gal <[email protected]>
13+
Andrew Dunham <[email protected]>
1314
Andrew Paseltiner <[email protected]>
1415
Arkaitz Jimenez <[email protected]>
1516
Armin Ronacher <[email protected]>
@@ -21,6 +22,7 @@ Benjamin Herr <[email protected]>
2122
Benjamin Jackman <[email protected]>
2223
Benjamin Kircher <[email protected]>
2324
Benjamin Peterson <[email protected]>
25+
Bilal Husain <[email protected]>
2426
Brendan Eich <[email protected]>
2527
Brian Anderson <[email protected]>
2628
Brian J. Burg <[email protected]>

branches/incoming/mk/clean.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ clean$(1)_T_$(2)_H_$(3):
110110
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM)
111111
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
112112
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
113+
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass*
113114
endef
114115

115116
$(foreach host, $(CFG_TARGET_TRIPLES), \

branches/incoming/src/README.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ This is a preliminary version of the Rust compiler, libraries and tools
22

33
Source layout:
44

5-
rustc/ The self-hosted compiler
5+
librustc/ The self-hosted compiler
66

77
libcore/ The core library (imported and linked by default)
88
libstd/ The standard library (slightly more peripheral code)
@@ -28,18 +28,18 @@ test/auxiliary - Dependencies of tests
2828

2929
compiletest/ The test runner
3030

31-
cargo/ The package manager
31+
libcargo/ The package manager
3232

33-
rusti/ The JIT REPL
33+
librusti/ The JIT REPL
3434

35-
rustdoc/ The Rust API documentation tool
35+
librustdoc/ The Rust API documentation tool
3636

3737
llvm/ The LLVM submodule
3838

3939
libuv/ The libuv submodule
4040

4141
rustllvm/ LLVM support code
4242

43-
fuzzer/ A collection of fuzz testers
43+
libfuzzer/ A collection of fuzz testers
4444

4545
etc/ Scripts, editor support, misc

branches/incoming/src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ pub mod fsync {
10471047
option::None => (),
10481048
option::Some(level) => {
10491049
// fail hard if not succesful
1050-
assert(self.arg.fsync_fn(self.arg.val, level) != -1);
1050+
assert((self.arg.fsync_fn)(self.arg.val, level) != -1);
10511051
}
10521052
}
10531053
}

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ extern mod llvm {
312312
fn LLVMStructType(ElementTypes: *TypeRef, ElementCount: c_uint,
313313
Packed: Bool) -> TypeRef;
314314
fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
315-
fn LLVMGetStructElementTypes(StructTy: TypeRef, Dest: *TypeRef);
315+
fn LLVMGetStructElementTypes(StructTy: TypeRef, Dest: *mut TypeRef);
316316
fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
317317

318318
/* Operations on array, pointer, and vector types (sequence types) */
@@ -1123,10 +1123,9 @@ fn type_to_str_inner(names: type_names, outer0: ~[TypeRef], ty: TypeRef) ->
11231123
Struct => {
11241124
let mut s: ~str = ~"{";
11251125
let n_elts = llvm::LLVMCountStructElementTypes(ty) as uint;
1126-
let elts = vec::from_elem(n_elts, 0 as TypeRef);
1127-
unsafe {
1128-
llvm::LLVMGetStructElementTypes(ty, vec::raw::to_ptr(elts));
1129-
}
1126+
let mut elts = vec::from_elem(n_elts, 0 as TypeRef);
1127+
llvm::LLVMGetStructElementTypes(ty,
1128+
ptr::to_mut_unsafe_ptr(&mut elts[0]));
11301129
s += tys_str(names, outer, elts);
11311130
s += ~"}";
11321131
return s;
@@ -1179,6 +1178,18 @@ fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] unsafe {
11791178
return args;
11801179
}
11811180

1181+
fn struct_element_types(struct_ty: TypeRef) -> ~[TypeRef] {
1182+
unsafe {
1183+
let count = llvm::LLVMCountStructElementTypes(struct_ty);
1184+
let mut buf: ~[TypeRef] =
1185+
vec::from_elem(count as uint,
1186+
cast::transmute::<uint,TypeRef>(0));
1187+
llvm::LLVMGetStructElementTypes(struct_ty,
1188+
ptr::to_mut_unsafe_ptr(&mut buf[0]));
1189+
return move buf;
1190+
}
1191+
}
1192+
11821193

11831194
/* Memory-managed interface to target data. */
11841195

branches/incoming/src/librustc/middle/astencode.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ fn serialize_method_map_entry(ecx: @e::encode_ctxt,
451451
do ebml_w.emit_field(~"self_arg", 0u) {
452452
ebml_w.emit_arg(ecx, mme.self_arg);
453453
}
454+
do ebml_w.emit_field(~"explicit_self", 2u) {
455+
mme.explicit_self.serialize(&ebml_w);
456+
}
454457
do ebml_w.emit_field(~"origin", 1u) {
455458
mme.origin.serialize(&ebml_w);
456459
}
@@ -464,6 +467,11 @@ impl Reader::Deserializer: read_method_map_entry_helper {
464467
self.read_field(~"self_arg", 0u, || {
465468
self.read_arg(xcx)
466469
}),
470+
explicit_self:
471+
self.read_field(~"explicit_self", 2u, || {
472+
let self_type: ast::self_ty_ = deserialize(&self);
473+
self_type
474+
}),
467475
origin:
468476
self.read_field(~"origin", 1u, || {
469477
let method_origin: method_origin = deserialize(&self);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,9 @@ fn check_loans_in_expr(expr: @ast::expr,
646646
ast::expr_call(f, args, _) => {
647647
self.check_call(expr, Some(f), f.id, f.span, args);
648648
}
649+
ast::expr_method_call(_, _, _, args, _) => {
650+
self.check_call(expr, None, expr.callee_id, expr.span, args);
651+
}
649652
ast::expr_index(_, rval) |
650653
ast::expr_binary(_, _, rval)
651654
if self.bccx.method_map.contains_key(expr.id) => {

branches/incoming/src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,38 @@ fn req_loans_in_expr(ex: @ast::expr,
125125
visit::visit_expr(ex, self, vt);
126126
}
127127

128+
ast::expr_method_call(rcvr, _, _, args, _) => {
129+
let arg_tys = ty::ty_fn_args(ty::node_id_to_type(self.tcx(),
130+
ex.callee_id));
131+
let scope_r = ty::re_scope(ex.id);
132+
for vec::each2(args, arg_tys) |arg, arg_ty| {
133+
match ty::resolved_mode(self.tcx(), arg_ty.mode) {
134+
ast::by_ref => {
135+
let arg_cmt = self.bccx.cat_expr(*arg);
136+
self.guarantee_valid(arg_cmt, m_imm, scope_r);
137+
}
138+
ast::by_val | ast::by_move | ast::by_copy => {}
139+
}
140+
}
141+
142+
match self.bccx.method_map.find(ex.id) {
143+
Some(method_map_entry) => {
144+
match method_map_entry.explicit_self {
145+
ast::sty_by_ref => {
146+
let rcvr_cmt = self.bccx.cat_expr(rcvr);
147+
self.guarantee_valid(rcvr_cmt, m_imm, scope_r);
148+
}
149+
_ => {} // Nothing to do.
150+
}
151+
}
152+
None => {
153+
self.tcx().sess.span_bug(ex.span, ~"no method map entry");
154+
}
155+
}
156+
157+
visit::visit_expr(ex, self, vt);
158+
}
159+
128160
ast::expr_match(ex_v, arms) => {
129161
let cmt = self.bccx.cat_expr(ex_v);
130162
for arms.each |arm| {

branches/incoming/src/librustc/middle/check_const.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,37 @@ fn check_expr(sess: Session, def_map: resolve::DefMap,
9494
}
9595
match def_map.find(e.id) {
9696
Some(def_const(def_id)) |
97-
Some(def_fn(def_id, _)) => {
97+
Some(def_fn(def_id, _)) |
98+
Some(def_variant(_, def_id)) |
99+
Some(def_class(def_id)) => {
98100
if !ast_util::is_local(def_id) {
99101
sess.span_err(
100102
e.span, ~"paths in constants may only refer to \
101-
crate-local constants or functions");
103+
crate-local constants, functions, or \
104+
structs");
102105
}
103106
}
104-
_ => {
107+
Some(def) => {
108+
debug!("(checking const) found bad def: %?", def);
105109
sess.span_err(
106110
e.span,
107-
~"paths in constants may only refer to \
108-
constants or functions");
111+
fmt!("paths in constants may only refer to \
112+
constants or functions"));
109113
}
114+
None => {
115+
sess.span_bug(e.span, ~"unbound path in const?!");
116+
}
117+
}
118+
}
119+
expr_call(callee, _, false) => {
120+
match def_map.find(callee.id) {
121+
Some(def_class(*)) => {} // OK.
122+
_ => {
123+
sess.span_err(
124+
e.span,
125+
~"function calls in constants are limited to \
126+
structure constructors");
127+
}
110128
}
111129
}
112130
expr_paren(e) => { check_expr(sess, def_map, method_map,

branches/incoming/src/librustc/middle/kind.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
239239
debug!("kind::check_expr(%s)", expr_to_str(e, cx.tcx.sess.intr()));
240240
let id_to_use = match e.node {
241241
expr_index(*)|expr_assign_op(*)|
242-
expr_unary(*)|expr_binary(*) => e.callee_id,
242+
expr_unary(*)|expr_binary(*)|expr_method_call(*) => e.callee_id,
243243
_ => e.id
244244
};
245245

@@ -339,6 +339,18 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
339339
}
340340
}
341341
}
342+
expr_method_call(_, _, _, args, _) => {
343+
for ty::ty_fn_args(ty::node_id_to_type(cx.tcx, e.callee_id)).eachi
344+
|i, arg_t| {
345+
match ty::arg_mode(cx.tcx, *arg_t) {
346+
by_copy => maybe_copy(cx, args[i],
347+
Some(("function arguments must be copyable",
348+
"try changing the function to take a \
349+
reference instead"))),
350+
by_ref | by_val | by_move => ()
351+
}
352+
}
353+
}
342354
expr_field(lhs, _, _) => {
343355
// If this is a method call with a by-val argument, we need
344356
// to check the copy

branches/incoming/src/librustc/middle/liveness.rs

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ fn visit_expr(expr: @expr, &&self: @IrMaps, vt: vt<@IrMaps>) {
550550

551551
// otherwise, live nodes are not required:
552552
expr_index(*) | expr_field(*) | expr_vstore(*) |
553-
expr_vec(*) | expr_rec(*) | expr_call(*) | expr_tup(*) |
554-
expr_log(*) | expr_binary(*) |
553+
expr_vec(*) | expr_rec(*) | expr_call(*) | expr_method_call(*) |
554+
expr_tup(*) | expr_log(*) | expr_binary(*) |
555555
expr_assert(*) | expr_addr_of(*) | expr_copy(*) |
556556
expr_loop_body(*) | expr_do_body(*) | expr_cast(*) |
557557
expr_unary(*) | expr_fail(*) |
@@ -1237,6 +1237,17 @@ impl Liveness {
12371237
self.propagate_through_expr(f, succ)
12381238
}
12391239

1240+
expr_method_call(rcvr, _, _, args, _) => {
1241+
// calling a method with bot return type means that the method
1242+
// will fail, and hence the successors can be ignored
1243+
let t_ret = ty::ty_fn_ret(ty::node_id_to_type(self.tcx,
1244+
expr.callee_id));
1245+
let succ = if ty::type_is_bot(t_ret) {self.s.exit_ln}
1246+
else {succ};
1247+
let succ = self.propagate_through_exprs(args, succ);
1248+
self.propagate_through_expr(rcvr, succ)
1249+
}
1250+
12401251
expr_tup(exprs) => {
12411252
self.propagate_through_exprs(exprs, succ)
12421253
}
@@ -1486,6 +1497,26 @@ fn check_arm(arm: arm, &&self: @Liveness, vt: vt<@Liveness>) {
14861497
visit::visit_arm(arm, self, vt);
14871498
}
14881499

1500+
fn check_call(args: &[@expr],
1501+
targs: &[ty::arg],
1502+
&&self: @Liveness) {
1503+
for vec::each2(args, targs) |arg_expr, arg_ty| {
1504+
match ty::resolved_mode(self.tcx, arg_ty.mode) {
1505+
by_val | by_copy | by_ref => {}
1506+
by_move => {
1507+
if ty::expr_is_lval(self.tcx, self.ir.method_map, *arg_expr) {
1508+
// Probably a bad error message (what's an rvalue?)
1509+
// but I can't think of anything better
1510+
self.tcx.sess.span_err(arg_expr.span,
1511+
fmt!("move mode argument must be an rvalue: try (move \
1512+
%s) instead",
1513+
expr_to_str(*arg_expr, self.tcx.sess.intr())));
1514+
}
1515+
}
1516+
}
1517+
}
1518+
}
1519+
14891520
fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
14901521
match expr.node {
14911522
expr_path(_) => {
@@ -1531,23 +1562,14 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
15311562

15321563
expr_call(f, args, _) => {
15331564
let targs = ty::ty_fn_args(ty::expr_ty(self.tcx, f));
1534-
for vec::each2(args, targs) |arg_expr, arg_ty| {
1535-
match ty::resolved_mode(self.tcx, arg_ty.mode) {
1536-
by_val | by_copy | by_ref => {}
1537-
by_move => {
1538-
if ty::expr_is_lval(self.tcx, self.ir.method_map,
1539-
*arg_expr) {
1540-
// Probably a bad error message (what's an rvalue?)
1541-
// but I can't think of anything better
1542-
self.tcx.sess.span_err(arg_expr.span,
1543-
fmt!("Move mode argument must be an rvalue: try \
1544-
(move %s) instead", expr_to_str(*arg_expr,
1545-
self.tcx.sess.intr())));
1546-
}
1547-
}
1548-
}
1549-
}
1565+
check_call(args, targs, self);
1566+
visit::visit_expr(expr, self, vt);
1567+
}
15501568

1569+
expr_method_call(_, _, _, args, _) => {
1570+
let targs = ty::ty_fn_args(ty::node_id_to_type(self.tcx,
1571+
expr.callee_id));
1572+
check_call(args, targs, self);
15511573
visit::visit_expr(expr, self, vt);
15521574
}
15531575

branches/incoming/src/librustc/middle/mem_categorization.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ impl &mem_categorization_ctxt {
530530
ast::expr_swap(*) | ast::expr_assign(*) |
531531
ast::expr_assign_op(*) | ast::expr_fn(*) | ast::expr_fn_block(*) |
532532
ast::expr_assert(*) | ast::expr_ret(*) |
533-
ast::expr_loop_body(*) | ast::expr_do_body(*) | ast::expr_unary(*) |
533+
ast::expr_loop_body(*) | ast::expr_do_body(*) |
534+
ast::expr_unary(*) | ast::expr_method_call(*) |
534535
ast::expr_copy(*) | ast::expr_cast(*) | ast::expr_fail(*) |
535536
ast::expr_vstore(*) | ast::expr_vec(*) | ast::expr_tup(*) |
536537
ast::expr_if(*) | ast::expr_log(*) |

0 commit comments

Comments
 (0)