-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.F-specialization`#![feature(specialization)]``#![feature(specialization)]`T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
STR
#![feature(specialization)]
trait Teq<U:?Sized> {
fn types_eq() -> &'static str;
}
impl<U:?Sized> Teq<U> for U {
fn types_eq() -> &'static str { "types are equal" }
}
impl<U:?Sized, V:?Sized> Teq<U> for V {
default fn types_eq() -> &'static str { "types differ" }
}
fn main() {
println!("{}", <Send+Sync as Teq<Sync+Send>>::types_eq());
}
Expected Result
This should not compile, or should print "types are equal"
Actual Result
This prints "types differ".
kennytm
Metadata
Metadata
Assignees
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.F-specialization`#![feature(specialization)]``#![feature(specialization)]`T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.