Receiver::recv_timeout() returns instantly when duration overflows #44216
Closed
Description
When Receiver::recv_timeout receives certain large values, it returns immediately. This is probably due to an overflowing value. Instead, when there is overflow, it should fall back to Receiver::recv.
use std::sync::mpsc::Receiver;
use std::time::Duration;
let max = Duration::from_secs(u64::max_value());
receiver.recv_timeout(max);
Instant should probably not overflow like this:
let now = Instant::now();
let end_of_time = Instant::now() + Duration::from_secs(u64::max_value());
println!("{:?}", now);
println!("{:?}", end_of_time);
println!("did we pass end of time? {}", now > end_of_time);