Skip to content

Commit 355bc18

Browse files
committed
---
yaml --- r: 151020 b: refs/heads/try2 c: 16a5b31 h: refs/heads/master v: v3
1 parent 251c346 commit 355bc18

File tree

8 files changed

+189
-128
lines changed

8 files changed

+189
-128
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: 70f3409875be7c2d0f9d48092eb98f11ee734378
8+
refs/heads/try2: 16a5b3127a97424108180a79dcd4cd53a5646e24
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/ty.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,7 +2216,9 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
22162216
} else if Some(did) == cx.lang_items.no_share_bound() {
22172217
tc | TC::ReachesNoShare
22182218
} else if Some(did) == cx.lang_items.unsafe_type() {
2219-
tc | TC::InteriorUnsafe
2219+
// FIXME(#13231): This shouldn't be needed after
2220+
// opt-in built-in bounds are implemented.
2221+
(tc | TC::InteriorUnsafe) - TC::Nonsharable
22202222
} else {
22212223
tc
22222224
}
@@ -3323,6 +3325,13 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> ~str {
33233325
}
33243326
}
33253327

3328+
fn tstore_to_closure(s: &TraitStore) -> ~str {
3329+
match s {
3330+
&UniqTraitStore => "proc".to_owned(),
3331+
&RegionTraitStore(..) => "closure".to_owned()
3332+
}
3333+
}
3334+
33263335
match *err {
33273336
terr_mismatch => "types differ".to_owned(),
33283337
terr_fn_style_mismatch(values) => {
@@ -3338,9 +3347,9 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> ~str {
33383347
values.expected.to_str(), values.found.to_str())
33393348
}
33403349
terr_sigil_mismatch(values) => {
3341-
format!("expected {} closure, found {} closure",
3342-
values.expected.to_str(),
3343-
values.found.to_str())
3350+
format!("expected {}, found {}",
3351+
tstore_to_closure(&values.expected),
3352+
tstore_to_closure(&values.found))
33443353
}
33453354
terr_mutability => "values differ in mutability".to_owned(),
33463355
terr_box_mutability => "boxed values differ in mutability".to_owned(),

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

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,6 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
21822182
let expected_sty = unpack_expected(fcx,
21832183
expected,
21842184
|x| Some((*x).clone()));
2185-
let error_happened = false;
21862185
let (expected_sig,
21872186
expected_onceness,
21882187
expected_bounds) = {
@@ -2192,7 +2191,24 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
21922191
replace_late_bound_regions_in_fn_sig(
21932192
tcx, &cenv.sig,
21942193
|_| fcx.inh.infcx.fresh_bound_region(expr.id));
2195-
(Some(sig), cenv.onceness, cenv.bounds)
2194+
let onceness = match (&store, &cenv.store) {
2195+
// As the closure type and onceness go, only three
2196+
// combinations are legit:
2197+
// once closure
2198+
// many closure
2199+
// once proc
2200+
// If the actual and expected closure type disagree with
2201+
// each other, set expected onceness to be always Once or
2202+
// Many according to the actual type. Otherwise, it will
2203+
// yield either an illegal "many proc" or a less known
2204+
// "once closure" in the error message.
2205+
(&ty::UniqTraitStore, &ty::UniqTraitStore) |
2206+
(&ty::RegionTraitStore(..), &ty::RegionTraitStore(..)) =>
2207+
cenv.onceness,
2208+
(&ty::UniqTraitStore, _) => ast::Once,
2209+
(&ty::RegionTraitStore(..), _) => ast::Many,
2210+
};
2211+
(Some(sig), onceness, cenv.bounds)
21962212
}
21972213
_ => {
21982214
// Not an error! Means we're inferring the closure type
@@ -2218,23 +2234,9 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
22182234
store,
22192235
decl,
22202236
expected_sig);
2221-
2222-
let fty_sig;
2223-
let fty = if error_happened {
2224-
fty_sig = FnSig {
2225-
binder_id: ast::CRATE_NODE_ID,
2226-
inputs: fn_ty.sig.inputs.iter().map(|_| ty::mk_err()).collect(),
2227-
output: ty::mk_err(),
2228-
variadic: false
2229-
};
2230-
ty::mk_err()
2231-
} else {
2232-
fty_sig = fn_ty.sig.clone();
2233-
ty::mk_closure(tcx, fn_ty.clone())
2234-
};
2235-
2236-
debug!("check_expr_fn_with_unifier fty={}",
2237-
fcx.infcx().ty_to_str(fty));
2237+
let fty_sig = fn_ty.sig.clone();
2238+
let fty = ty::mk_closure(tcx, fn_ty);
2239+
debug!("check_expr_fn fty={}", fcx.infcx().ty_to_str(fty));
22382240

22392241
fcx.write_ty(expr.id, fty);
22402242

branches/try2/src/librustuv/net.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,14 @@ impl TcpWatcher {
270270
let req = Request::wrap(req);
271271
if status == uvll::ECANCELED { return }
272272

273-
let cx: &mut Ctx = unsafe { req.get_data() };
273+
// Apparently on windows when the handle is closed this callback may
274+
// not be invoked with ECANCELED but rather another error code.
275+
// Either ways, if the data is null, then our timeout has expired
276+
// and there's nothing we can do.
277+
let data = unsafe { uvll::get_data_for_req(req.handle) };
278+
if data.is_null() { return }
279+
280+
let cx: &mut Ctx = unsafe { &mut *(data as *mut Ctx) };
274281
cx.status = status;
275282
match cx.timer {
276283
Some(ref mut t) => t.stop(),

branches/try2/src/libstd/cast.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -28,8 +28,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
2828
* Move a thing into the void
2929
*
3030
* The forget function will take ownership of the provided value but neglect
31-
* to run any required cleanup or memory-management operations on it. This
32-
* can be used for various acts of magick.
31+
* to run any required cleanup or memory-management operations on it.
3332
*/
3433
#[inline]
3534
pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); }

0 commit comments

Comments
 (0)