summary refs log tree commit diff
path: root/src/test/run-pass/module-polymorphism2.rc
blob: 49cd60fc0a93a2a00c5dfccdfbb7b6133b89fdc0 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#[path = "module-polymorphism2-files"]
mod mystd {
    #[legacy_exports];

    #[path = "float-template"]
    mod float {
        #[legacy_exports];
        // The type of the float
        use inst::T;

        // Unfortunate
        use template::*;
        export plus;

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

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


    #[path = "float-template"]
    mod f64 {
        #[legacy_exports];

        use inst::T;

        // Unfortunate
        use template::*;
        export plus;

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

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

    }

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

        // Unfortunate
        use template::*;
        export plus;

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

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

    }

}