]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/namespace-mix-old.rs
New upstream version 1.14.0+dfsg1
[rustc.git] / src / test / compile-fail / namespace-mix-old.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // FIXME: Remove when `item_like_imports` is stabilized.
12
13 // aux-build:namespace-mix-old.rs
14
15 #![feature(relaxed_adts)]
16
17 extern crate namespace_mix_old;
18 use namespace_mix_old::{xm1, xm2, xm3, xm4, xm5, xm6, xm7, xm8, xm9, xmA, xmB, xmC};
19
20 mod c {
21 pub struct S {}
22 pub struct TS();
23 pub struct US;
24 pub enum E {
25 V {},
26 TV(),
27 UV,
28 }
29
30 pub struct Item;
31 }
32
33 mod proxy {
34 pub use c::*;
35 pub use c::E::*;
36 }
37
38 // Use something emitting the type argument name, e.g. unsatisfied bound.
39 trait Impossible {}
40 fn check<T: Impossible>(_: T) {}
41
42 mod m1 {
43 pub use ::proxy::*;
44 pub type S = ::c::Item;
45 }
46 mod m2 {
47 pub use ::proxy::*;
48 pub const S: ::c::Item = ::c::Item;
49 }
50
51 fn f12() {
52 check(m1::S{}); //~ ERROR c::Item
53 check(m1::S); //~ ERROR unresolved name
54 check(m2::S{}); //~ ERROR c::S
55 check(m2::S); //~ ERROR c::Item
56 }
57 fn xf12() {
58 check(xm1::S{}); //~ ERROR c::Item
59 check(xm1::S); //~ ERROR unresolved name
60 check(xm2::S{}); //~ ERROR c::S
61 check(xm2::S); //~ ERROR c::Item
62 }
63
64 mod m3 {
65 pub use ::proxy::*;
66 pub type TS = ::c::Item;
67 }
68 mod m4 {
69 pub use ::proxy::*;
70 pub const TS: ::c::Item = ::c::Item;
71 }
72
73 fn f34() {
74 check(m3::TS{}); //~ ERROR c::Item
75 check(m3::TS); //~ ERROR c::TS
76 check(m4::TS{}); //~ ERROR c::TS
77 check(m4::TS); //~ ERROR c::Item
78 }
79 fn xf34() {
80 check(xm3::TS{}); //~ ERROR c::Item
81 check(xm3::TS); //~ ERROR c::TS
82 check(xm4::TS{}); //~ ERROR c::TS
83 check(xm4::TS); //~ ERROR c::Item
84 }
85
86 mod m5 {
87 pub use ::proxy::*;
88 pub type US = ::c::Item;
89 }
90 mod m6 {
91 pub use ::proxy::*;
92 pub const US: ::c::Item = ::c::Item;
93 }
94
95 fn f56() {
96 check(m5::US{}); //~ ERROR c::Item
97 check(m5::US); //~ ERROR c::US
98 check(m6::US{}); //~ ERROR c::US
99 check(m6::US); //~ ERROR c::Item
100 }
101 fn xf56() {
102 check(xm5::US{}); //~ ERROR c::Item
103 check(xm5::US); //~ ERROR c::US
104 check(xm6::US{}); //~ ERROR c::US
105 check(xm6::US); //~ ERROR c::Item
106 }
107
108 mod m7 {
109 pub use ::proxy::*;
110 pub type V = ::c::Item;
111 }
112 mod m8 {
113 pub use ::proxy::*;
114 pub const V: ::c::Item = ::c::Item;
115 }
116
117 fn f78() {
118 check(m7::V{}); //~ ERROR c::Item
119 check(m7::V); //~ ERROR name of a struct or struct variant
120 check(m8::V{}); //~ ERROR c::E
121 check(m8::V); //~ ERROR c::Item
122 }
123 fn xf78() {
124 check(xm7::V{}); //~ ERROR c::Item
125 check(xm7::V); //~ ERROR name of a struct or struct variant
126 check(xm8::V{}); //~ ERROR c::E
127 check(xm8::V); //~ ERROR c::Item
128 }
129
130 mod m9 {
131 pub use ::proxy::*;
132 pub type TV = ::c::Item;
133 }
134 mod mA {
135 pub use ::proxy::*;
136 pub const TV: ::c::Item = ::c::Item;
137 }
138
139 fn f9A() {
140 check(m9::TV{}); //~ ERROR c::Item
141 check(m9::TV); //~ ERROR c::E
142 check(mA::TV{}); //~ ERROR c::E
143 check(mA::TV); //~ ERROR c::Item
144 }
145 fn xf9A() {
146 check(xm9::TV{}); //~ ERROR c::Item
147 check(xm9::TV); //~ ERROR c::E
148 check(xmA::TV{}); //~ ERROR c::E
149 check(xmA::TV); //~ ERROR c::Item
150 }
151
152 mod mB {
153 pub use ::proxy::*;
154 pub type UV = ::c::Item;
155 }
156 mod mC {
157 pub use ::proxy::*;
158 pub const UV: ::c::Item = ::c::Item;
159 }
160
161 fn fBC() {
162 check(mB::UV{}); //~ ERROR c::Item
163 check(mB::UV); //~ ERROR c::E
164 check(mC::UV{}); //~ ERROR c::E
165 check(mC::UV); //~ ERROR c::Item
166 }
167 fn xfBC() {
168 check(xmB::UV{}); //~ ERROR c::Item
169 check(xmB::UV); //~ ERROR c::E
170 check(xmC::UV{}); //~ ERROR c::E
171 check(xmC::UV); //~ ERROR c::Item
172 }
173
174 fn main() {}