From 295225b660e1ddfd4a476a14aa12b37ae140f91d Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Wed, 2 Dec 2020 15:16:12 -0800 Subject: [PATCH] Uplift the `invalid_atomic_ordering` lint from clippy to rustc - Deprecate clippy::invalid_atomic_ordering - Use rustc_diagnostic_item for the orderings in the invalid_atomic_ordering lint - Reduce code duplication - Give up on making enum variants diagnostic items and just look for `Ordering` instead I ran into tons of trouble with this because apparently the change to store HIR attrs in a side table also gave the DefIds of the constructor instead of the variant itself. So I had to change `matches_ordering` to also check the grandparent of the defid as well. - Rename `atomic_ordering_x` symbols to just the name of the variant - Fix typos in checks - there were a few places that said "may not be Release" in the diagnostic but actually checked for SeqCst in the lint. - Make constant items const - Use fewer diagnostic items - Only look at arguments after making sure the method matches This prevents an ICE when there aren't enough arguments. - Ignore trait methods - Only check Ctors instead of going through `qpath_res` The functions take values, so this couldn't ever be anything else. - Add if_chain to allowed dependencies - Fix grammar - Remove unnecessary allow --- clippy_lints/src/atomic_ordering.rs | 230 ------------------ clippy_lints/src/lib.rs | 6 +- tests/ui/atomic_ordering_bool.rs | 25 -- tests/ui/atomic_ordering_bool.stderr | 35 --- tests/ui/atomic_ordering_exchange.rs | 45 ---- tests/ui/atomic_ordering_exchange.stderr | 131 ---------- tests/ui/atomic_ordering_exchange_weak.rs | 47 ---- tests/ui/atomic_ordering_exchange_weak.stderr | 131 ---------- tests/ui/atomic_ordering_fence.rs | 20 -- tests/ui/atomic_ordering_fence.stderr | 19 -- tests/ui/atomic_ordering_fetch_update.rs | 45 ---- tests/ui/atomic_ordering_fetch_update.stderr | 131 ---------- tests/ui/atomic_ordering_int.rs | 86 ------- tests/ui/atomic_ordering_int.stderr | 163 ------------- tests/ui/atomic_ordering_ptr.rs | 27 -- tests/ui/atomic_ordering_ptr.stderr | 35 --- tests/ui/atomic_ordering_uint.rs | 86 ------- tests/ui/atomic_ordering_uint.stderr | 163 ------------- tests/ui/deprecated.rs | 1 + tests/ui/deprecated.stderr | 8 +- 20 files changed, 9 insertions(+), 1425 deletions(-) delete mode 100644 clippy_lints/src/atomic_ordering.rs delete mode 100644 tests/ui/atomic_ordering_bool.rs delete mode 100644 tests/ui/atomic_ordering_bool.stderr delete mode 100644 tests/ui/atomic_ordering_exchange.rs delete mode 100644 tests/ui/atomic_ordering_exchange.stderr delete mode 100644 tests/ui/atomic_ordering_exchange_weak.rs delete mode 100644 tests/ui/atomic_ordering_exchange_weak.stderr delete mode 100644 tests/ui/atomic_ordering_fence.rs delete mode 100644 tests/ui/atomic_ordering_fence.stderr delete mode 100644 tests/ui/atomic_ordering_fetch_update.rs delete mode 100644 tests/ui/atomic_ordering_fetch_update.stderr delete mode 100644 tests/ui/atomic_ordering_int.rs delete mode 100644 tests/ui/atomic_ordering_int.stderr delete mode 100644 tests/ui/atomic_ordering_ptr.rs delete mode 100644 tests/ui/atomic_ordering_ptr.stderr delete mode 100644 tests/ui/atomic_ordering_uint.rs delete mode 100644 tests/ui/atomic_ordering_uint.stderr diff --git a/clippy_lints/src/atomic_ordering.rs b/clippy_lints/src/atomic_ordering.rs deleted file mode 100644 index cece28e8b3c..00000000000 --- a/clippy_lints/src/atomic_ordering.rs +++ /dev/null @@ -1,230 +0,0 @@ -use clippy_utils::diagnostics::span_lint_and_help; -use clippy_utils::match_def_path; -use if_chain::if_chain; -use rustc_hir::def_id::DefId; -use rustc_hir::{Expr, ExprKind}; -use rustc_lint::{LateContext, LateLintPass}; -use rustc_middle::ty; -use rustc_session::{declare_lint_pass, declare_tool_lint}; - -declare_clippy_lint! { - /// ### What it does - /// Checks for usage of invalid atomic - /// ordering in atomic loads/stores/exchanges/updates and - /// memory fences. - /// - /// ### Why is this bad? - /// Using an invalid atomic ordering - /// will cause a panic at run-time. - /// - /// ### Example - /// ```rust,no_run - /// # use std::sync::atomic::{self, AtomicU8, Ordering}; - /// - /// let x = AtomicU8::new(0); - /// - /// // Bad: `Release` and `AcqRel` cannot be used for `load`. - /// let _ = x.load(Ordering::Release); - /// let _ = x.load(Ordering::AcqRel); - /// - /// // Bad: `Acquire` and `AcqRel` cannot be used for `store`. - /// x.store(1, Ordering::Acquire); - /// x.store(2, Ordering::AcqRel); - /// - /// // Bad: `Relaxed` cannot be used as a fence's ordering. - /// atomic::fence(Ordering::Relaxed); - /// atomic::compiler_fence(Ordering::Relaxed); - /// - /// // Bad: `Release` and `AcqRel` are both always invalid - /// // for the failure ordering (the last arg). - /// let _ = x.compare_exchange(1, 2, Ordering::SeqCst, Ordering::Release); - /// let _ = x.compare_exchange_weak(2, 3, Ordering::AcqRel, Ordering::AcqRel); - /// - /// // Bad: The failure ordering is not allowed to be - /// // stronger than the success order, and `SeqCst` is - /// // stronger than `Relaxed`. - /// let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |val| Some(val + val)); - /// ``` - pub INVALID_ATOMIC_ORDERING, - correctness, - "usage of invalid atomic ordering in atomic operations and memory fences" -} - -declare_lint_pass!(AtomicOrdering => [INVALID_ATOMIC_ORDERING]); - -const ATOMIC_TYPES: [&str; 12] = [ - "AtomicBool", - "AtomicI8", - "AtomicI16", - "AtomicI32", - "AtomicI64", - "AtomicIsize", - "AtomicPtr", - "AtomicU8", - "AtomicU16", - "AtomicU32", - "AtomicU64", - "AtomicUsize", -]; - -fn type_is_atomic(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { - if let ty::Adt(&ty::AdtDef { did, .. }, _) = cx.typeck_results().expr_ty(expr).kind() { - ATOMIC_TYPES - .iter() - .any(|ty| match_def_path(cx, did, &["core", "sync", "atomic", ty])) - } else { - false - } -} - -fn match_ordering_def_path(cx: &LateContext<'_>, did: DefId, orderings: &[&str]) -> bool { - orderings - .iter() - .any(|ordering| match_def_path(cx, did, &["core", "sync", "atomic", "Ordering", ordering])) -} - -fn check_atomic_load_store(cx: &LateContext<'_>, expr: &Expr<'_>) { - if_chain! { - if let ExprKind::MethodCall(method_path, _, args, _) = &expr.kind; - let method = method_path.ident.name.as_str(); - if type_is_atomic(cx, &args[0]); - if method == "load" || method == "store"; - let ordering_arg = if method == "load" { &args[1] } else { &args[2] }; - if let ExprKind::Path(ref ordering_qpath) = ordering_arg.kind; - if let Some(ordering_def_id) = cx.qpath_res(ordering_qpath, ordering_arg.hir_id).opt_def_id(); - then { - if method == "load" && - match_ordering_def_path(cx, ordering_def_id, &["Release", "AcqRel"]) { - span_lint_and_help( - cx, - INVALID_ATOMIC_ORDERING, - ordering_arg.span, - "atomic loads cannot have `Release` and `AcqRel` ordering", - None, - "consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`" - ); - } else if method == "store" && - match_ordering_def_path(cx, ordering_def_id, &["Acquire", "AcqRel"]) { - span_lint_and_help( - cx, - INVALID_ATOMIC_ORDERING, - ordering_arg.span, - "atomic stores cannot have `Acquire` and `AcqRel` ordering", - None, - "consider using ordering modes `Release`, `SeqCst` or `Relaxed`" - ); - } - } - } -} - -fn check_memory_fence(cx: &LateContext<'_>, expr: &Expr<'_>) { - if_chain! { - if let ExprKind::Call(func, args) = expr.kind; - if let ExprKind::Path(ref func_qpath) = func.kind; - if let Some(def_id) = cx.qpath_res(func_qpath, func.hir_id).opt_def_id(); - if ["fence", "compiler_fence"] - .iter() - .any(|func| match_def_path(cx, def_id, &["core", "sync", "atomic", func])); - if let ExprKind::Path(ref ordering_qpath) = &args[0].kind; - if let Some(ordering_def_id) = cx.qpath_res(ordering_qpath, args[0].hir_id).opt_def_id(); - if match_ordering_def_path(cx, ordering_def_id, &["Relaxed"]); - then { - span_lint_and_help( - cx, - INVALID_ATOMIC_ORDERING, - args[0].span, - "memory fences cannot have `Relaxed` ordering", - None, - "consider using ordering modes `Acquire`, `Release`, `AcqRel` or `SeqCst`" - ); - } - } -} - -fn opt_ordering_defid(cx: &LateContext<'_>, ord_arg: &Expr<'_>) -> Option { - if let ExprKind::Path(ref ord_qpath) = ord_arg.kind { - cx.qpath_res(ord_qpath, ord_arg.hir_id).opt_def_id() - } else { - None - } -} - -fn check_atomic_compare_exchange(cx: &LateContext<'_>, expr: &Expr<'_>) { - if_chain! { - if let ExprKind::MethodCall(method_path, _, args, _) = &expr.kind; - let method = method_path.ident.name.as_str(); - if type_is_atomic(cx, &args[0]); - if method == "compare_exchange" || method == "compare_exchange_weak" || method == "fetch_update"; - let (success_order_arg, failure_order_arg) = if method == "fetch_update" { - (&args[1], &args[2]) - } else { - (&args[3], &args[4]) - }; - if let Some(fail_ordering_def_id) = opt_ordering_defid(cx, failure_order_arg); - then { - // Helper type holding on to some checking and error reporting data. Has - // - (success ordering name, - // - list of failure orderings forbidden by the success order, - // - suggestion message) - type OrdLintInfo = (&'static str, &'static [&'static str], &'static str); - let relaxed: OrdLintInfo = ("Relaxed", &["SeqCst", "Acquire"], "ordering mode `Relaxed`"); - let acquire: OrdLintInfo = ("Acquire", &["SeqCst"], "ordering modes `Acquire` or `Relaxed`"); - let seq_cst: OrdLintInfo = ("SeqCst", &[], "ordering modes `Acquire`, `SeqCst` or `Relaxed`"); - let release = ("Release", relaxed.1, relaxed.2); - let acqrel = ("AcqRel", acquire.1, acquire.2); - let search = [relaxed, acquire, seq_cst, release, acqrel]; - - let success_lint_info = opt_ordering_defid(cx, success_order_arg) - .and_then(|success_ord_def_id| -> Option { - search - .iter() - .find(|(ordering, ..)| { - match_def_path(cx, success_ord_def_id, - &["core", "sync", "atomic", "Ordering", ordering]) - }) - .copied() - }); - - if match_ordering_def_path(cx, fail_ordering_def_id, &["Release", "AcqRel"]) { - // If we don't know the success order is, use what we'd suggest - // if it were maximally permissive. - let suggested = success_lint_info.unwrap_or(seq_cst).2; - span_lint_and_help( - cx, - INVALID_ATOMIC_ORDERING, - failure_order_arg.span, - &format!( - "{}'s failure ordering may not be `Release` or `AcqRel`", - method, - ), - None, - &format!("consider using {} instead", suggested), - ); - } else if let Some((success_ord_name, bad_ords_given_success, suggested)) = success_lint_info { - if match_ordering_def_path(cx, fail_ordering_def_id, bad_ords_given_success) { - span_lint_and_help( - cx, - INVALID_ATOMIC_ORDERING, - failure_order_arg.span, - &format!( - "{}'s failure ordering may not be stronger than the success ordering of `{}`", - method, - success_ord_name, - ), - None, - &format!("consider using {} instead", suggested), - ); - } - } - } - } -} - -impl<'tcx> LateLintPass<'tcx> for AtomicOrdering { - fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { - check_atomic_load_store(cx, expr); - check_memory_fence(cx, expr); - check_atomic_compare_exchange(cx, expr); - } -} diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index f49b382c5ea..e455c8db03f 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -165,7 +165,6 @@ macro_rules! declare_clippy_lint { mod assertions_on_constants; mod assign_ops; mod async_yields_async; -mod atomic_ordering; mod attrs; mod await_holding_invalid; mod bit_mask; @@ -537,7 +536,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: assign_ops::ASSIGN_OP_PATTERN, assign_ops::MISREFACTORED_ASSIGN_OP, async_yields_async::ASYNC_YIELDS_ASYNC, - atomic_ordering::INVALID_ATOMIC_ORDERING, attrs::BLANKET_CLIPPY_RESTRICTION_LINTS, attrs::DEPRECATED_CFG_ATTR, attrs::DEPRECATED_SEMVER, @@ -1174,7 +1172,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(assign_ops::ASSIGN_OP_PATTERN), LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP), LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC), - LintId::of(atomic_ordering::INVALID_ATOMIC_ORDERING), LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS), LintId::of(attrs::DEPRECATED_CFG_ATTR), LintId::of(attrs::DEPRECATED_SEMVER), @@ -1670,7 +1667,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS), LintId::of(approx_const::APPROX_CONSTANT), LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC), - LintId::of(atomic_ordering::INVALID_ATOMIC_ORDERING), LintId::of(attrs::DEPRECATED_SEMVER), LintId::of(attrs::MISMATCHED_TARGET_OS), LintId::of(attrs::USELESS_ATTRIBUTE), @@ -2044,7 +2040,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_late_pass(|| box floating_point_arithmetic::FloatingPointArithmetic); store.register_early_pass(|| box as_conversions::AsConversions); store.register_late_pass(|| box let_underscore::LetUnderscore); - store.register_late_pass(|| box atomic_ordering::AtomicOrdering); store.register_early_pass(|| box single_component_path_imports::SingleComponentPathImports); let max_fn_params_bools = conf.max_fn_params_bools; let max_struct_bools = conf.max_struct_bools; @@ -2183,6 +2178,7 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) { ls.register_renamed("clippy::temporary_cstring_as_ptr", "temporary_cstring_as_ptr"); ls.register_renamed("clippy::panic_params", "non_fmt_panics"); ls.register_renamed("clippy::unknown_clippy_lints", "unknown_lints"); + ls.register_renamed("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"); } // only exists to let the dogfood integration test works. diff --git a/tests/ui/atomic_ordering_bool.rs b/tests/ui/atomic_ordering_bool.rs deleted file mode 100644 index cdbde79b19e..00000000000 --- a/tests/ui/atomic_ordering_bool.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{AtomicBool, Ordering}; - -fn main() { - let x = AtomicBool::new(true); - - // Allowed load ordering modes - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - - // Disallowed load ordering modes - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - // Allowed store ordering modes - x.store(false, Ordering::Release); - x.store(false, Ordering::SeqCst); - x.store(false, Ordering::Relaxed); - - // Disallowed store ordering modes - x.store(false, Ordering::Acquire); - x.store(false, Ordering::AcqRel); -} diff --git a/tests/ui/atomic_ordering_bool.stderr b/tests/ui/atomic_ordering_bool.stderr deleted file mode 100644 index 397b893aed9..00000000000 --- a/tests/ui/atomic_ordering_bool.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_bool.rs:14:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_bool.rs:15:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_bool.rs:23:20 - | -LL | x.store(false, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_bool.rs:24:20 - | -LL | x.store(false, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: aborting due to 4 previous errors - diff --git a/tests/ui/atomic_ordering_exchange.rs b/tests/ui/atomic_ordering_exchange.rs deleted file mode 100644 index 1ddc12f9ab2..00000000000 --- a/tests/ui/atomic_ordering_exchange.rs +++ /dev/null @@ -1,45 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{AtomicUsize, Ordering}; - -fn main() { - // `compare_exchange` (not weak) testing - let x = AtomicUsize::new(0); - - // Allowed ordering combos - let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Relaxed); - let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Acquire); - let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Relaxed); - let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Relaxed); - let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Acquire); - let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Relaxed); - let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Relaxed); - let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Acquire); - let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::SeqCst); - - // AcqRel is always forbidden as a failure ordering - let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); - let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); - let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); - let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); - let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); - - // Release is always forbidden as a failure ordering - let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); - let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); - let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); - let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); - let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); - - // Release success order forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); - - // Relaxed success order also forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); - let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); - - // Acquire/AcqRel forbids failure order of SeqCst - let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); - let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); -} diff --git a/tests/ui/atomic_ordering_exchange.stderr b/tests/ui/atomic_ordering_exchange.stderr deleted file mode 100644 index 4b9bfef7974..00000000000 --- a/tests/ui/atomic_ordering_exchange.stderr +++ /dev/null @@ -1,131 +0,0 @@ -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:21:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:22:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:23:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:24:56 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:25:56 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:28:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:29:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:30:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:31:56 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:32:56 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead - -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/atomic_ordering_exchange.rs:35:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/atomic_ordering_exchange.rs:36:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/atomic_ordering_exchange.rs:39:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/atomic_ordering_exchange.rs:40:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/atomic_ordering_exchange.rs:43:57 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/atomic_ordering_exchange.rs:44:56 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: aborting due to 16 previous errors - diff --git a/tests/ui/atomic_ordering_exchange_weak.rs b/tests/ui/atomic_ordering_exchange_weak.rs deleted file mode 100644 index 59069902507..00000000000 --- a/tests/ui/atomic_ordering_exchange_weak.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{AtomicPtr, Ordering}; - -fn main() { - let ptr = &mut 5; - let ptr2 = &mut 10; - // `compare_exchange_weak` testing - let x = AtomicPtr::new(ptr); - - // Allowed ordering combos - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Relaxed); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Acquire); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Relaxed); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Relaxed); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Acquire); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Relaxed); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Relaxed); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Acquire); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::SeqCst); - - // AcqRel is always forbidden as a failure ordering - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel); - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel); - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel); - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel); - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel); - - // Release is always forbidden as a failure ordering - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release); - - // Release success order forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire); - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst); - - // Relaxed success order also forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire); - - // Acquire/AcqRel forbids failure order of SeqCst - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst); - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst); -} diff --git a/tests/ui/atomic_ordering_exchange_weak.stderr b/tests/ui/atomic_ordering_exchange_weak.stderr deleted file mode 100644 index de7026f3ffa..00000000000 --- a/tests/ui/atomic_ordering_exchange_weak.stderr +++ /dev/null @@ -1,131 +0,0 @@ -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:23:67 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:24:67 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:25:67 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:26:66 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:27:66 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:30:67 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:31:67 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:32:67 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:33:66 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:34:66 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/atomic_ordering_exchange_weak.rs:37:67 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/atomic_ordering_exchange_weak.rs:38:67 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/atomic_ordering_exchange_weak.rs:41:67 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/atomic_ordering_exchange_weak.rs:42:67 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/atomic_ordering_exchange_weak.rs:45:67 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: compare_exchange_weak's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/atomic_ordering_exchange_weak.rs:46:66 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: aborting due to 16 previous errors - diff --git a/tests/ui/atomic_ordering_fence.rs b/tests/ui/atomic_ordering_fence.rs deleted file mode 100644 index 5ee5182ca05..00000000000 --- a/tests/ui/atomic_ordering_fence.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{compiler_fence, fence, Ordering}; - -fn main() { - // Allowed fence ordering modes - fence(Ordering::Acquire); - fence(Ordering::Release); - fence(Ordering::AcqRel); - fence(Ordering::SeqCst); - - // Disallowed fence ordering modes - fence(Ordering::Relaxed); - - compiler_fence(Ordering::Acquire); - compiler_fence(Ordering::Release); - compiler_fence(Ordering::AcqRel); - compiler_fence(Ordering::SeqCst); - compiler_fence(Ordering::Relaxed); -} diff --git a/tests/ui/atomic_ordering_fence.stderr b/tests/ui/atomic_ordering_fence.stderr deleted file mode 100644 index 3ceff27d9ad..00000000000 --- a/tests/ui/atomic_ordering_fence.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: memory fences cannot have `Relaxed` ordering - --> $DIR/atomic_ordering_fence.rs:13:11 - | -LL | fence(Ordering::Relaxed); - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering modes `Acquire`, `Release`, `AcqRel` or `SeqCst` - -error: memory fences cannot have `Relaxed` ordering - --> $DIR/atomic_ordering_fence.rs:19:20 - | -LL | compiler_fence(Ordering::Relaxed); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `Release`, `AcqRel` or `SeqCst` - -error: aborting due to 2 previous errors - diff --git a/tests/ui/atomic_ordering_fetch_update.rs b/tests/ui/atomic_ordering_fetch_update.rs deleted file mode 100644 index 550bdb001e4..00000000000 --- a/tests/ui/atomic_ordering_fetch_update.rs +++ /dev/null @@ -1,45 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{AtomicIsize, Ordering}; - -fn main() { - // `fetch_update` testing - let x = AtomicIsize::new(0); - - // Allowed ordering combos - let _ = x.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Acquire, Ordering::Acquire, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Acquire, Ordering::Relaxed, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Release, Ordering::Relaxed, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::AcqRel, Ordering::Acquire, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::AcqRel, Ordering::Relaxed, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::SeqCst, Ordering::Relaxed, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::SeqCst, Ordering::Acquire, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |old| Some(old + 1)); - - // AcqRel is always forbidden as a failure ordering - let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); - - // Release is always forbidden as a failure ordering - let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); - - // Release success order forbids failure order of Acquire or SeqCst - let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - - // Relaxed success order also forbids failure order of Acquire or SeqCst - let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - - // Acquire/AcqRel forbids failure order of SeqCst - let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); -} diff --git a/tests/ui/atomic_ordering_fetch_update.stderr b/tests/ui/atomic_ordering_fetch_update.stderr deleted file mode 100644 index 694548ece97..00000000000 --- a/tests/ui/atomic_ordering_fetch_update.stderr +++ /dev/null @@ -1,131 +0,0 @@ -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:21:47 - | -LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:22:47 - | -LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:23:47 - | -LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:24:46 - | -LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:25:46 - | -LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:28:47 - | -LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:29:47 - | -LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:30:47 - | -LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:31:46 - | -LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: fetch_update's failure ordering may not be `Release` or `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:32:46 - | -LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead - -error: fetch_update's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/atomic_ordering_fetch_update.rs:35:47 - | -LL | let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/atomic_ordering_fetch_update.rs:36:47 - | -LL | let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/atomic_ordering_fetch_update.rs:39:47 - | -LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/atomic_ordering_fetch_update.rs:40:47 - | -LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering mode `Relaxed` instead - -error: fetch_update's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/atomic_ordering_fetch_update.rs:43:47 - | -LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: fetch_update's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/atomic_ordering_fetch_update.rs:44:46 - | -LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire` or `Relaxed` instead - -error: aborting due to 16 previous errors - diff --git a/tests/ui/atomic_ordering_int.rs b/tests/ui/atomic_ordering_int.rs deleted file mode 100644 index 40a00ba3de3..00000000000 --- a/tests/ui/atomic_ordering_int.rs +++ /dev/null @@ -1,86 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{AtomicI16, AtomicI32, AtomicI64, AtomicI8, AtomicIsize, Ordering}; - -fn main() { - // `AtomicI8` test cases - let x = AtomicI8::new(0); - - // Allowed load ordering modes - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - - // Disallowed load ordering modes - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - // Allowed store ordering modes - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - - // Disallowed store ordering modes - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicI16` test cases - let x = AtomicI16::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicI32` test cases - let x = AtomicI32::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicI64` test cases - let x = AtomicI64::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicIsize` test cases - let x = AtomicIsize::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); -} diff --git a/tests/ui/atomic_ordering_int.stderr b/tests/ui/atomic_ordering_int.stderr deleted file mode 100644 index bbaf234d3c9..00000000000 --- a/tests/ui/atomic_ordering_int.stderr +++ /dev/null @@ -1,163 +0,0 @@ -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:15:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:16:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:24:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:25:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:33:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:34:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:39:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:40:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:48:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:49:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:54:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:55:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:63:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:64:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:69:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:70:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:78:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:79:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:84:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_int.rs:85:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: aborting due to 20 previous errors - diff --git a/tests/ui/atomic_ordering_ptr.rs b/tests/ui/atomic_ordering_ptr.rs deleted file mode 100644 index ecbb05c7fbc..00000000000 --- a/tests/ui/atomic_ordering_ptr.rs +++ /dev/null @@ -1,27 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{AtomicPtr, Ordering}; - -fn main() { - let ptr = &mut 5; - let other_ptr = &mut 10; - let x = AtomicPtr::new(ptr); - - // Allowed load ordering modes - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - - // Disallowed load ordering modes - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - // Allowed store ordering modes - x.store(other_ptr, Ordering::Release); - x.store(other_ptr, Ordering::SeqCst); - x.store(other_ptr, Ordering::Relaxed); - - // Disallowed store ordering modes - x.store(other_ptr, Ordering::Acquire); - x.store(other_ptr, Ordering::AcqRel); -} diff --git a/tests/ui/atomic_ordering_ptr.stderr b/tests/ui/atomic_ordering_ptr.stderr deleted file mode 100644 index 558ae55518d..00000000000 --- a/tests/ui/atomic_ordering_ptr.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_ptr.rs:16:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_ptr.rs:17:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_ptr.rs:25:24 - | -LL | x.store(other_ptr, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_ptr.rs:26:24 - | -LL | x.store(other_ptr, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: aborting due to 4 previous errors - diff --git a/tests/ui/atomic_ordering_uint.rs b/tests/ui/atomic_ordering_uint.rs deleted file mode 100644 index a0d5d7c4010..00000000000 --- a/tests/ui/atomic_ordering_uint.rs +++ /dev/null @@ -1,86 +0,0 @@ -#![warn(clippy::invalid_atomic_ordering)] - -use std::sync::atomic::{AtomicU16, AtomicU32, AtomicU64, AtomicU8, AtomicUsize, Ordering}; - -fn main() { - // `AtomicU8` test cases - let x = AtomicU8::new(0); - - // Allowed load ordering modes - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - - // Disallowed load ordering modes - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - // Allowed store ordering modes - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - - // Disallowed store ordering modes - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicU16` test cases - let x = AtomicU16::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicU32` test cases - let x = AtomicU32::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicU64` test cases - let x = AtomicU64::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); - - // `AtomicUsize` test cases - let x = AtomicUsize::new(0); - - let _ = x.load(Ordering::Acquire); - let _ = x.load(Ordering::SeqCst); - let _ = x.load(Ordering::Relaxed); - let _ = x.load(Ordering::Release); - let _ = x.load(Ordering::AcqRel); - - x.store(1, Ordering::Release); - x.store(1, Ordering::SeqCst); - x.store(1, Ordering::Relaxed); - x.store(1, Ordering::Acquire); - x.store(1, Ordering::AcqRel); -} diff --git a/tests/ui/atomic_ordering_uint.stderr b/tests/ui/atomic_ordering_uint.stderr deleted file mode 100644 index 5703135bcf1..00000000000 --- a/tests/ui/atomic_ordering_uint.stderr +++ /dev/null @@ -1,163 +0,0 @@ -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:15:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings` - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:16:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:24:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:25:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:33:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:34:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:39:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:40:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:48:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:49:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:54:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:55:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:63:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:64:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:69:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:70:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:78:20 - | -LL | let _ = x.load(Ordering::Release); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic loads cannot have `Release` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:79:20 - | -LL | let _ = x.load(Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:84:16 - | -LL | x.store(1, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: atomic stores cannot have `Acquire` and `AcqRel` ordering - --> $DIR/atomic_ordering_uint.rs:85:16 - | -LL | x.store(1, Ordering::AcqRel); - | ^^^^^^^^^^^^^^^^ - | - = help: consider using ordering modes `Release`, `SeqCst` or `Relaxed` - -error: aborting due to 20 previous errors - diff --git a/tests/ui/deprecated.rs b/tests/ui/deprecated.rs index 4ba9f0c1fcf..1943d0092e6 100644 --- a/tests/ui/deprecated.rs +++ b/tests/ui/deprecated.rs @@ -14,5 +14,6 @@ #[warn(clippy::filter_map)] #[warn(clippy::pub_enum_variant_names)] #[warn(clippy::wrong_pub_self_convention)] +#[warn(clippy::invalid_atomic_ordering)] fn main() {} diff --git a/tests/ui/deprecated.stderr b/tests/ui/deprecated.stderr index c0002e53543..51048e45c06 100644 --- a/tests/ui/deprecated.stderr +++ b/tests/ui/deprecated.stderr @@ -96,5 +96,11 @@ error: lint `clippy::wrong_pub_self_convention` has been removed: set the `avoid LL | #[warn(clippy::wrong_pub_self_convention)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 16 previous errors +error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering` + --> $DIR/deprecated.rs:17:8 + | +LL | #[warn(clippy::invalid_atomic_ordering)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering` + +error: aborting due to 17 previous errors