about summary refs log tree commit diff
path: root/tests/ui/associated-inherent-types/candidate-with-alias.rs
blob: a84da195c26b0be3b507a3badf9d27e413f816d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//@ check-pass

#![feature(inherent_associated_types)]
#![expect(incomplete_features)]

// A behaviour test showcasing that IAT resolution can pick the right
// candidate even if it has an alias, if it's the only candidate.

trait Identity {
    type Assoc;
}
impl<T> Identity for T {
    type Assoc = T;
}

struct Foo<T>(T);
impl Foo<<u8 as Identity>::Assoc> {
    type Inherent = u8;
}
impl Foo<u16> {
    type Inherent = u32;
}

struct Bar {
    field: <Foo<u8>>::Inherent,
}

fn main() {
    Bar { field: 10_u8 };
}