You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following minimal example reproduces the error (I'm using the latest crates.io version of ipc-channel but I bet it works with latest commit on master as well):
use ipc_channel::ipc;use ipc_channel::router::ROUTER;fnmain() -> Result<(), std::io::Error>{let(sender, receiver) = ipc::channel::<(i32,i32)>()?;// Use this second channel to force main thread to block until child thread// is done.let(sender2, receiver2) = ipc::channel()?;ROUTER.add_route(receiver.to_opaque(),Box::new(move |msg|{match msg.to::<i32>(){Ok(val) => println!("Val: {:?}",val),Err(e) => println!("Error: {:?}",e),};
sender2.send(());}));
sender.send((1234,5678)).unwrap();
receiver2.recv().unwrap();Ok(())}
Which happily outputs: Val: 1234.
Basically I'm able to convert the (i32, i32) to a i32 through to::<i32>(). I only tried it for numerical types, but it seems we have observed this behavior for less trivial types: servo/servo#23818 (comment)
I'm planning to (ab)use this behavior... but it seems a little undefined-behaviory to me?
The text was updated successfully, but these errors were encountered:
The following minimal example reproduces the error (I'm using the latest crates.io version of
ipc-channel
but I bet it works with latest commit on master as well):Which happily outputs:
Val: 1234
.Basically I'm able to convert the
(i32, i32)
to ai32
throughto::<i32>()
. I only tried it for numerical types, but it seems we have observed this behavior for less trivial types: servo/servo#23818 (comment)I'm planning to (ab)use this behavior... but it seems a little undefined-behaviory to me?
The text was updated successfully, but these errors were encountered: