summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/defaults/external.rs
blob: 25ec523cb5489e213c6fb392c281491563f68d9e (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
// aux-build:const_defaulty.rs
// check-pass
extern crate const_defaulty;
use const_defaulty::Defaulted;

struct Local<const N: usize=4>;
impl Local {
    fn new() -> Self {
        Local
    }
}
impl<const N: usize>Local<N> {
    fn value(&self) -> usize {
        N
    }
}

fn main() {
    let v = Defaulted::new();
    assert_eq!(v.value(), 3);

    let l = Local::new();
    assert_eq!(l.value(), 4);
}