-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-trait_alias`#![feature(trait_alias)]``#![feature(trait_alias)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
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>`
farmaazonfarmaazon
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-trait_alias`#![feature(trait_alias)]``#![feature(trait_alias)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.