Skip to content

Commit 0726760

Browse files
committed
better variable names
1 parent db20f24 commit 0726760

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/test/ui/consts/miri_unleashed/const_refers_to_static.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
use std::sync::atomic::AtomicUsize;
77
use std::sync::atomic::Ordering;
88

9-
const BOO: &usize = { //~ ERROR undefined behavior to use this value
9+
const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this value
1010
static FOO: AtomicUsize = AtomicUsize::new(0);
1111
unsafe { &*(&FOO as *const _ as *const usize) }
1212
//~^ WARN skipping const checks
1313
};
1414

15-
const FOO: usize = {
15+
const MUTATE_INTERIOR_MUT: usize = {
1616
static FOO: AtomicUsize = AtomicUsize::new(0);
1717
FOO.fetch_add(1, Ordering::Relaxed) //~ WARN any use of this value will cause an error
1818
//~^ WARN skipping const checks
1919
//~| WARN skipping const checks
2020
};
2121

22-
const BAR: usize = {
22+
const READ_INTERIOR_MUT: usize = {
2323
static FOO: AtomicUsize = AtomicUsize::new(0);
2424
unsafe { *(&FOO as *const _ as *const usize) } //~ WARN any use of this value will cause an err
2525
//~^ WARN skipping const checks
2626
};
2727

2828
static mut MUTABLE: u32 = 0;
29-
const BAD: u32 = unsafe { MUTABLE }; //~ WARN any use of this value will cause an error
29+
const READ_MUT: u32 = unsafe { MUTABLE }; //~ WARN any use of this value will cause an error
3030
//~^ WARN skipping const checks
3131

3232
// ok some day perhaps
33-
const BOO_OK: &usize = { //~ ERROR it is undefined behavior to use this value
33+
const READ_IMMUT: &usize = { //~ ERROR it is undefined behavior to use this value
3434
static FOO: usize = 0;
3535
&FOO
3636
//~^ WARN skipping const checks

src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ LL | unsafe { *(&FOO as *const _ as *const usize) }
2323
| ^^^
2424

2525
warning: skipping const checks
26-
--> $DIR/const_refers_to_static.rs:29:27
26+
--> $DIR/const_refers_to_static.rs:29:32
2727
|
28-
LL | const BAD: u32 = unsafe { MUTABLE };
29-
| ^^^^^^^
28+
LL | const READ_MUT: u32 = unsafe { MUTABLE };
29+
| ^^^^^^^
3030

3131
warning: skipping const checks
3232
--> $DIR/const_refers_to_static.rs:35:6
@@ -37,7 +37,7 @@ LL | &FOO
3737
error[E0080]: it is undefined behavior to use this value
3838
--> $DIR/const_refers_to_static.rs:9:1
3939
|
40-
LL | / const BOO: &usize = {
40+
LL | / const REF_INTERIOR_MUT: &usize = {
4141
LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
4242
LL | | unsafe { &*(&FOO as *const _ as *const usize) }
4343
LL | |
@@ -49,7 +49,7 @@ LL | | };
4949
warning: any use of this value will cause an error
5050
--> $DIR/const_refers_to_static.rs:17:5
5151
|
52-
LL | / const FOO: usize = {
52+
LL | / const MUTATE_INTERIOR_MUT: usize = {
5353
LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
5454
LL | | FOO.fetch_add(1, Ordering::Relaxed)
5555
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `std::sync::atomic::AtomicUsize::fetch_add`
@@ -67,7 +67,7 @@ LL | #![warn(const_err)]
6767
warning: any use of this value will cause an error
6868
--> $DIR/const_refers_to_static.rs:24:14
6969
|
70-
LL | / const BAR: usize = {
70+
LL | / const READ_INTERIOR_MUT: usize = {
7171
LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
7272
LL | | unsafe { *(&FOO as *const _ as *const usize) }
7373
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
@@ -76,17 +76,17 @@ LL | | };
7676
| |__-
7777

7878
warning: any use of this value will cause an error
79-
--> $DIR/const_refers_to_static.rs:29:27
79+
--> $DIR/const_refers_to_static.rs:29:32
8080
|
81-
LL | const BAD: u32 = unsafe { MUTABLE };
82-
| --------------------------^^^^^^^---
83-
| |
84-
| constant accesses static
81+
LL | const READ_MUT: u32 = unsafe { MUTABLE };
82+
| -------------------------------^^^^^^^---
83+
| |
84+
| constant accesses static
8585

8686
error[E0080]: it is undefined behavior to use this value
8787
--> $DIR/const_refers_to_static.rs:33:1
8888
|
89-
LL | / const BOO_OK: &usize = {
89+
LL | / const READ_IMMUT: &usize = {
9090
LL | | static FOO: usize = 0;
9191
LL | | &FOO
9292
LL | |

0 commit comments

Comments
 (0)