summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-consts/auxiliary/associated-const-cc-lib.rs
blob: 4fcefe32cbfb33d1c8424769381d422da459b2fe (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
31
32
33
34
#![crate_type="lib"]

// These items are for testing that associated consts work cross-crate.
pub trait Foo {
    const BAR: usize;
}

pub struct FooNoDefault;

impl Foo for FooNoDefault {
    const BAR: usize = 0;
}

// These test that defaults and default resolution work cross-crate.
pub trait FooDefault {
    const BAR: usize = 1;
}

pub struct FooOverwriteDefault;

impl FooDefault for FooOverwriteDefault {
    const BAR: usize = 2;
}

pub struct FooUseDefault;

impl FooDefault for FooUseDefault {}

// Test inherent impls.
pub struct InherentBar;

impl InherentBar {
    pub const BAR: usize = 3;
}