Open
Description
Hi,
I've stumbled upon an error when I've tried to add conditional compilation to my quick_error defined Error enum. Here's an example:
quick_error! {
#[derive(Debug)]
pub enum Error {
Io(err: std::io::Error) {
cause(err)
from()
display("I/O error: {}", err)
}
#[cfg(feature="ssh2")]
Ssh(err: ssh2::Error) {
cause(err)
from()
display("SSH error: {}", err)
}
Net(err: std::net::AddrParseError) {
cause(err)
from()
display("Network error: {}", err)
}
Zmq(err: zmq::Error) {
cause(err)
from()
display("ZMQ error: {}", err)
}
Other(desc: String) {
description(desc)
from(desc: &str) -> (String::from(desc))
from(err: Box<dyn std::error::Error>) -> (String::from(err.description()))
}
}
}
If I remove the from()
from Ssh variant, then it compiles correctly. When I'm expanding the macro, I can see the #[cfg(feature="ssh2")]
everywhere except for the
impl From<ssh2::Error> for Error {
fn from(err: ssh2::Error) -> Error {
Error::Ssh(err)
}
}
Metadata
Metadata
Assignees
Labels
No labels