summaryrefslogtreecommitdiffstats
path: root/tests/run-make-fulldeps/obtain-borrowck/test.rs
blob: f7b4b41feaf9740d3fed2f87755ff14a12ffb15a (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
trait X {
    fn provided(&self) -> usize {
        5
    }
    fn required(&self) -> u32;
}

struct Bar;

impl Bar {
    fn new() -> Self {
        Self
    }
}

impl X for Bar {
    fn provided(&self) -> usize {
        1
    }
    fn required(&self) -> u32 {
        7
    }
}

const fn foo() -> usize {
    1
}

fn main() {
    let bar: [Bar; foo()] = [Bar::new()];
    assert_eq!(bar[0].provided(), foo());
}