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
|
mod m {
pub enum E {
Fn(u8),
Struct {
s: u8,
},
Unit,
}
pub mod n {
pub(in m) enum Z {
Fn(u8),
Struct {
s: u8,
},
Unit,
}
}
use m::n::Z; // OK, only the type is imported
fn f() {
n::Z;
//~^ ERROR expected value, found enum `n::Z`
Z;
//~^ ERROR expected value, found enum `Z`
let _: Z = Z::Fn;
//~^ ERROR mismatched types
let _: Z = Z::Struct;
//~^ ERROR expected value, found struct variant `Z::Struct`
let _ = Z::Unit();
//~^ ERROR expected function, found enum variant `Z::Unit`
let _ = Z::Unit {};
// This is ok, it is equivalent to not having braces
}
}
use m::E; // OK, only the type is imported
fn main() {
let _: E = m::E;
//~^ ERROR expected value, found enum `m::E`
let _: E = m::E::Fn;
//~^ ERROR mismatched types
let _: E = m::E::Struct;
//~^ ERROR expected value, found struct variant `m::E::Struct`
let _: E = m::E::Unit();
//~^ ERROR expected function, found enum variant `m::E::Unit`
let _: E = E;
//~^ ERROR expected value, found enum `E`
let _: E = E::Fn;
//~^ ERROR mismatched types
let _: E = E::Struct;
//~^ ERROR expected value, found struct variant `E::Struct`
let _: E = E::Unit();
//~^ ERROR expected function, found enum variant `E::Unit`
let _: Z = m::n::Z;
//~^ ERROR cannot find type `Z` in this scope
//~| ERROR expected value, found enum `m::n::Z`
//~| ERROR enum `Z` is private
let _: Z = m::n::Z::Fn;
//~^ ERROR cannot find type `Z` in this scope
//~| ERROR enum `Z` is private
let _: Z = m::n::Z::Struct;
//~^ ERROR cannot find type `Z` in this scope
//~| ERROR expected value, found struct variant `m::n::Z::Struct`
//~| ERROR enum `Z` is private
let _: Z = m::n::Z::Unit {};
//~^ ERROR cannot find type `Z` in this scope
//~| ERROR enum `Z` is private
}
|