Work around ICE

This commit is contained in:
arkpar 2016-01-13 15:08:36 +01:00
parent 28c482691a
commit a5bb7b7f92
3 changed files with 10 additions and 11 deletions

View File

@ -70,9 +70,7 @@ pub type TimerToken = service::TimerToken;
pub type StreamToken = service::StreamToken;
pub type IoContext<'s, M> = service::IoContext<'s, M>;
pub type IoService<M> = service::IoService<M>;
pub const USER_TOKEN_START: usize = service::USER_TOKEN;
//pub const USER_TOKEN_START: usize = service::USER_TOKEN; // TODO: ICE in rustc 1.7.0-nightly (49c382779 2016-01-12)
#[cfg(test)]
mod tests {

View File

@ -13,7 +13,7 @@ pub type StreamToken = usize;
const MAX_USER_TIMERS: usize = 32;
const USER_TIMER: usize = 0;
const LAST_USER_TIMER: usize = USER_TIMER + MAX_USER_TIMERS - 1;
pub const USER_TOKEN: usize = LAST_USER_TIMER + 1;
//const USER_TOKEN: usize = LAST_USER_TIMER + 1;
/// Messages used to communicate with the event loop from other threads.
pub enum IoMessage<Message> where Message: Send + Sized {

View File

@ -45,12 +45,13 @@ impl NetworkConfiguration {
}
// Tokens
const TOKEN_BEGIN: usize = USER_TOKEN_START;
const TCP_ACCEPT: usize = TOKEN_BEGIN;
const IDLE: usize = TOKEN_BEGIN + 1;
const NODETABLE_RECEIVE: usize = TOKEN_BEGIN + 2;
const NODETABLE_MAINTAIN: usize = TOKEN_BEGIN + 3;
const NODETABLE_DISCOVERY: usize = TOKEN_BEGIN + 4;
//const TOKEN_BEGIN: usize = USER_TOKEN_START; // TODO: ICE in rustc 1.7.0-nightly (49c382779 2016-01-12)
const TOKEN_BEGIN: usize = 32;
const TCP_ACCEPT: usize = TOKEN_BEGIN + 1;
const IDLE: usize = TOKEN_BEGIN + 2;
const NODETABLE_RECEIVE: usize = TOKEN_BEGIN + 3;
const NODETABLE_MAINTAIN: usize = TOKEN_BEGIN + 4;
const NODETABLE_DISCOVERY: usize = TOKEN_BEGIN + 5;
const FIRST_CONNECTION: usize = TOKEN_BEGIN + 16;
const LAST_CONNECTION: usize = FIRST_CONNECTION + MAX_CONNECTIONS - 1;
@ -545,9 +546,9 @@ impl<Message> IoHandler<NetworkIoMessage<Message>> for Host<Message> where Messa
fn stream_readable<'s>(&'s mut self, io: &mut IoContext<'s, NetworkIoMessage<Message>>, stream: StreamToken) {
match stream {
TCP_ACCEPT => self.accept(io),
FIRST_CONNECTION ... LAST_CONNECTION => self.connection_readable(stream, io),
NODETABLE_RECEIVE => {},
TCP_ACCEPT => self.accept(io),
_ => panic!("Received unknown readable token"),
}
}