about summary refs log tree commit diff
path: root/tests/ui/delegation/body-identity-list.rs
blob: 1f08ab4e1a4c29926cd99f409464dd693be1e1a2 (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
//@ check-pass

#![feature(fn_delegation)]
#![allow(incomplete_features)]

trait Trait {
    fn foo(&self) {}
    fn bar(&self) {}
}

impl Trait for u8 {}

struct S(u8);

mod to_import {
    pub fn check(arg: &u8) -> &u8 { arg }
}

impl Trait for S {
    reuse Trait::{foo, bar} {
        use to_import::check;

        let _arr = Some(self.0).map(|x| [x * 2; 3]);
        check(&self.0)
    }
}

fn main() {
    let s = S(0);
    s.foo();
    s.bar();
}