summaryrefslogtreecommitdiffstats
path: root/src/test/ui/namespace/namespace-mix.rs
blob: c5b30f148bd5b7daf30ca6fdb2d87f308456e9cd (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// aux-build:namespace-mix.rs

extern crate namespace_mix;
use namespace_mix::*;

mod c {
    pub struct S {}
    pub struct TS();
    pub struct US;
    pub enum E {
        V {},
        TV(),
        UV,
    }

    pub struct Item;
}

// Use something emitting the type argument name, e.g., unsatisfied bound.
trait Impossible {}
fn check<T: Impossible>(_: T) {}

mod m1 {
    pub use ::c::*;
    pub type S = ::c::Item;
}
mod m2 {
    pub use ::c::*;
    pub const S: ::c::Item = ::c::Item;
}

fn f12() {
    check(m1::S{}); //~ ERROR c::Item
    check(m1::S); //~ ERROR expected value, found type alias `m1::S`
    check(m2::S{}); //~ ERROR c::S
    check(m2::S); //~ ERROR c::Item
}
fn xf12() {
    check(xm1::S{}); //~ ERROR c::Item
    check(xm1::S); //~ ERROR expected value, found type alias `xm1::S`
    check(xm2::S{}); //~ ERROR c::S
    check(xm2::S); //~ ERROR c::Item
}

mod m3 {
    pub use ::c::*;
    pub type TS = ::c::Item;
}
mod m4 {
    pub use ::c::*;
    pub const TS: ::c::Item = ::c::Item;
}

fn f34() {
    check(m3::TS{}); //~ ERROR c::Item
    check(m3::TS); //~ ERROR c::TS
    check(m4::TS{}); //~ ERROR c::TS
    check(m4::TS); //~ ERROR c::Item
}
fn xf34() {
    check(xm3::TS{}); //~ ERROR c::Item
    check(xm3::TS); //~ ERROR c::TS
    check(xm4::TS{}); //~ ERROR c::TS
    check(xm4::TS); //~ ERROR c::Item
}

mod m5 {
    pub use ::c::*;
    pub type US = ::c::Item;
}
mod m6 {
    pub use ::c::*;
    pub const US: ::c::Item = ::c::Item;
}

fn f56() {
    check(m5::US{}); //~ ERROR c::Item
    check(m5::US); //~ ERROR c::US
    check(m6::US{}); //~ ERROR c::US
    check(m6::US); //~ ERROR c::Item
}
fn xf56() {
    check(xm5::US{}); //~ ERROR c::Item
    check(xm5::US); //~ ERROR c::US
    check(xm6::US{}); //~ ERROR c::US
    check(xm6::US); //~ ERROR c::Item
}

mod m7 {
    pub use ::c::E::*;
    pub type V = ::c::Item;
}
mod m8 {
    pub use ::c::E::*;
    pub const V: ::c::Item = ::c::Item;
}

fn f78() {
    check(m7::V{}); //~ ERROR c::Item
    check(m7::V); //~ ERROR expected value, found type alias `m7::V`
    check(m8::V{}); //~ ERROR c::E
    check(m8::V); //~ ERROR c::Item
}
fn xf78() {
    check(xm7::V{}); //~ ERROR c::Item
    check(xm7::V); //~ ERROR expected value, found type alias `xm7::V`
    check(xm8::V{}); //~ ERROR c::E
    check(xm8::V); //~ ERROR c::Item
}

mod m9 {
    pub use ::c::E::*;
    pub type TV = ::c::Item;
}
mod mA {
    pub use ::c::E::*;
    pub const TV: ::c::Item = ::c::Item;
}

fn f9A() {
    check(m9::TV{}); //~ ERROR c::Item
    check(m9::TV); //~ ERROR c::E
    check(mA::TV{}); //~ ERROR c::E
    check(mA::TV); //~ ERROR c::Item
}
fn xf9A() {
    check(xm9::TV{}); //~ ERROR c::Item
    check(xm9::TV); //~ ERROR c::E
    check(xmA::TV{}); //~ ERROR c::E
    check(xmA::TV); //~ ERROR c::Item
}

mod mB {
    pub use ::c::E::*;
    pub type UV = ::c::Item;
}
mod mC {
    pub use ::c::E::*;
    pub const UV: ::c::Item = ::c::Item;
}

fn fBC() {
    check(mB::UV{}); //~ ERROR c::Item
    check(mB::UV); //~ ERROR c::E
    check(mC::UV{}); //~ ERROR c::E
    check(mC::UV); //~ ERROR c::Item
}
fn xfBC() {
    check(xmB::UV{}); //~ ERROR c::Item
    check(xmB::UV); //~ ERROR c::E
    check(xmC::UV{}); //~ ERROR c::E
    check(xmC::UV); //~ ERROR c::Item
}

fn main() {}