Closed
Description
Hi, i have made some changes for a crate stubborn-io
to support a generic type that implements ToSocketAddrs
from Tokio
, but suddenly the code can't compile because it runs out of memory with 6, 8, 10 GB.
This is the code i'm trying to compile:
use super::io::{StubbornIo, UnderlyingIo};
use std::future::Future;
use std::io;
use tokio::net::ToSocketAddrs;
use std::pin::Pin;
use tokio::net::TcpStream;
impl<A> UnderlyingIo<A> for TcpStream
where A: ToSocketAddrs + Sync + Send + Clone + Unpin + 'static {
fn establish(addr: A) -> Pin<Box<dyn Future<Output = io::Result<Self>> + Send>> {
Box::pin(TcpStream::connect(addr))
}
}
pub type StubbornTcpStream<A: ToSocketAddrs + Sync + Send + Clone + Unpin + 'static> = StubbornIo<TcpStream, A>;
if changed the type A
for SocketAddr
or String
it then compiles and runs fine.
It fails to compile on x86_64-unknown-linux-gnu with stable
, nightly
.
I'm attaching the Heaptrack files for further analysis.
https://gofile.io/?c=Vnar2K