Open
Description
Hi! The following code does not compile, while it should. The functions test1
and test2
do the same thing, while test1
compiles and test2
does not:
#![feature(trait_alias)]
use std::marker::PhantomData;
pub struct X{}
pub trait T2 = where PhantomData<Self>: Into<X>;
pub trait T {
type Item: T2;
fn test1() -> X {
PhantomData::<Self::Item>.into()
}
}
fn test2<S:T>(s:S) -> X {
PhantomData::<S::Item>.into()
}
Error:
error[E0277]: the trait bound `X: std::convert::From<std::marker::PhantomData<<S as T>::Item>>` is not satisfied
--> src/lib.rs:18:28
|
18 | PhantomData::<S::Item>.into()
| ^^^^ the trait `std::convert::From<std::marker::PhantomData<<S as T>::Item>>` is not implemented for `X`
|
= note: required because of the requirements on the impl of `std::convert::Into<X>` for `std::marker::PhantomData<<S as T>::Item>`