summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-consts/associated-const-cross-crate-defaults.rs
blob: 92d9cffecdddea80638ec360789fdee7919815f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// run-pass
// aux-build:associated-const-cc-lib.rs


extern crate associated_const_cc_lib as foolib;

pub struct LocalFooUseDefault;

impl foolib::FooDefault for LocalFooUseDefault {}

pub struct LocalFooOverwriteDefault;

impl foolib::FooDefault for LocalFooOverwriteDefault {
    const BAR: usize = 4;
}

fn main() {
    assert_eq!(1, <foolib::FooUseDefault as foolib::FooDefault>::BAR);
    assert_eq!(2, <foolib::FooOverwriteDefault as foolib::FooDefault>::BAR);
    assert_eq!(1, <LocalFooUseDefault as foolib::FooDefault>::BAR);
    assert_eq!(4, <LocalFooOverwriteDefault as foolib::FooDefault>::BAR);
}