1
1
warning: skipping const checks
2
- --> $DIR/const_refers_to_static_cross_crate.rs:15 :15
2
+ --> $DIR/const_refers_to_static_cross_crate.rs:14 :15
3
3
|
4
4
LL | unsafe { &static_cross_crate::ZERO }
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^
6
6
7
7
error[E0080]: it is undefined behavior to use this value
8
- --> $DIR/const_refers_to_static_cross_crate.rs:12 :1
8
+ --> $DIR/const_refers_to_static_cross_crate.rs:11 :1
9
9
|
10
10
LL | / const SLICE_MUT: &[u8; 1] = {
11
11
LL | |
@@ -18,21 +18,21 @@ LL | | };
18
18
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
19
19
20
20
error: could not evaluate constant pattern
21
- --> $DIR/const_refers_to_static_cross_crate.rs:28 :9
21
+ --> $DIR/const_refers_to_static_cross_crate.rs:43 :9
22
22
|
23
23
LL | SLICE_MUT => true,
24
24
| ^^^^^^^^^
25
25
26
26
warning: skipping const checks
27
- --> $DIR/const_refers_to_static_cross_crate.rs:22 :15
27
+ --> $DIR/const_refers_to_static_cross_crate.rs:21 :15
28
28
|
29
29
LL | unsafe { &static_cross_crate::ZERO[0] }
30
30
| ^^^^^^^^^^^^^^^^^^^^^^^^
31
31
32
32
error[E0080]: it is undefined behavior to use this value
33
- --> $DIR/const_refers_to_static_cross_crate.rs:19 :1
33
+ --> $DIR/const_refers_to_static_cross_crate.rs:18 :1
34
34
|
35
- LL | / const SLICE_MUT2 : &u8 = {
35
+ LL | / const U8_MUT : &u8 = {
36
36
LL | |
37
37
LL | |
38
38
LL | | unsafe { &static_cross_crate::ZERO[0] }
@@ -43,11 +43,71 @@ LL | | };
43
43
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
44
44
45
45
error: could not evaluate constant pattern
46
- --> $DIR/const_refers_to_static_cross_crate.rs:36 :9
46
+ --> $DIR/const_refers_to_static_cross_crate.rs:51 :9
47
47
|
48
- LL | SLICE_MUT2 => true,
49
- | ^^^^^^^^^^
48
+ LL | U8_MUT => true,
49
+ | ^^^^^^
50
50
51
- error: aborting due to 4 previous errors; 2 warnings emitted
51
+ warning: skipping const checks
52
+ --> $DIR/const_refers_to_static_cross_crate.rs:28:17
53
+ |
54
+ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
55
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56
+
57
+ warning: any use of this value will cause an error
58
+ --> $DIR/const_refers_to_static_cross_crate.rs:28:14
59
+ |
60
+ LL | / const U8_MUT2: &u8 = {
61
+ LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
62
+ | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
63
+ LL | |
64
+ LL | |
65
+ LL | |
66
+ LL | | };
67
+ | |__-
68
+ |
69
+ note: the lint level is defined here
70
+ --> $DIR/const_refers_to_static_cross_crate.rs:26:8
71
+ |
72
+ LL | #[warn(const_err)]
73
+ | ^^^^^^^^^
74
+
75
+ error: could not evaluate constant pattern
76
+ --> $DIR/const_refers_to_static_cross_crate.rs:61:9
77
+ |
78
+ LL | U8_MUT2 => true,
79
+ | ^^^^^^^
80
+
81
+ warning: skipping const checks
82
+ --> $DIR/const_refers_to_static_cross_crate.rs:35:20
83
+ |
84
+ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
85
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86
+
87
+ warning: any use of this value will cause an error
88
+ --> $DIR/const_refers_to_static_cross_crate.rs:35:51
89
+ |
90
+ LL | / const U8_MUT3: &u8 = {
91
+ LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
92
+ | | ^^^^^^^^^^^ constant accesses static
93
+ LL | |
94
+ LL | |
95
+ LL | |
96
+ LL | | };
97
+ | |__-
98
+ |
99
+ note: the lint level is defined here
100
+ --> $DIR/const_refers_to_static_cross_crate.rs:33:8
101
+ |
102
+ LL | #[warn(const_err)]
103
+ | ^^^^^^^^^
104
+
105
+ error: could not evaluate constant pattern
106
+ --> $DIR/const_refers_to_static_cross_crate.rs:68:9
107
+ |
108
+ LL | U8_MUT3 => true,
109
+ | ^^^^^^^
110
+
111
+ error: aborting due to 6 previous errors; 6 warnings emitted
52
112
53
113
For more information about this error, try `rustc --explain E0080`.
0 commit comments