Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update tests.
  • Loading branch information
m-ou-se committed May 25, 2022
commit 1b83dcffcee773bc94db998f8c37e1b1bfb67698
12 changes: 6 additions & 6 deletions src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ fn main() {

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

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

// Acquire/AcqRel forbids failure order of SeqCst
let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst);
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst);
//~^ ERROR compare_exchange_weak's failure ordering may not be stronger
//~^ ERROR compare_exchange_weak's success ordering must be at least as strong as
}
120 changes: 66 additions & 54 deletions src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr
Original file line number Diff line number Diff line change
@@ -1,131 +1,143 @@
error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:22:67
|
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel);
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^ invalid failure ordering
|
= note: `#[deny(invalid_atomic_ordering)]` on by default
= help: consider using ordering mode `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:24:67
|
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel);
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering modes `Acquire` or `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:26:67
|
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel);
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering mode `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:28:66
|
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel);
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering modes `Acquire` or `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:30:66
|
LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel);
| ^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:34:67
|
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release);
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering mode `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:36:67
|
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release);
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering modes `Acquire` or `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:38:67
|
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release);
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering mode `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:40:66
|
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release);
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering modes `Acquire` or `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel`
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
--> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:42:66
|
LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release);
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^ invalid failure ordering
|
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead
= help: consider using Acquire or Relaxed failure ordering instead

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

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

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

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

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

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

error: aborting due to 16 previous errors

12 changes: 6 additions & 6 deletions src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ fn main() {

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

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

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