summary refs log tree commit diff
path: root/src/test/run-pass/module-polymorphism3.rc
blob: 34dc9000e32368a8a4ed14f12c3e8055bd994e1a (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
#[no_core];

// Use one template module to specify in a single file the implementation
// of functions for multiple types

#[path = "module-polymorphism3-files"]
mod mystd {

    // The template is specified in float-template.rs
    #[path = "float-template"]
    mod float {
        // The type of the float
        import inst::T;

        // Define T as appropriate for platform
        #[path = "inst_float.rs"]
        mod inst;
    }

    // Use the same template
    #[path = "float-template"]
    mod f64 {

        import inst::T;

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

    #[path = "float-template"]
    mod f32 {
        import inst::T;

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

}