Skip to content

Commit 1711c2d

Browse files
committed
---
yaml --- r: 59033 b: refs/heads/incoming c: 0cde8ba h: refs/heads/master i: 59031: 58a0b8d v: v3
1 parent 60de6b0 commit 1711c2d

File tree

4 files changed

+31
-48
lines changed

4 files changed

+31
-48
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 9042e1e8de522ffa48ce6a543130bc72ea04d517
9+
refs/heads/incoming: 0cde8ba684e738fa71ce62d691ba2886776e49f9
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/librustc/metadata/encoder.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -363,47 +363,6 @@ fn encode_path(ecx: @EncodeContext,
363363
ebml_w.end_tag();
364364
}
365365

366-
fn encode_reexported_static_method(ecx: @EncodeContext,
367-
ebml_w: &mut writer::Encoder,
368-
exp: &middle::resolve::Export2,
369-
m: @ty::method) {
370-
debug!("(encode static trait method) reexport '%s::%s'",
371-
*exp.name, *ecx.tcx.sess.str_of(m.ident));
372-
ebml_w.start_tag(tag_items_data_item_reexport);
373-
ebml_w.start_tag(tag_items_data_item_reexport_def_id);
374-
ebml_w.wr_str(def_to_str(m.def_id));
375-
ebml_w.end_tag();
376-
ebml_w.start_tag(tag_items_data_item_reexport_name);
377-
ebml_w.wr_str(*exp.name + "::" + *ecx.tcx.sess.str_of(m.ident));
378-
ebml_w.end_tag();
379-
ebml_w.end_tag();
380-
}
381-
382-
fn encode_reexported_static_methods(ecx: @EncodeContext,
383-
ebml_w: &mut writer::Encoder,
384-
mod_path: &[ast_map::path_elt],
385-
exp: &middle::resolve::Export2) {
386-
match ecx.tcx.trait_methods_cache.find(&exp.def_id) {
387-
Some(methods) => {
388-
match ecx.tcx.items.find(&exp.def_id.node) {
389-
Some(&ast_map::node_item(_, path)) => {
390-
if mod_path != *path {
391-
for methods.each |&m| {
392-
if m.self_ty == ast::sty_static {
393-
encode_reexported_static_method(ecx,
394-
ebml_w,
395-
exp, m);
396-
}
397-
}
398-
}
399-
}
400-
_ => {}
401-
}
402-
}
403-
_ => {}
404-
}
405-
}
406-
407366
fn encode_info_for_mod(ecx: @EncodeContext,
408367
ebml_w: &mut writer::Encoder,
409368
md: &_mod,
@@ -454,7 +413,6 @@ fn encode_info_for_mod(ecx: @EncodeContext,
454413
ebml_w.wr_str(*exp.name);
455414
ebml_w.end_tag();
456415
ebml_w.end_tag();
457-
encode_reexported_static_methods(ecx, ebml_w, path, exp);
458416
}
459417
}
460418
None => {

branches/incoming/src/librustc/middle/trans/callee.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,14 @@ pub fn trans_call_inner(in_cx: block,
550550
// drop the value if it is not being saved.
551551
unsafe {
552552
if llvm::LLVMIsUndef(llretslot) != lib::llvm::True {
553-
if ty::type_is_immediate(ret_ty) {
553+
if ty::type_is_nil(ret_ty) {
554+
// When implementing the for-loop sugar syntax, the
555+
// type of the for-loop is nil, but the function
556+
// it's invoking returns a bool. This is a special
557+
// case to ignore instead of invoking the Store
558+
// below into a scratch pointer of a mismatched
559+
// type.
560+
} else if ty::type_is_immediate(ret_ty) {
554561
let llscratchptr = alloc_ty(bcx, ret_ty);
555562
Store(bcx, llresult, llscratchptr);
556563
bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);

branches/incoming/src/librustc/middle/typeck/check/mod.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,26 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
12941294
// The callee checks for bot / err, we don't need to
12951295
}
12961296

1297+
fn write_call(fcx: @mut FnCtxt,
1298+
call_expr: @ast::expr,
1299+
output: ty::t,
1300+
sugar: ast::CallSugar) {
1301+
let ret_ty = match sugar {
1302+
ast::ForSugar => {
1303+
match ty::get(output).sty {
1304+
ty::ty_bool => {}
1305+
_ => fcx.type_error_message(call_expr.span, |actual| {
1306+
fmt!("expected `for` closure to return `bool`, \
1307+
but found `%s`", actual) },
1308+
output, None)
1309+
}
1310+
ty::mk_nil()
1311+
}
1312+
_ => output
1313+
};
1314+
fcx.write_ty(call_expr.id, ret_ty);
1315+
}
1316+
12971317
// A generic function for doing all of the checking for call expressions
12981318
fn check_call(fcx: @mut FnCtxt,
12991319
call_expr: @ast::expr,
@@ -1344,8 +1364,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
13441364
check_argument_types(fcx, call_expr.span, fn_sig.inputs, f,
13451365
args, sugar, DontDerefArgs);
13461366

1347-
// Pull the return type out of the type of the function.
1348-
fcx.write_ty(call_expr.id, fn_sig.output);
1367+
write_call(fcx, call_expr, fn_sig.output, sugar);
13491368
}
13501369

13511370
// Checks a method call.
@@ -1401,8 +1420,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
14011420
fn_ty, expr, args, sugar,
14021421
DontDerefArgs);
14031422

1404-
// Pull the return type out of the type of the function.
1405-
fcx.write_ty(expr.id, ret_ty);
1423+
write_call(fcx, expr, ret_ty, sugar);
14061424
}
14071425

14081426
// A generic function for checking the then and else in an if

0 commit comments

Comments
 (0)