forked from mirrors/gecko-dev
Differential Revision: https://phabricator.services.mozilla.com/D53964 --HG-- rename : third_party/rust/target-lexicon/host.rs => third_party/rust/target-lexicon-0.8.1/host.rs rename : third_party/rust/target-lexicon/sorted.txt => third_party/rust/target-lexicon-0.8.1/sorted.txt extra : moz-landing-system : lando
39 lines
659 B
Rust
39 lines
659 B
Rust
use std::io;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
#[error("...")]
|
|
pub struct ErrorStruct {
|
|
#[from]
|
|
source: io::Error,
|
|
}
|
|
|
|
#[derive(Error, Debug)]
|
|
#[error("...")]
|
|
pub struct ErrorTuple(#[from] io::Error);
|
|
|
|
#[derive(Error, Debug)]
|
|
#[error("...")]
|
|
pub enum ErrorEnum {
|
|
Test {
|
|
#[from]
|
|
source: io::Error,
|
|
},
|
|
}
|
|
|
|
#[derive(Error, Debug)]
|
|
#[error("...")]
|
|
pub enum Many {
|
|
Any(#[from] anyhow::Error),
|
|
Io(#[from] io::Error),
|
|
}
|
|
|
|
fn assert_impl<T: From<io::Error>>() {}
|
|
|
|
#[test]
|
|
fn test_from() {
|
|
assert_impl::<ErrorStruct>();
|
|
assert_impl::<ErrorTuple>();
|
|
assert_impl::<ErrorEnum>();
|
|
assert_impl::<Many>();
|
|
}
|