Skip to content

Commit 02c0a20

Browse files
committed
Fix compiler breaking changes
1 parent 6384ab7 commit 02c0a20

File tree

7 files changed

+59
-32
lines changed

7 files changed

+59
-32
lines changed

Cargo.lock

+40-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

search/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(std_misc)]
1+
#![feature(mpsc_select)]
22

33
#[macro_use]
44
extern crate log;

timer/src/control.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn start(data: Timer, c: Color, tx: SyncSender<TimeOut>) {
1515
},
1616
Timer::Remain(val) => {
1717
// TODO what is the right default value for base time?
18-
let base = val.time(c).unwrap_or(Duration::zero());
18+
let base = val.time(c).unwrap_or(Duration::new(0, 0));
1919
let inc = val.inc(c);
2020
let val = calc_time(base, inc);
2121
send_after(val, tx);
@@ -24,7 +24,7 @@ pub fn start(data: Timer, c: Color, tx: SyncSender<TimeOut>) {
2424
}
2525

2626
fn send_after(delay: Duration, tx: SyncSender<TimeOut>) {
27-
thread::sleep_ms(delay.num_milliseconds() as u32);
27+
thread::sleep_ms(delay.secs() as u32 * 1000 + delay.extra_nanos() / 1000000);
2828
let _ = tx.send(TimeOut(()));
2929
}
3030

timer/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(std_misc)]
1+
#![feature(duration)]
22

33
extern crate game;
44

@@ -82,8 +82,8 @@ impl RemainData {
8282
RemainData {
8383
w_time: None,
8484
b_time: None,
85-
w_inc: Duration::zero(),
86-
b_inc: Duration::zero(),
85+
w_inc: Duration::new(0, 0),
86+
b_inc: Duration::new(0, 0),
8787
moves_to_go: None,
8888
}
8989
}

uci/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(std_misc, collections, scoped, str_parse_error, collections_drain)]
1+
#![feature(scoped, str_parse_error, duration, slice_position_elem, drain)]
22

33
extern crate time;
44
#[macro_use]

uci/src/parse.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,18 @@ where I: Iterator<Item = &'a str> {
178178
match next_word {
179179
"searchmoves" => parse_from_to_vec(&mut words).map(|x| GoParam::SearchMoves(x)),
180180
"ponder" => Some(GoParam::Ponder),
181-
"wtime" => words.next().and_then(|s| s.parse::<i64>().ok())
181+
"wtime" => words.next().and_then(|s| s.parse::<u64>().ok())
182182
.map(|x| GoParam::Time(White,
183-
Duration::milliseconds(x))),
184-
"btime" => words.next().and_then(|s| s.parse::<i64>().ok())
183+
Duration::from_millis(x))),
184+
"btime" => words.next().and_then(|s| s.parse::<u64>().ok())
185185
.map(|x| GoParam::Time(Black,
186-
Duration::milliseconds(x))),
187-
"winc" => words.next().and_then(|s| s.parse::<i64>().ok())
186+
Duration::from_millis(x))),
187+
"winc" => words.next().and_then(|s| s.parse::<u64>().ok())
188188
.map(|x| GoParam::IncTime(White,
189-
Duration::milliseconds(x))),
190-
"binc" => words.next().and_then(|s| s.parse::<i64>().ok())
189+
Duration::from_millis(x))),
190+
"binc" => words.next().and_then(|s| s.parse::<u64>().ok())
191191
.map(|x| GoParam::IncTime(Black,
192-
Duration::milliseconds(x))),
192+
Duration::from_millis(x))),
193193
"movestogo" => words.next().and_then(|s| s.parse::<u32>().ok())
194194
.map(|x| GoParam::MovesToGo(NumMoves(x))),
195195
"depth" => words.next().and_then(|s| s.parse::<u32>().ok())
@@ -198,8 +198,8 @@ where I: Iterator<Item = &'a str> {
198198
.map(|x| GoParam::Nodes(NumNodes(x))),
199199
"mate" => words.next().and_then(|s| s.parse::<u32>().ok())
200200
.map(|x| GoParam::Mate(NumMoves(x))),
201-
"movetime" => words.next().and_then(|s| s.parse::<i64>().ok())
202-
.map(|x| GoParam::MoveTime(Duration::milliseconds(x))),
201+
"movetime" => words.next().and_then(|s| s.parse::<u64>().ok())
202+
.map(|x| GoParam::MoveTime(Duration::from_millis(x))),
203203
"infinite" => Some(GoParam::Infinite),
204204
_ => None,
205205
}.map(|val| res.push(val));

uci/src/types/param.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ impl fmt::Display for InfoParam {
6868
match *self {
6969
InfoParam::Depth(val) => write!(f, "depth {}", val.0),
7070
InfoParam::SelDepth(val) => write!(f, "seldepth {}", val.0),
71-
InfoParam::TimeSearched(val) => write!(f, "time {}", val.num_milliseconds()),
71+
InfoParam::TimeSearched(val) => write!(f, "time {}", val.secs() as u32 * 1000 +
72+
val.extra_nanos() / 1000000),
7273
InfoParam::NodesSearched(val) => write!(f, "nodes {}", val.0),
7374
InfoParam::PrincipalVariation(ref moves) => {
7475
try!(write!(f, "pv"));

0 commit comments

Comments
 (0)