2 // This test relies on `TryFrom` being blanket impl for all `T: Into`
3 // and `TryInto` being blanket impl for all `U: TryFrom`
5 // This test was added to show the motivation for doing this
6 // over `TryFrom` being blanket impl for all `T: From`
8 #![feature(never_type)]
10 use std::convert::{TryInto, Infallible};
16 // This fails to compile due to coherence restrictions
17 // as of Rust version 1.32.x, therefore it could not be used
18 // instead of the `Into` version of the impl, and serves as
19 // motivation for a blanket impl for all `T: Into`, instead
20 // of a blanket impl for all `T: From`
22 impl<T> From<Foo<T>> for Box<T> {
23 fn from(foo: Foo<T>) -> Box<T> {
29 impl<T> Into<Vec<T>> for Foo<T> {
30 fn into(self) -> Vec<T> {
36 let _: Result<Vec<i32>, Infallible> = Foo { t: 10 }.try_into();