Merge pull request #27387 from brson/beta-next

Beta next
This commit is contained in:
Brian Anderson 2015-07-30 17:10:08 -04:00
commit a3bcfe8e45
9 changed files with 61 additions and 15 deletions

View file

@ -18,7 +18,7 @@ CFG_RELEASE_NUM=1.2.0
# An optional number to put after the label, e.g. '.2' -> '-beta.2'
# NB Make sure it starts with a dot to conform to semver pre-release
# versions (section 9)
CFG_PRERELEASE_VERSION=.3
CFG_PRERELEASE_VERSION=.4
# Append a version-dependent hash to each library, so we can install different
# versions in the same place

View file

@ -65,6 +65,7 @@
#![allow(raw_pointer_derive)]
#![deny(missing_docs)]
#![feature(associated_type_defaults)]
#![feature(intrinsics)]
#![feature(lang_items)]
#![feature(on_unimplemented)]

View file

@ -60,21 +60,22 @@ impl Condvar {
let r = ffi::gettimeofday(&mut sys_now, ptr::null_mut());
debug_assert_eq!(r, 0);
let nsec = dur.extra_nanos() as libc::c_long +
(sys_now.tv_usec * 1000) as libc::c_long;
let extra = (nsec / 1_000_000_000) as libc::time_t;
let nsec = nsec % 1_000_000_000;
let seconds = dur.secs() as libc::time_t;
let timeout = match sys_now.tv_sec.checked_add(seconds) {
Some(sec) => {
libc::timespec {
tv_sec: sec,
tv_nsec: dur.extra_nanos() as libc::c_long,
}
let timeout = sys_now.tv_sec.checked_add(extra).and_then(|s| {
s.checked_add(seconds)
}).map(|s| {
libc::timespec { tv_sec: s, tv_nsec: nsec }
}).unwrap_or_else(|| {
libc::timespec {
tv_sec: <libc::time_t>::max_value(),
tv_nsec: 1_000_000_000 - 1,
}
None => {
libc::timespec {
tv_sec: <libc::time_t>::max_value(),
tv_nsec: 1_000_000_000 - 1,
}
}
};
});
// And wait!
let r = ffi::pthread_cond_timedwait(self.inner.get(), mutex::raw(mutex),

View file

@ -10,7 +10,7 @@
//! Windows-specific primitives
#[stable(feature = "raw_ext", since = "1.1.0")]
#![stable(feature = "raw_ext", since = "1.1.0")]
use os::raw::c_void;

View file

@ -155,6 +155,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
// Allows the definition of `const fn` functions.
("const_fn", "1.2.0", Active),
// Allows associated type defaults
("associated_type_defaults", "1.2.0", Active),
];
// (changing above list without updating src/doc/reference.md makes @cmr sad)
@ -686,6 +689,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
self.gate_feature("const_fn", ti.span, "const fn is unstable");
}
}
ast::TypeTraitItem(_, Some(_)) => {
self.gate_feature("associated_type_defaults", ti.span,
"associated type defaults are unstable");
}
_ => {}
}
visit::walk_trait_item(self, ti);

View file

@ -0,0 +1,18 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_type_defaults)]
pub trait Foo {
type Input = usize;
fn bar(&self, _: Self::Input) {}
}
impl Foo for () {}

View file

@ -0,0 +1,15 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
trait Foo {
type Bar = u8; //~ ERROR associated type defaults are unstable
}
fn main() {}

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_type_defaults)]
trait Foo<T> {
type Out = T;
fn foo(&self) -> Self::Out;

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_type_defaults)]
use std::marker::PhantomData;
pub trait Routing<I> {