Implement generalized object and type parameter bounds (Fixes #16462)

This commit is contained in:
Niko Matsakis 2014-08-27 21:46:52 -04:00
parent 3ee047ae1f
commit 1b487a8906
272 changed files with 6783 additions and 3154 deletions

View file

@ -386,6 +386,14 @@ pub struct Receiver<T> {
/// whenever `next` is called, waiting for a new message, and `None` will be
/// returned when the corresponding channel has hung up.
#[unstable]
#[cfg(not(stage0))]
pub struct Messages<'a, T:'a> {
rx: &'a Receiver<T>
}
/// Stage0 only
#[cfg(stage0)]
#[unstable]
pub struct Messages<'a, T> {
rx: &'a Receiver<T>
}

View file

@ -76,6 +76,24 @@ pub struct Select {
/// A handle to a receiver which is currently a member of a `Select` set of
/// receivers. This handle is used to keep the receiver in the set as well as
/// interact with the underlying receiver.
#[cfg(not(stage0))]
pub struct Handle<'rx, T:'rx> {
/// The ID of this handle, used to compare against the return value of
/// `Select::wait()`
id: uint,
selector: &'rx Select,
next: *mut Handle<'static, ()>,
prev: *mut Handle<'static, ()>,
added: bool,
packet: &'rx Packet+'rx,
// due to our fun transmutes, we be sure to place this at the end. (nothing
// previous relies on T)
rx: &'rx Receiver<T>,
}
/// Stage0 only
#[cfg(stage0)]
pub struct Handle<'rx, T> {
/// The ID of this handle, used to compare against the return value of
/// `Select::wait()`
@ -84,7 +102,7 @@ pub struct Handle<'rx, T> {
next: *mut Handle<'static, ()>,
prev: *mut Handle<'static, ()>,
added: bool,
packet: &'rx Packet,
packet: &'rx Packet+'rx,
// due to our fun transmutes, we be sure to place this at the end. (nothing
// previous relies on T)