This repository was archived by the owner on Aug 16, 2021. It is now read-only.
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
Using failure
with #![termination_trait]
(fn main() -> Result<T>
) #130
Open
Description
I'm running into a couple of issues trying to use failure
with #![termination_trait]
.
#![feature(termination_trait)]
extern crate failure;
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
use failure::{Fail, Error as FailureError};
type Result<T> = std::result::Result<T, Fail>;
fn main() -> Result<()> {
Err(IoError::from(IoErrorKind::InvalidData))?
}
results in:
error[E0277]: the trait bound `failure::Fail + 'static: std::marker::Sized` is not satisfied
--> src/main.rs:10:1
|
10 | / fn main() -> Result<()> {
11 | | Err(IoError::from(IoErrorKind::InvalidData))?
12 | | }
| |_^ `failure::Fail + 'static` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `failure::Fail + 'static`
= note: required by `std::result::Result`
error: aborting due to previous error
Switching the Result
declaration to type Result<T> = std::result::Result<T, FailureError>
yields:
error[E0277]: the trait bound `failure::Error: std::error::Error` is not satisfied
--> src/main.rs:15:25
|
10 | fn main() -> Result<()> {
| _________________________^
11 | | Err(IoError::from(IoErrorKind::InvalidData))?
12 | | }
| |_^ the trait `std::error::Error` is not implemented for `failure::Error`
|
= note: required because of the requirements on the impl of `std::Termination` for `std::result::Result<(), failure::Error>`
error: aborting due to previous error
Is there a solution for this? If not, should this be a failure
or a termination_trait
issue?
Many thanks,
U007D
Metadata
Metadata
Assignees
Labels
No labels