Skip to content

Commit a3bcfe8

Browse files
committed
Merge pull request #27387 from brson/beta-next
Beta next
2 parents 2b45108 + 6e6d5b1 commit a3bcfe8

File tree

9 files changed

+61
-15
lines changed

9 files changed

+61
-15
lines changed

mk/main.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CFG_RELEASE_NUM=1.2.0
1818
# An optional number to put after the label, e.g. '.2' -> '-beta.2'
1919
# NB Make sure it starts with a dot to conform to semver pre-release
2020
# versions (section 9)
21-
CFG_PRERELEASE_VERSION=.3
21+
CFG_PRERELEASE_VERSION=.4
2222

2323
# Append a version-dependent hash to each library, so we can install different
2424
# versions in the same place

src/libcore/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#![allow(raw_pointer_derive)]
6666
#![deny(missing_docs)]
6767

68+
#![feature(associated_type_defaults)]
6869
#![feature(intrinsics)]
6970
#![feature(lang_items)]
7071
#![feature(on_unimplemented)]

src/libstd/sys/unix/condvar.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,22 @@ impl Condvar {
6060
let r = ffi::gettimeofday(&mut sys_now, ptr::null_mut());
6161
debug_assert_eq!(r, 0);
6262

63+
let nsec = dur.extra_nanos() as libc::c_long +
64+
(sys_now.tv_usec * 1000) as libc::c_long;
65+
let extra = (nsec / 1_000_000_000) as libc::time_t;
66+
let nsec = nsec % 1_000_000_000;
6367
let seconds = dur.secs() as libc::time_t;
64-
let timeout = match sys_now.tv_sec.checked_add(seconds) {
65-
Some(sec) => {
66-
libc::timespec {
67-
tv_sec: sec,
68-
tv_nsec: dur.extra_nanos() as libc::c_long,
69-
}
70-
}
71-
None => {
72-
libc::timespec {
73-
tv_sec: <libc::time_t>::max_value(),
74-
tv_nsec: 1_000_000_000 - 1,
75-
}
68+
69+
let timeout = sys_now.tv_sec.checked_add(extra).and_then(|s| {
70+
s.checked_add(seconds)
71+
}).map(|s| {
72+
libc::timespec { tv_sec: s, tv_nsec: nsec }
73+
}).unwrap_or_else(|| {
74+
libc::timespec {
75+
tv_sec: <libc::time_t>::max_value(),
76+
tv_nsec: 1_000_000_000 - 1,
7677
}
77-
};
78+
});
7879

7980
// And wait!
8081
let r = ffi::pthread_cond_timedwait(self.inner.get(), mutex::raw(mutex),

src/libstd/sys/windows/ext/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Windows-specific primitives
1212
13-
#[stable(feature = "raw_ext", since = "1.1.0")]
13+
#![stable(feature = "raw_ext", since = "1.1.0")]
1414

1515
use os::raw::c_void;
1616

src/libsyntax/feature_gate.rs

+7
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
155155

156156
// Allows the definition of `const fn` functions.
157157
("const_fn", "1.2.0", Active),
158+
159+
// Allows associated type defaults
160+
("associated_type_defaults", "1.2.0", Active),
158161
];
159162
// (changing above list without updating src/doc/reference.md makes @cmr sad)
160163

@@ -686,6 +689,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
686689
self.gate_feature("const_fn", ti.span, "const fn is unstable");
687690
}
688691
}
692+
ast::TypeTraitItem(_, Some(_)) => {
693+
self.gate_feature("associated_type_defaults", ti.span,
694+
"associated type defaults are unstable");
695+
}
689696
_ => {}
690697
}
691698
visit::walk_trait_item(self, ti);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(associated_type_defaults)]
12+
13+
pub trait Foo {
14+
type Input = usize;
15+
fn bar(&self, _: Self::Input) {}
16+
}
17+
18+
impl Foo for () {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Foo {
12+
type Bar = u8; //~ ERROR associated type defaults are unstable
13+
}
14+
15+
fn main() {}

src/test/run-pass/default-associated-types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(associated_type_defaults)]
12+
1113
trait Foo<T> {
1214
type Out = T;
1315
fn foo(&self) -> Self::Out;

src/test/run-pass/issue-25339.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(associated_type_defaults)]
12+
1113
use std::marker::PhantomData;
1214

1315
pub trait Routing<I> {

0 commit comments

Comments
 (0)