From 47080eacf83debe4cbd9bb8dbedaf2c29e084cbc Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 25 May 2022 11:44:44 +0200 Subject: [PATCH 1/8] Improve invalid memory ordering diagnostics. --- compiler/rustc_lint/src/types.rs | 143 +++++++++++++------------------ 1 file changed, 61 insertions(+), 82 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 55b1ba9cd964a..170d85f5cd50b 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -4,7 +4,6 @@ use rustc_attr as attr; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; use rustc_hir as hir; -use rustc_hir::def_id::DefId; use rustc_hir::{is_range_literal, Expr, ExprKind, Node}; use rustc_middle::ty::layout::{IntegerExt, LayoutOf, SizeSkeleton}; use rustc_middle::ty::subst::SubstsRef; @@ -1483,39 +1482,32 @@ impl InvalidAtomicOrdering { None } - fn matches_ordering(cx: &LateContext<'_>, did: DefId, orderings: &[Symbol]) -> bool { + fn match_ordering(cx: &LateContext<'_>, ord_arg: &Expr<'_>) -> Option { + let ExprKind::Path(ref ord_qpath) = ord_arg.kind else { return None }; + let did = cx.qpath_res(ord_qpath, ord_arg.hir_id).opt_def_id()?; let tcx = cx.tcx; let atomic_ordering = tcx.get_diagnostic_item(sym::Ordering); - orderings.iter().any(|ordering| { - tcx.item_name(did) == *ordering && { - let parent = tcx.parent(did); - Some(parent) == atomic_ordering - // needed in case this is a ctor, not a variant - || tcx.opt_parent(parent) == atomic_ordering - } - }) - } - - 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 - } + let name = tcx.item_name(did); + let parent = tcx.parent(did); + [sym::Relaxed, sym::Release, sym::Acquire, sym::AcqRel, sym::SeqCst].into_iter().find( + |&ordering| { + name == ordering + && (Some(parent) == atomic_ordering + // needed in case this is a ctor, not a variant + || tcx.opt_parent(parent) == atomic_ordering) + }, + ) } fn check_atomic_load_store(cx: &LateContext<'_>, expr: &Expr<'_>) { - use rustc_hir::def::{DefKind, Res}; - use rustc_hir::QPath; if let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::load, sym::store]) && let Some((ordering_arg, invalid_ordering)) = match method { sym::load => Some((&args[1], sym::Release)), sym::store => Some((&args[2], sym::Acquire)), _ => None, } - && let ExprKind::Path(QPath::Resolved(_, path)) = ordering_arg.kind - && let Res::Def(DefKind::Ctor(..), ctor_id) = path.res - && Self::matches_ordering(cx, ctor_id, &[invalid_ordering, sym::AcqRel]) + && let Some(ordering) = Self::match_ordering(cx, ordering_arg) + && (ordering == invalid_ordering || ordering == sym::AcqRel) { cx.struct_span_lint(INVALID_ATOMIC_ORDERING, ordering_arg.span, |diag| { if method == sym::load { @@ -1537,9 +1529,7 @@ impl InvalidAtomicOrdering { && let ExprKind::Path(ref func_qpath) = func.kind && let Some(def_id) = cx.qpath_res(func_qpath, func.hir_id).opt_def_id() && matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::fence | sym::compiler_fence)) - && let ExprKind::Path(ref ordering_qpath) = &args[0].kind - && let Some(ordering_def_id) = cx.qpath_res(ordering_qpath, args[0].hir_id).opt_def_id() - && Self::matches_ordering(cx, ordering_def_id, &[sym::Relaxed]) + && Self::match_ordering(cx, &args[0]) == Some(sym::Relaxed) { cx.struct_span_lint(INVALID_ATOMIC_ORDERING, args[0].span, |diag| { diag.build("memory fences cannot have `Relaxed` ordering") @@ -1550,62 +1540,51 @@ impl InvalidAtomicOrdering { } fn check_atomic_compare_exchange(cx: &LateContext<'_>, expr: &Expr<'_>) { - if let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::fetch_update, sym::compare_exchange, sym::compare_exchange_weak]) - && let Some((success_order_arg, failure_order_arg)) = match method { - sym::fetch_update => Some((&args[1], &args[2])), - sym::compare_exchange | sym::compare_exchange_weak => Some((&args[3], &args[4])), - _ => None, - } - && let Some(fail_ordering_def_id) = Self::opt_ordering_defid(cx, failure_order_arg) - { - // Helper type holding on to some checking and error reporting data. Has - // - (success ordering, - // - list of failure orderings forbidden by the success order, - // - suggestion message) - type OrdLintInfo = (Symbol, &'static [Symbol], &'static str); - const RELAXED: OrdLintInfo = (sym::Relaxed, &[sym::SeqCst, sym::Acquire], "ordering mode `Relaxed`"); - const ACQUIRE: OrdLintInfo = (sym::Acquire, &[sym::SeqCst], "ordering modes `Acquire` or `Relaxed`"); - const SEQ_CST: OrdLintInfo = (sym::SeqCst, &[], "ordering modes `Acquire`, `SeqCst` or `Relaxed`"); - const RELEASE: OrdLintInfo = (sym::Release, RELAXED.1, RELAXED.2); - const ACQREL: OrdLintInfo = (sym::AcqRel, ACQUIRE.1, ACQUIRE.2); - const SEARCH: [OrdLintInfo; 5] = [RELAXED, ACQUIRE, SEQ_CST, RELEASE, ACQREL]; - - let success_lint_info = Self::opt_ordering_defid(cx, success_order_arg) - .and_then(|success_ord_def_id| -> Option { - SEARCH - .iter() - .copied() - .find(|(ordering, ..)| { - Self::matches_ordering(cx, success_ord_def_id, &[*ordering]) - }) - }); - if Self::matches_ordering(cx, fail_ordering_def_id, &[sym::Release, sym::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; - cx.struct_span_lint(INVALID_ATOMIC_ORDERING, failure_order_arg.span, |diag| { - let msg = format!( - "{}'s failure ordering may not be `Release` or `AcqRel`", - method, - ); - diag.build(&msg) - .help(&format!("consider using {} instead", suggested)) - .emit(); - }); - } else if let Some((success_ord, bad_ords_given_success, suggested)) = success_lint_info { - if Self::matches_ordering(cx, fail_ordering_def_id, bad_ords_given_success) { - cx.struct_span_lint(INVALID_ATOMIC_ORDERING, failure_order_arg.span, |diag| { - let msg = format!( - "{}'s failure ordering may not be stronger than the success ordering of `{}`", - method, - success_ord, - ); - diag.build(&msg) - .help(&format!("consider using {} instead", suggested)) - .emit(); - }); - } - } + let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::fetch_update, sym::compare_exchange, sym::compare_exchange_weak]) + else {return }; + + let (success_order_arg, fail_order_arg) = match method { + sym::fetch_update => (&args[1], &args[2]), + sym::compare_exchange | sym::compare_exchange_weak => (&args[3], &args[4]), + _ => return, + }; + + let Some(fail_ordering) = Self::match_ordering(cx, fail_order_arg) else { return }; + + if matches!(fail_ordering, sym::Release | sym::AcqRel) { + cx.struct_span_lint(INVALID_ATOMIC_ORDERING, fail_order_arg.span, |diag| { + diag.build(&format!( + "{method}'s failure ordering may not be `Release` or `AcqRel`, \ + since a failed {method} does not result in a write", + )) + .span_label(fail_order_arg.span, "invalid failure ordering") + .help("consider using Acquire or Relaxed failure ordering instead") + .emit(); + }); + } + + let Some(success_ordering) = Self::match_ordering(cx, success_order_arg) else { return }; + + if matches!( + (success_ordering, fail_ordering), + (sym::Relaxed | sym::Release, sym::Acquire) + | (sym::Relaxed | sym::Release | sym::Acquire | sym::AcqRel, sym::SeqCst) + ) { + let success_suggestion = + if success_ordering == sym::Release && fail_ordering == sym::Acquire { + sym::AcqRel + } else { + fail_ordering + }; + cx.struct_span_lint(INVALID_ATOMIC_ORDERING, success_order_arg.span, |diag| { + diag.build(&format!( + "{method}'s success ordering must be at least as strong as its failure ordering" + )) + .span_label(fail_order_arg.span, format!("{fail_ordering} failure ordering")) + .span_label(success_order_arg.span, format!("{success_ordering} success ordering")) + .help(format!("consider using {success_suggestion} success ordering instead")) + .emit(); + }); } } } From 1b83dcffcee773bc94db998f8c37e1b1bfb67698 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 25 May 2022 11:49:02 +0200 Subject: [PATCH 2/8] Update tests. --- ...t-invalid-atomic-ordering-exchange-weak.rs | 12 +- ...valid-atomic-ordering-exchange-weak.stderr | 120 ++++++++++-------- .../lint-invalid-atomic-ordering-exchange.rs | 12 +- ...nt-invalid-atomic-ordering-exchange.stderr | 120 ++++++++++-------- ...nt-invalid-atomic-ordering-fetch-update.rs | 12 +- ...nvalid-atomic-ordering-fetch-update.stderr | 120 ++++++++++-------- 6 files changed, 216 insertions(+), 180 deletions(-) diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs index c79c1daf77410..1f870d1ef72ce 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs @@ -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 } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr index 13350ab0b9c02..8e816f7c48251 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr @@ -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 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs index 8ef3a400cf040..1a5cb3dac6b5c 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs @@ -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 } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr index daedfec743093..eeeeb1fb5a94e 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr @@ -1,131 +1,143 @@ -error: compare_exchange's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:20:57 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:22:57 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:24:57 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:26:56 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:28:56 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:32:57 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:34:57 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:36:57 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:38:56 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be `Release` or `AcqRel` +error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:40:56 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:44:57 +error: compare_exchange's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:44:38 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:57 +error: compare_exchange's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:38 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:50:57 +error: compare_exchange's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:50:38 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:52:57 +error: compare_exchange's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:52:38 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:56:57 +error: compare_exchange's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:56:38 | LL | let _ = x.compare_exchange(0, 0, 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's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:58:56 +error: compare_exchange's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:58:38 | LL | let _ = x.compare_exchange(0, 0, 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 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs index 938ca0359f845..dcf277dfaccfd 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs @@ -42,19 +42,19 @@ fn main() { // Release success order forbids failure order of Acquire or SeqCst let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR fetch_update's success ordering must be at least as strong as let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR fetch_update's success ordering must be at least as strong as // Relaxed success order also forbids failure order of Acquire or SeqCst let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR fetch_update's success ordering must be at least as strong as let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR fetch_update's success ordering must be at least as strong as // Acquire/AcqRel forbids failure order of SeqCst let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR fetch_update's success ordering must be at least as strong as let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be stronger + //~^ ERROR fetch_update's success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr index dabc1da7e55c4..f63d059d42915 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr @@ -1,131 +1,143 @@ -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:20:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ 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: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:22:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:24:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:26:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:28:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:32:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:34:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:36:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:38:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel` +error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:40:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` instead + = help: consider using Acquire or Relaxed failure ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:44:47 +error: fetch_update's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:44:28 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering + | | + | Release success ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using AcqRel success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Release` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:47 +error: fetch_update's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:28 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | | + | Release success ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using SeqCst success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:50:47 +error: fetch_update's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:50:28 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | | + | Relaxed success ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using SeqCst success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Relaxed` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:52:47 +error: fetch_update's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:52:28 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering + | | + | Relaxed success ordering | - = help: consider using ordering mode `Relaxed` instead + = help: consider using Acquire success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `Acquire` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:56:47 +error: fetch_update's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:56:28 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | | + | Acquire success ordering | - = help: consider using ordering modes `Acquire` or `Relaxed` instead + = help: consider using SeqCst success ordering instead -error: fetch_update's failure ordering may not be stronger than the success ordering of `AcqRel` - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:58:46 +error: fetch_update's success ordering must be at least as strong as its failure ordering + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:58:28 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ ---------------- 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 From 1c1f221845f41e1c5663ec7f963181c9b6be95d0 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 25 May 2022 12:18:48 +0200 Subject: [PATCH 3/8] Tweak memory ordering diagnostic. --- compiler/rustc_lint/src/types.rs | 7 ++++++- ...nvalid-atomic-ordering-exchange-weak.stderr | 18 ++++++------------ ...int-invalid-atomic-ordering-exchange.stderr | 18 ++++++------------ ...invalid-atomic-ordering-fetch-update.stderr | 18 ++++++------------ 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 170d85f5cd50b..b3802b719fe36 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -1582,7 +1582,12 @@ impl InvalidAtomicOrdering { )) .span_label(fail_order_arg.span, format!("{fail_ordering} failure ordering")) .span_label(success_order_arg.span, format!("{success_ordering} success ordering")) - .help(format!("consider using {success_suggestion} success ordering instead")) + .span_suggestion_short( + success_order_arg.span, + format!("consider using {success_suggestion} success ordering instead"), + success_suggestion.to_string(), + Applicability::MaybeIncorrect, + ) .emit(); }); } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr index 8e816f7c48251..030b065cf4f8b 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr @@ -86,8 +86,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering: | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering | | | Release success ordering - | - = help: consider using AcqRel success ordering instead + | help: consider using AcqRel success ordering instead 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 @@ -96,8 +95,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering: | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Release success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead 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 @@ -106,8 +104,7 @@ LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering: | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Relaxed success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead 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 @@ -116,8 +113,7 @@ LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering: | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering | | | Relaxed success ordering - | - = help: consider using Acquire success ordering instead + | help: consider using Acquire success ordering instead 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 @@ -126,8 +122,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering: | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Acquire success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead 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 @@ -136,8 +131,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering:: | ^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | AcqRel success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: aborting due to 16 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr index eeeeb1fb5a94e..7bb12a8168346 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr @@ -86,8 +86,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering | | | Release success ordering - | - = help: consider using AcqRel success ordering instead + | help: consider using AcqRel success ordering instead error: compare_exchange's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:38 @@ -96,8 +95,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Release success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: compare_exchange's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:50:38 @@ -106,8 +104,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Relaxed success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: compare_exchange's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:52:38 @@ -116,8 +113,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering | | | Relaxed success ordering - | - = help: consider using Acquire success ordering instead + | help: consider using Acquire success ordering instead error: compare_exchange's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:56:38 @@ -126,8 +122,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Acquire success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: compare_exchange's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:58:38 @@ -136,8 +131,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | AcqRel success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: aborting due to 16 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr index f63d059d42915..f79936cbda931 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr @@ -86,8 +86,7 @@ LL | let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering | | | Release success ordering - | - = help: consider using AcqRel success ordering instead + | help: consider using AcqRel success ordering instead error: fetch_update's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:28 @@ -96,8 +95,7 @@ LL | let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some( | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Release success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: fetch_update's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:50:28 @@ -106,8 +104,7 @@ LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some( | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Relaxed success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: fetch_update's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:52:28 @@ -116,8 +113,7 @@ LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering | | | Relaxed success ordering - | - = help: consider using Acquire success ordering instead + | help: consider using Acquire success ordering instead error: fetch_update's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:56:28 @@ -126,8 +122,7 @@ LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some( | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | Acquire success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: fetch_update's success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:58:28 @@ -136,8 +131,7 @@ LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(o | ^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering | | | AcqRel success ordering - | - = help: consider using SeqCst success ordering instead + | help: consider using SeqCst success ordering instead error: aborting due to 16 previous errors From c1f4f980f4706365d56136f8761537f8e9b56bb4 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 5 Jun 2022 23:04:37 -0700 Subject: [PATCH 4/8] Do wfcheck on ADT field before Sized check --- compiler/rustc_middle/src/traits/mod.rs | 2 +- compiler/rustc_typeck/src/check/wfcheck.rs | 19 +++++++++--------- .../bugs/issue-80626.stderr | 13 ++++-------- src/test/ui/union/issue-81199.stderr | 20 +++++-------------- src/test/ui/wf/issue-96810.rs | 12 +++++++++++ src/test/ui/wf/issue-96810.stderr | 19 ++++++++++++++++++ 6 files changed, 51 insertions(+), 34 deletions(-) create mode 100644 src/test/ui/wf/issue-96810.rs create mode 100644 src/test/ui/wf/issue-96810.stderr diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index 4006b2fcf177a..c963dc1689380 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -403,7 +403,7 @@ pub enum ObligationCauseCode<'tcx> { QuestionMark, /// Well-formed checking. If a `WellFormedLoc` is provided, - /// then it will be used to eprform HIR-based wf checking + /// then it will be used to perform HIR-based wf checking /// after an error occurs, in order to generate a more precise error span. /// This is purely for diagnostic purposes - it is always /// correct to use `MiscObligation` instead, or to specify diff --git a/compiler/rustc_typeck/src/check/wfcheck.rs b/compiler/rustc_typeck/src/check/wfcheck.rs index 20ef97c085f18..e6c21608c8ae2 100644 --- a/compiler/rustc_typeck/src/check/wfcheck.rs +++ b/compiler/rustc_typeck/src/check/wfcheck.rs @@ -1008,6 +1008,15 @@ fn check_type_defn<'tcx, F>( let packed = tcx.adt_def(item.def_id).repr().packed(); for variant in &variants { + // All field types must be well-formed. + for field in &variant.fields { + fcx.register_wf_obligation( + field.ty.into(), + field.span, + ObligationCauseCode::WellFormed(Some(WellFormedLoc::Ty(field.def_id))), + ) + } + // For DST, or when drop needs to copy things around, all // intermediate types must be sized. let needs_drop_copy = || { @@ -1024,6 +1033,7 @@ fn check_type_defn<'tcx, F>( } } }; + // All fields (except for possibly the last) should be sized. let all_sized = all_sized || variant.fields.is_empty() || needs_drop_copy(); let unsized_len = if all_sized { 0 } else { 1 }; for (idx, field) in @@ -1048,15 +1058,6 @@ fn check_type_defn<'tcx, F>( ); } - // All field types must be well-formed. - for field in &variant.fields { - fcx.register_wf_obligation( - field.ty.into(), - field.span, - ObligationCauseCode::WellFormed(Some(WellFormedLoc::Ty(field.def_id))), - ) - } - // Explicit `enum` discriminant values must const-evaluate successfully. if let Some(discr_def_id) = variant.explicit_discr { let discr_substs = InternalSubsts::identity_for_item(tcx, discr_def_id.to_def_id()); diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr index 8b0cc78e99949..487b83dfa3fcc 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr @@ -4,16 +4,11 @@ error[E0275]: overflow evaluating the requirement `LinkedList: Sized` LL | Next(A::Allocated) | ^^^^^^^^^^^^^^^^^^ | - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size +note: required by a bound in `Allocator::Allocated` + --> $DIR/issue-80626.rs:9:20 | -LL | Next(&A::Allocated) - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | Next(Box>) - | ++++ + +LL | type Allocated; + | ^ required by this bound in `Allocator::Allocated` error: aborting due to previous error diff --git a/src/test/ui/union/issue-81199.stderr b/src/test/ui/union/issue-81199.stderr index f26bfe3a0b060..5bb98675361a0 100644 --- a/src/test/ui/union/issue-81199.stderr +++ b/src/test/ui/union/issue-81199.stderr @@ -1,28 +1,18 @@ -error[E0277]: the trait bound `T: Pointee` is not satisfied in `PtrComponents` +error[E0277]: the trait bound `T: Pointee` is not satisfied --> $DIR/issue-81199.rs:5:17 | LL | components: PtrComponents, - | ^^^^^^^^^^^^^^^^ within `PtrComponents`, the trait `Pointee` is not implemented for `T` + | ^^^^^^^^^^^^^^^^ the trait `Pointee` is not implemented for `T` | -note: required because it appears within the type `PtrComponents` - --> $DIR/issue-81199.rs:10:8 +note: required by a bound in `PtrComponents` + --> $DIR/issue-81199.rs:10:25 | LL | struct PtrComponents { - | ^^^^^^^^^^^^^ - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size + | ^^^^^^^ required by this bound in `PtrComponents` help: consider further restricting this bound | LL | union PtrRepr { | +++++++++ -help: borrowed types always have a statically known size - | -LL | components: &PtrComponents, - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | components: Box>, - | ++++ + error: aborting due to previous error diff --git a/src/test/ui/wf/issue-96810.rs b/src/test/ui/wf/issue-96810.rs new file mode 100644 index 0000000000000..c2948086b200b --- /dev/null +++ b/src/test/ui/wf/issue-96810.rs @@ -0,0 +1,12 @@ +struct S(T::Assoc); + +trait Tr { + type Assoc; +} + +struct Hoge { + s: S, //~ ERROR the trait bound `K: Tr` is not satisfied + a: u32, +} + +fn main() {} diff --git a/src/test/ui/wf/issue-96810.stderr b/src/test/ui/wf/issue-96810.stderr new file mode 100644 index 0000000000000..1407e62b1e139 --- /dev/null +++ b/src/test/ui/wf/issue-96810.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `K: Tr` is not satisfied + --> $DIR/issue-96810.rs:8:8 + | +LL | s: S, + | ^^^^ the trait `Tr` is not implemented for `K` + | +note: required by a bound in `S` + --> $DIR/issue-96810.rs:1:13 + | +LL | struct S(T::Assoc); + | ^^ required by this bound in `S` +help: consider restricting type parameter `K` + | +LL | struct Hoge { + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From f107923cc05fdb6a85be30d0495692b47ec174b2 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 22 Jun 2022 20:03:39 +0200 Subject: [PATCH 5/8] Slightly tweak invalid atomic ordering lint messages. Co-authored-by: Esteban Kuber --- compiler/rustc_lint/src/types.rs | 16 ++-- ...t-invalid-atomic-ordering-exchange-weak.rs | 32 +++---- ...valid-atomic-ordering-exchange-weak.stderr | 88 +++++++++---------- .../lint-invalid-atomic-ordering-exchange.rs | 32 +++---- ...nt-invalid-atomic-ordering-exchange.stderr | 88 +++++++++---------- ...nt-invalid-atomic-ordering-fetch-update.rs | 32 +++---- ...nvalid-atomic-ordering-fetch-update.stderr | 88 +++++++++---------- 7 files changed, 188 insertions(+), 188 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index b3802b719fe36..cfd6d7ac09faa 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -1554,11 +1554,11 @@ impl InvalidAtomicOrdering { if matches!(fail_ordering, sym::Release | sym::AcqRel) { cx.struct_span_lint(INVALID_ATOMIC_ORDERING, fail_order_arg.span, |diag| { diag.build(&format!( - "{method}'s failure ordering may not be `Release` or `AcqRel`, \ - since a failed {method} does not result in a write", + "`{method}`'s failure ordering may not be `Release` or `AcqRel`, \ + since a failed `{method}` does not result in a write", )) .span_label(fail_order_arg.span, "invalid failure ordering") - .help("consider using Acquire or Relaxed failure ordering instead") + .help("consider using `Acquire` or `Relaxed` failure ordering instead") .emit(); }); } @@ -1578,14 +1578,14 @@ impl InvalidAtomicOrdering { }; cx.struct_span_lint(INVALID_ATOMIC_ORDERING, success_order_arg.span, |diag| { diag.build(&format!( - "{method}'s success ordering must be at least as strong as its failure ordering" + "`{method}`'s success ordering must be at least as strong as its failure ordering" )) - .span_label(fail_order_arg.span, format!("{fail_ordering} failure ordering")) - .span_label(success_order_arg.span, format!("{success_ordering} success ordering")) + .span_label(fail_order_arg.span, format!("`{fail_ordering}` failure ordering")) + .span_label(success_order_arg.span, format!("`{success_ordering}` success ordering")) .span_suggestion_short( success_order_arg.span, - format!("consider using {success_suggestion} success ordering instead"), - success_suggestion.to_string(), + format!("consider using `{success_suggestion}` success ordering instead"), + format!("std::sync::atomic::Ordering::{success_suggestion}"), Applicability::MaybeIncorrect, ) .emit(); diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs index 1f870d1ef72ce..0e0d604ae046d 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs @@ -20,43 +20,43 @@ fn main() { // AcqRel is always forbidden as a failure ordering let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel); - //~^ 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` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel); - //~^ 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` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel); - //~^ 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` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel); - //~^ 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` let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel); - //~^ 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` // Release is always forbidden as a failure ordering let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release); - //~^ 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` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release); - //~^ 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` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release); - //~^ 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` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release); - //~^ 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` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release); - //~^ 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` // 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr index 030b065cf4f8b..d5e53418b6fb8 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr @@ -1,137 +1,137 @@ -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -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 +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 Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering +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 + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering | | - | Release success ordering - | help: consider using AcqRel success ordering instead + | `Release` success ordering + | help: consider using `AcqRel` success ordering instead -error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering +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 + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Release success ordering - | help: consider using SeqCst success ordering instead + | `Release` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering +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 + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Relaxed success ordering - | help: consider using SeqCst success ordering instead + | `Relaxed` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering +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 + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering | | - | Relaxed success ordering - | help: consider using Acquire success ordering instead + | `Relaxed` success ordering + | help: consider using `Acquire` success ordering instead -error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering +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 + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Acquire success ordering - | help: consider using SeqCst success ordering instead + | `Acquire` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange_weak's success ordering must be at least as strong as its failure ordering +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 + | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | AcqRel success ordering - | help: consider using SeqCst success ordering instead + | `AcqRel` success ordering + | help: consider using `SeqCst` success ordering instead error: aborting due to 16 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs index 1a5cb3dac6b5c..da98d854262a5 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs @@ -18,43 +18,43 @@ fn main() { // AcqRel is always forbidden as a failure ordering let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` // Release is always forbidden as a failure ordering let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); - //~^ ERROR compare_exchange's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` // Release success order forbids failure order of Acquire or SeqCst let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - //~^ ERROR compare_exchange's success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ 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 success ordering must be at least as strong as + //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr index 7bb12a8168346..41121a20dee99 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr @@ -1,137 +1,137 @@ -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:20:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering | = note: `#[deny(invalid_atomic_ordering)]` on by default - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:22:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:24:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:26:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:28:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:32:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:34:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:36:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:38:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's failure ordering may not be `Release` or `AcqRel`, since a failed compare_exchange does not result in a write +error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:40:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: compare_exchange's success ordering must be at least as strong as its failure ordering +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:44:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering | | - | Release success ordering - | help: consider using AcqRel success ordering instead + | `Release` success ordering + | help: consider using `AcqRel` success ordering instead -error: compare_exchange's success ordering must be at least as strong as its failure ordering +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Release success ordering - | help: consider using SeqCst success ordering instead + | `Release` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange's success ordering must be at least as strong as its failure ordering +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:50:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Relaxed success ordering - | help: consider using SeqCst success ordering instead + | `Relaxed` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange's success ordering must be at least as strong as its failure ordering +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:52:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering | | - | Relaxed success ordering - | help: consider using Acquire success ordering instead + | `Relaxed` success ordering + | help: consider using `Acquire` success ordering instead -error: compare_exchange's success ordering must be at least as strong as its failure ordering +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:56:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Acquire success ordering - | help: consider using SeqCst success ordering instead + | `Acquire` success ordering + | help: consider using `SeqCst` success ordering instead -error: compare_exchange's success ordering must be at least as strong as its failure ordering +error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-exchange.rs:58:38 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | AcqRel success ordering - | help: consider using SeqCst success ordering instead + | `AcqRel` success ordering + | help: consider using `SeqCst` success ordering instead error: aborting due to 16 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs index dcf277dfaccfd..73eda182aa879 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs @@ -18,43 +18,43 @@ fn main() { // AcqRel is always forbidden as a failure ordering let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` // Release is always forbidden as a failure ordering let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); - //~^ ERROR fetch_update's failure ordering may not be `Release` or `AcqRel` + //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` // Release success order forbids failure order of Acquire or SeqCst let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR fetch_update's success ordering must be at least as strong as + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's success ordering must be at least as strong as + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as // Relaxed success order also forbids failure order of Acquire or SeqCst let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's success ordering must be at least as strong as + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR fetch_update's success ordering must be at least as strong as + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as // Acquire/AcqRel forbids failure order of SeqCst let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's success ordering must be at least as strong as + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR fetch_update's success ordering must be at least as strong as + //~^ ERROR `fetch_update`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr index f79936cbda931..7bea56d57fbab 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr @@ -1,137 +1,137 @@ -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:20:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering | = note: `#[deny(invalid_atomic_ordering)]` on by default - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:22:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:24:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:26:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:28:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:32:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:34:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:36:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:38:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's failure ordering may not be `Release` or `AcqRel`, since a failed fetch_update does not result in a write +error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:40:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | - = help: consider using Acquire or Relaxed failure ordering instead + = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: fetch_update's success ordering must be at least as strong as its failure ordering +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:44:28 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering | | - | Release success ordering - | help: consider using AcqRel success ordering instead + | `Release` success ordering + | help: consider using `AcqRel` success ordering instead -error: fetch_update's success ordering must be at least as strong as its failure ordering +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:28 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Release success ordering - | help: consider using SeqCst success ordering instead + | `Release` success ordering + | help: consider using `SeqCst` success ordering instead -error: fetch_update's success ordering must be at least as strong as its failure ordering +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:50:28 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Relaxed success ordering - | help: consider using SeqCst success ordering instead + | `Relaxed` success ordering + | help: consider using `SeqCst` success ordering instead -error: fetch_update's success ordering must be at least as strong as its failure ordering +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:52:28 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ----------------- Acquire failure ordering + | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering | | - | Relaxed success ordering - | help: consider using Acquire success ordering instead + | `Relaxed` success ordering + | help: consider using `Acquire` success ordering instead -error: fetch_update's success ordering must be at least as strong as its failure ordering +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:56:28 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | Acquire success ordering - | help: consider using SeqCst success ordering instead + | `Acquire` success ordering + | help: consider using `SeqCst` success ordering instead -error: fetch_update's success ordering must be at least as strong as its failure ordering +error: `fetch_update`'s success ordering must be at least as strong as its failure ordering --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:58:28 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ ---------------- SeqCst failure ordering + | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering | | - | AcqRel success ordering - | help: consider using SeqCst success ordering instead + | `AcqRel` success ordering + | help: consider using `SeqCst` success ordering instead error: aborting due to 16 previous errors From 93d3359d37bd4f0c5e4a73617ee554f536582a50 Mon Sep 17 00:00:00 2001 From: David Knaack Date: Sun, 26 Jun 2022 10:51:23 +0200 Subject: [PATCH 6/8] compiletest: add issue number param to `known-bug` --- src/test/ui/chalkify/bugs/async.rs | 2 +- .../bugs/issue-80626.rs | 2 +- .../bugs/issue-86218.rs | 2 +- .../bugs/issue-87735.rs | 2 +- .../bugs/issue-87748.rs | 2 +- .../bugs/issue-87755.rs | 2 +- .../bugs/issue-87803.rs | 2 +- .../bugs/issue-88382.rs | 2 +- .../bugs/issue-88460.rs | 2 +- .../bugs/issue-88526.rs | 2 +- .../bugs/issue-89008.rs | 2 +- src/test/ui/hrtb/issue-95034.rs | 2 +- src/test/ui/issues/issue-47511.rs | 2 +- .../select-param-env-instead-of-blanket.rs | 2 +- .../cross_inference_pattern_bug_no_type.rs | 2 +- .../issue-57611-trait-alias.rs | 2 +- src/tools/compiletest/src/header.rs | 24 ++++++++++++++++++- 17 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/test/ui/chalkify/bugs/async.rs b/src/test/ui/chalkify/bugs/async.rs index 58fc93064edf5..ae5224dbd6fa8 100644 --- a/src/test/ui/chalkify/bugs/async.rs +++ b/src/test/ui/chalkify/bugs/async.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: unknown // compile-flags: -Z chalk --edition=2021 fn main() -> () {} diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.rs b/src/test/ui/generic-associated-types/bugs/issue-80626.rs index a637da6cf6fa7..14f27aff1ccd8 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-80626.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-80626.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #80626 // This should pass, but it requires `Sized` to be coinductive. diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.rs b/src/test/ui/generic-associated-types/bugs/issue-86218.rs index 68cd0fd7efce0..fb62c10a9e389 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-86218.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-86218.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #86218 // This should pass, but seems to run into a TAIT issue. diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.rs b/src/test/ui/generic-associated-types/bugs/issue-87735.rs index 53e3ad7fe6943..0844d84c34fd3 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87735.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87735.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87735, #88526 // This should pass, but we need an extension of implied bounds (probably). diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.rs b/src/test/ui/generic-associated-types/bugs/issue-87748.rs index 6e7cd45bdb1f6..a3d00ee03b13e 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87748.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87748.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87748 // This should pass, but unnormalized input args aren't treated as implied. diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.rs b/src/test/ui/generic-associated-types/bugs/issue-87755.rs index 31cea12a3e241..efa487d624fd9 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87755.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87755.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87755 // This should pass. diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.rs b/src/test/ui/generic-associated-types/bugs/issue-87803.rs index 57a4b028d93ea..a8a111c99ef7f 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87803.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87803.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #87803 // This should pass, but using a type alias vs a reference directly // changes late-bound -> early-bound. diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.rs b/src/test/ui/generic-associated-types/bugs/issue-88382.rs index c9f342405278a..5493b9b939135 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88382.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88382.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #88382 // This should pass, but has a missed normalization due to HRTB. diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.rs b/src/test/ui/generic-associated-types/bugs/issue-88460.rs index b31d012d2fc41..f1c3b2269158a 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88460.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88460.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #88460 // This should pass, but has a missed normalization due to HRTB. diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.rs b/src/test/ui/generic-associated-types/bugs/issue-88526.rs index c72a450b9261c..15363ad04bfe7 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88526.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88526.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #88526 // This should pass, but requires more logic. diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.rs b/src/test/ui/generic-associated-types/bugs/issue-89008.rs index 1581b7105a867..79c28b0d22172 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-89008.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-89008.rs @@ -1,6 +1,6 @@ // check-fail // edition:2021 -// known-bug +// known-bug: #88908 // This should pass, but seems to run into a TAIT bug. diff --git a/src/test/ui/hrtb/issue-95034.rs b/src/test/ui/hrtb/issue-95034.rs index aee6fe61ba812..d8edbe7e56b51 100644 --- a/src/test/ui/hrtb/issue-95034.rs +++ b/src/test/ui/hrtb/issue-95034.rs @@ -1,4 +1,4 @@ -// known-bug +// known-bug: #95034 // failure-status: 101 // compile-flags: --edition=2021 --crate-type=lib // rustc-env:RUST_BACKTRACE=0 diff --git a/src/test/ui/issues/issue-47511.rs b/src/test/ui/issues/issue-47511.rs index 98c141b6c6a1d..eb4860e75d758 100644 --- a/src/test/ui/issues/issue-47511.rs +++ b/src/test/ui/issues/issue-47511.rs @@ -1,5 +1,5 @@ // check-fail -// known-bug +// known-bug: #47511 // Regression test for #47511: anonymous lifetimes can appear // unconstrained in a return type, but only if they appear just once diff --git a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs index 288b2098b4c02..fd975aaaee4a8 100644 --- a/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs +++ b/src/test/ui/trait-bounds/select-param-env-instead-of-blanket.rs @@ -1,4 +1,4 @@ -// known-bug +// known-bug: #93008 // build-fail // failure-status: 101 // compile-flags:--crate-type=lib -Zmir-opt-level=3 diff --git a/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs b/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs index 179f525de52b0..328096d44b4b5 100644 --- a/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs +++ b/src/test/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs @@ -1,4 +1,4 @@ -// known-bug +// known-bug: #96572 // compile-flags: --edition=2021 --crate-type=lib // rustc-env:RUST_BACKTRACE=0 diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs index 9c4e6c5496fb7..067ed7ea1e585 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs @@ -1,7 +1,7 @@ // Regression test for issue #57611 // Ensures that we don't ICE // FIXME: This should compile, but it currently doesn't -// known-bug +// known-bug: unknown #![feature(trait_alias)] #![feature(type_alias_impl_trait)] diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 5352f7c6fe0fa..31e979a574b6e 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -395,7 +395,29 @@ impl TestProps { ); config.set_name_directive(ln, STDERR_PER_BITWIDTH, &mut self.stderr_per_bitwidth); config.set_name_directive(ln, INCREMENTAL, &mut self.incremental); - config.set_name_directive(ln, KNOWN_BUG, &mut self.known_bug); + + // Unlike the other `name_value_directive`s this needs to be handled manually, + // because it sets a `bool` flag. + if let Some(known_bug) = config.parse_name_value_directive(ln, KNOWN_BUG) { + let known_bug = known_bug.trim(); + if known_bug == "unknown" + || known_bug.split(',').all(|issue_ref| { + issue_ref + .trim() + .split_once('#') + .filter(|(_, number)| { + number.chars().all(|digit| digit.is_numeric()) + }) + .is_some() + }) + { + self.known_bug = true; + } else { + panic!( + "Invalid known-bug value: {known_bug}\nIt requires comma-separated issue references (`#000` or `chalk#000`) or `unknown`." + ); + } + } config.set_name_value_directive(ln, MIR_UNIT_TEST, &mut self.mir_unit_test, |s| { s.trim().to_string() }); From 15abd82d703c81e156b5d8546af9489d9c3f9d54 Mon Sep 17 00:00:00 2001 From: BlaCoiso Date: Sun, 26 Jun 2022 23:27:44 +0100 Subject: [PATCH 7/8] Fix builds on Windows (closes #98546) --- src/bootstrap/native.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index ea410849694ca..9cd8b6d1455dd 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -160,7 +160,7 @@ pub(crate) fn maybe_download_ci_llvm(builder: &Builder<'_>) { // files in the tarball are in the past, so it doesn't trigger a // rebuild. let now = filetime::FileTime::from_system_time(std::time::SystemTime::now()); - let llvm_config = llvm_root.join("bin/llvm-config"); + let llvm_config = llvm_root.join("bin").join(exe("llvm-config", builder.config.build)); t!(filetime::set_file_times(&llvm_config, now, now)); let llvm_lib = llvm_root.join("lib"); From 1c1ae78db7ae7ca162e60041816f9dd4bc0a2fc2 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Sun, 26 Jun 2022 19:17:34 -0700 Subject: [PATCH 8/8] Fix spelling in SAFETY comment "can not" should be "cannot", and add punctuation. --- library/core/src/num/nonzero.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index e570d831cc607..92d03b724b40e 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -213,7 +213,7 @@ macro_rules! nonzero_leading_trailing_zeros { without modifying the original"] #[inline] pub const fn leading_zeros(self) -> u32 { - // SAFETY: since `self` can not be zero it is safe to call ctlz_nonzero + // SAFETY: since `self` cannot be zero, it is safe to call `ctlz_nonzero`. unsafe { intrinsics::ctlz_nonzero(self.0 as $Uint) as u32 } } @@ -237,7 +237,7 @@ macro_rules! nonzero_leading_trailing_zeros { without modifying the original"] #[inline] pub const fn trailing_zeros(self) -> u32 { - // SAFETY: since `self` can not be zero it is safe to call cttz_nonzero + // SAFETY: since `self` cannot be zero, it is safe to call `cttz_nonzero`. unsafe { intrinsics::cttz_nonzero(self.0 as $Uint) as u32 } }