-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.F-marker_trait_attr`#![feature(marker_trait_attr)]``#![feature(marker_trait_attr)]`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.
Description
#![feature(marker_trait_attr)]
#[marker] // Remove this line and it works?!?
trait Foo<T> {}
impl Foo<u16> for u8 {}
impl Foo<[u8; 1]> for u8 {}
fn foo<T: Foo<U>, U>(_: T) -> U { unimplemented!() }
fn main() {
let _: u16 = foo(0_u8);
}
It works if I remove the #[marker]
, but when it's a #[marker]
trait it fails with
error[E0308]: mismatched types
--> src/lib.rs:10:18
|
10 | let _: u16 = foo(0_u8);
| ^^^^^^^^^ expected u16, found array of 1 elements
|
= note: expected type `u16`
found type `[u8; 1]`
(I didn't think this property of a trait affected inference at all, so I'm very confused by this...)
Centril
Metadata
Metadata
Assignees
Labels
A-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.F-marker_trait_attr`#![feature(marker_trait_attr)]``#![feature(marker_trait_attr)]`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.