Skip to content

Commit 43218ab

Browse files
committed
---
yaml --- r: 63117 b: refs/heads/snap-stage3 c: 8db1d2c h: refs/heads/master i: 63115: ca91601 v: v3
1 parent 68540d6 commit 43218ab

File tree

10 files changed

+39
-57
lines changed

10 files changed

+39
-57
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a99ba1180d16394427fcd0fa74ce6dfff96d5566
4+
refs/heads/snap-stage3: 8db1d2cdde6fafdd396d2ce5c5994492d5bcf8cb
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/tutorial.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,10 +1442,15 @@ call_closure_with_ten(closure);
14421442
~~~~
14431443

14441444
Closures begin with the argument list between vertical bars and are followed by
1445-
a single expression. The types of the arguments are generally omitted,
1446-
as is the return type, because the compiler can almost always infer
1447-
them. In the rare case where the compiler needs assistance, though, the
1448-
arguments and return types may be annotated.
1445+
a single expression. Remember that a block, `{ <expr1>; <expr2>; ... }`, is
1446+
considered a single expression: it evaluates to the result of the last
1447+
expression it contains if that expression is not followed by a semicolon,
1448+
otherwise the block evaluates to `()`.
1449+
1450+
The types of the arguments are generally omitted, as is the return type,
1451+
because the compiler can almost always infer them. In the rare case where the
1452+
compiler needs assistance, though, the arguments and return types may be
1453+
annotated.
14491454

14501455
~~~~
14511456
let square = |x: int| -> uint { x * x as uint };

branches/snap-stage3/mk/rt.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
211211
endif
212212

213213
$$(JEMALLOC_LIB_$(1)_$(2)):
214-
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure --disable-experimental
214+
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
215+
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1)
215216
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
216217

217218
# These could go in rt.mk or rustllvm.mk, they're needed for both.

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,17 +3042,15 @@ pub fn adjust_ty(cx: ctxt,
30423042
Some(@AutoDerefRef(ref adj)) => {
30433043
let mut adjusted_ty = unadjusted_ty;
30443044

3045-
if (!ty::type_is_error(adjusted_ty)) {
3046-
for uint::range(0, adj.autoderefs) |i| {
3047-
match ty::deref(cx, adjusted_ty, true) {
3048-
Some(mt) => { adjusted_ty = mt.ty; }
3049-
None => {
3050-
cx.sess.span_bug(
3051-
span,
3052-
fmt!("The %uth autoderef failed: %s",
3053-
i, ty_to_str(cx,
3054-
adjusted_ty)));
3055-
}
3045+
for uint::range(0, adj.autoderefs) |i| {
3046+
match ty::deref(cx, adjusted_ty, true) {
3047+
Some(mt) => { adjusted_ty = mt.ty; }
3048+
None => {
3049+
cx.sess.span_bug(
3050+
span,
3051+
fmt!("The %uth autoderef failed: %s",
3052+
i, ty_to_str(cx,
3053+
adjusted_ty)));
30563054
}
30573055
}
30583056
}

branches/snap-stage3/src/librustc/middle/typeck/check/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2728,8 +2728,13 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
27282728
});
27292729
let mut bot_field = false;
27302730
let mut err_field = false;
2731+
27312732
let elt_ts = do elts.mapi |i, e| {
2732-
check_expr_with_opt_hint(fcx, *e, flds.map(|fs| fs[i]));
2733+
let opt_hint = match flds {
2734+
Some(ref fs) if i < fs.len() => Some(fs[i]),
2735+
_ => None
2736+
};
2737+
check_expr_with_opt_hint(fcx, *e, opt_hint);
27332738
let t = fcx.expr_ty(*e);
27342739
err_field = err_field || ty::type_is_error(t);
27352740
bot_field = bot_field || ty::type_is_bot(t);

branches/snap-stage3/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,6 @@ fn constrain_call(rcx: @mut Rcx,
460460
debug!("constrain_call(call_expr=%s, implicitly_ref_args=%?)",
461461
call_expr.repr(tcx), implicitly_ref_args);
462462
let callee_ty = rcx.resolve_node_type(callee_id);
463-
if ty::type_is_error(callee_ty) {
464-
// Bail, as function type is unknown
465-
return;
466-
}
467463
let fn_sig = ty::ty_fn_sig(callee_ty);
468464

469465
// `callee_region` is the scope representing the time in which the
@@ -1112,12 +1108,6 @@ pub mod guarantor {
11121108
-> ExprCategorizationType {
11131109
let mut ct = ct;
11141110
let tcx = rcx.fcx.ccx.tcx;
1115-
1116-
if (ty::type_is_error(ct.ty)) {
1117-
ct.cat.pointer = NotPointer;
1118-
return ct;
1119-
}
1120-
11211111
for uint::range(0, autoderefs) |_| {
11221112
ct.cat.guarantor = guarantor_of_deref(&ct.cat);
11231113

branches/snap-stage3/src/libsyntax/parse/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ pub fn gather_comments_and_literals(span_diagnostic:
347347
}
348348

349349

350-
let bstart = rdr.pos;
350+
let bstart = rdr.last_pos;
351351
rdr.next_token();
352352
//discard, and look ahead; we're working with internal state
353353
let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();

branches/snap-stage3/src/libsyntax/parse/lexer.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,20 @@ fn string_advance_token(r: @mut StringReader) {
161161
}
162162
}
163163

164-
fn byte_offset(rdr: &StringReader) -> BytePos {
165-
(rdr.pos - rdr.filemap.start_pos)
164+
fn byte_offset(rdr: &StringReader, pos: BytePos) -> BytePos {
165+
(pos - rdr.filemap.start_pos)
166166
}
167167

168168
pub fn get_str_from(rdr: @mut StringReader, start: BytePos) -> ~str {
169-
// I'm pretty skeptical about this subtraction. What if there's a
170-
// multi-byte character before the mark?
171-
return str::slice(*rdr.src, start.to_uint() - 1u,
172-
byte_offset(rdr).to_uint() - 1u).to_owned();
169+
return str::slice(*rdr.src, start.to_uint(),
170+
byte_offset(rdr, rdr.last_pos).to_uint()).to_owned();
173171
}
174172

175173
// EFFECT: advance the StringReader by one character. If a newline is
176174
// discovered, add it to the FileMap's list of line start offsets.
177175
pub fn bump(rdr: &mut StringReader) {
178176
rdr.last_pos = rdr.pos;
179-
let current_byte_offset = byte_offset(rdr).to_uint();;
177+
let current_byte_offset = byte_offset(rdr, rdr.pos).to_uint();
180178
if current_byte_offset < (*rdr.src).len() {
181179
assert!(rdr.curr != -1 as char);
182180
let last_char = rdr.curr;
@@ -202,7 +200,7 @@ pub fn is_eof(rdr: @mut StringReader) -> bool {
202200
rdr.curr == -1 as char
203201
}
204202
pub fn nextch(rdr: @mut StringReader) -> char {
205-
let offset = byte_offset(rdr).to_uint();
203+
let offset = byte_offset(rdr, rdr.pos).to_uint();
206204
if offset < (*rdr.src).len() {
207205
return str::char_at(*rdr.src, offset);
208206
} else { return -1 as char; }
@@ -692,7 +690,7 @@ fn next_token_inner(rdr: @mut StringReader) -> token::Token {
692690
return token::LIT_INT(c2 as i64, ast::ty_char);
693691
}
694692
'"' => {
695-
let n = byte_offset(rdr);
693+
let n = byte_offset(rdr, rdr.last_pos);
696694
bump(rdr);
697695
while rdr.curr != '"' {
698696
if is_eof(rdr) {

branches/snap-stage3/src/test/compile-fail/unconstrained-none.rs renamed to branches/snap-stage3/src/test/compile-fail/tuple-arity-mismatch.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Issue #5062
11+
// Issue #6155
12+
13+
fn first((value, _): (int, float)) -> int { value }
1214

1315
fn main() {
14-
fmt!("%?", None); //~ ERROR cannot determine a type for this expression: unconstrained type
16+
let y = first ((1,2,3)); //~ ERROR expected a tuple with 2 elements but found one with 3 elements
1517
}

branches/snap-stage3/src/test/compile-fail/unconstrained-ref.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)