Skip to content

Commit 1b83dcf

Browse files
committedMay 25, 2022
Update tests.
1 parent 47080ea commit 1b83dcf

6 files changed

+216
-180
lines changed
 

‎src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ fn main() {
4444

4545
// Release success order forbids failure order of Acquire or SeqCst
4646
let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire);
47-
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
47+
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
4848
let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst);
49-
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
49+
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
5050

5151
// Relaxed success order also forbids failure order of Acquire or SeqCst
5252
let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst);
53-
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
53+
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
5454
let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire);
55-
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
55+
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
5656

5757
// Acquire/AcqRel forbids failure order of SeqCst
5858
let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst);
59-
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
59+
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
6060
let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst);
61-
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
61+
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
6262
}
Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,143 @@
1-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
1+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
22
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:22:67
33
|
44
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel);
5-
| ^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^ invalid failure ordering
66
|
77
= note: `#[deny(invalid_atomic_ordering)]` on by default
8-
= help: consider using ordering mode `Relaxed` instead
8+
= help: consider using Acquire or Relaxed failure ordering instead
99

10-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
10+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
1111
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:24:67
1212
|
1313
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel);
14-
| ^^^^^^^^^^^^^^^^
14+
| ^^^^^^^^^^^^^^^^ invalid failure ordering
1515
|
16-
= help: consider using ordering modes `Acquire` or `Relaxed` instead
16+
= help: consider using Acquire or Relaxed failure ordering instead
1717

18-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
18+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
1919
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:26:67
2020
|
2121
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel);
22-
| ^^^^^^^^^^^^^^^^
22+
| ^^^^^^^^^^^^^^^^ invalid failure ordering
2323
|
24-
= help: consider using ordering mode `Relaxed` instead
24+
= help: consider using Acquire or Relaxed failure ordering instead
2525

26-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
26+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
2727
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:28:66
2828
|
2929
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel);
30-
| ^^^^^^^^^^^^^^^^
30+
| ^^^^^^^^^^^^^^^^ invalid failure ordering
3131
|
32-
= help: consider using ordering modes `Acquire` or `Relaxed` instead
32+
= help: consider using Acquire or Relaxed failure ordering instead
3333

34-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
34+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
3535
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:30:66
3636
|
3737
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel);
38-
| ^^^^^^^^^^^^^^^^
38+
| ^^^^^^^^^^^^^^^^ invalid failure ordering
3939
|
40-
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead
40+
= help: consider using Acquire or Relaxed failure ordering instead
4141

42-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
42+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
4343
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:34:67
4444
|
4545
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release);
46-
| ^^^^^^^^^^^^^^^^^
46+
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
4747
|
48-
= help: consider using ordering mode `Relaxed` instead
48+
= help: consider using Acquire or Relaxed failure ordering instead
4949

50-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
50+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
5151
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:36:67
5252
|
5353
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release);
54-
| ^^^^^^^^^^^^^^^^^
54+
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
5555
|
56-
= help: consider using ordering modes `Acquire` or `Relaxed` instead
56+
= help: consider using Acquire or Relaxed failure ordering instead
5757

58-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
58+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
5959
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:38:67
6060
|
6161
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release);
62-
| ^^^^^^^^^^^^^^^^^
62+
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
6363
|
64-
= help: consider using ordering mode `Relaxed` instead
64+
= help: consider using Acquire or Relaxed failure ordering instead
6565

66-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
66+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
6767
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:40:66
6868
|
6969
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release);
70-
| ^^^^^^^^^^^^^^^^^
70+
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
7171
|
72-
= help: consider using ordering modes `Acquire` or `Relaxed` instead
72+
= help: consider using Acquire or Relaxed failure ordering instead
7373

74-
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
74+
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange_weak does not result in a write
7575
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:42:66
7676
|
7777
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release);
78-
| ^^^^^^^^^^^^^^^^^
78+
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
7979
|
80-
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead
80+
= help: consider using Acquire or Relaxed failure ordering instead
8181

82-
error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Release`
83-
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:46:67
82+
error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering
83+
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:46:48
8484
|
8585
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire);
86-
| ^^^^^^^^^^^^^^^^^
86+
| ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering
87+
| |
88+
| Release success ordering
8789
|
88-
= help: consider using ordering mode `Relaxed` instead
90+
= help: consider using AcqRel success ordering instead
8991

90-
error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Release`
91-
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:48:67
92+
error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering
93+
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:48:48
9294
|
9395
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst);
94-
| ^^^^^^^^^^^^^^^^
96+
| ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering
97+
| |
98+
| Release success ordering
9599
|
96-
= help: consider using ordering mode `Relaxed` instead
100+
= help: consider using SeqCst success ordering instead
97101

98-
error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Relaxed`
99-
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:52:67
102+
error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering
103+
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:52:48
100104
|
101105
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst);
102-
| ^^^^^^^^^^^^^^^^
106+
| ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering
107+
| |
108+
| Relaxed success ordering
103109
|
104-
= help: consider using ordering mode `Relaxed` instead
110+
= help: consider using SeqCst success ordering instead
105111

106-
error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Relaxed`
107-
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:54:67
112+
error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering
113+
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:54:48
108114
|
109115
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire);
110-
| ^^^^^^^^^^^^^^^^^
116+
| ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering
117+
| |
118+
| Relaxed success ordering
111119
|
112-
= help: consider using ordering mode `Relaxed` instead
120+
= help: consider using Acquire success ordering instead
113121

114-
error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Acquire`
115-
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:58:67
122+
error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering
123+
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:58:48
116124
|
117125
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst);
118-
| ^^^^^^^^^^^^^^^^
126+
| ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering
127+
| |
128+
| Acquire success ordering
119129
|
120-
= help: consider using ordering modes `Acquire` or `Relaxed` instead
130+
= help: consider using SeqCst success ordering instead
121131

122-
error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `AcqRel`
123-
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:60:66
132+
error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering
133+
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:60:48
124134
|
125135
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst);
126-
| ^^^^^^^^^^^^^^^^
136+
| ^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering
137+
| |
138+
| AcqRel success ordering
127139
|
128-
= help: consider using ordering modes `Acquire` or `Relaxed` instead
140+
= help: consider using SeqCst success ordering instead
129141

130142
error: aborting due to 16 previous errors
131143

‎src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ fn main() {
4242

4343
// Release success order forbids failure order of Acquire or SeqCst
4444
let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire);
45-
//~^ ERROR compare_exchange's failure ordering may not be stronger
45+
//~^ ERROR compare_exchange's success ordering must be at least as strong as
4646
let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst);
47-
//~^ ERROR compare_exchange's failure ordering may not be stronger
47+
//~^ ERROR compare_exchange's success ordering must be at least as strong as
4848

4949
// Relaxed success order also forbids failure order of Acquire or SeqCst
5050
let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst);
51-
//~^ ERROR compare_exchange's failure ordering may not be stronger
51+
//~^ ERROR compare_exchange's success ordering must be at least as strong as
5252
let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire);
53-
//~^ ERROR compare_exchange's failure ordering may not be stronger
53+
//~^ ERROR compare_exchange's success ordering must be at least as strong as
5454

5555
// Acquire/AcqRel forbids failure order of SeqCst
5656
let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst);
57-
//~^ ERROR compare_exchange's failure ordering may not be stronger
57+
//~^ ERROR compare_exchange's success ordering must be at least as strong as
5858
let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst);
59-
//~^ ERROR compare_exchange's failure ordering may not be stronger
59+
//~^ ERROR compare_exchange's success ordering must be at least as strong as
6060
}

0 commit comments

Comments
 (0)