summary refs log tree commit diff
path: root/src/test/run-pass/module-polymorphism.rc
blob: 781e3a279b194871eca4ae4debbe9423656546a9 (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
35
36
37
38
39
40
41
42
43
44
45
#[no_core];


#[path = "module-polymorphism-files"]
mod float {

    // The type of the float
    import inst::T;

    // Define T as float
    #[path = "inst_float.rs"]
    mod inst;

    // Add in the implementation from a single source file
    #[path = "template.rs"]
    mod template;

}

#[path = "module-polymorphism-files"]
mod f64 {

    import inst::T;

    // Define T as f64
    #[path = "inst_f64.rs"]
    mod inst;

    // Use the implementation for the same source file!
    #[path = "template.rs"]
    mod template;

}

#[path = "module-polymorphism-files"]
mod f32 {
    import inst::T;

    #[path = "inst_f32.rs"]
    mod inst;

    #[path = "template.rs"]
    mod template;

}