From 5793f8203046da13726db57a5418c3e49ce66902 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sat, 17 Feb 2024 15:26:45 -0800 Subject: [PATCH] Add help to `hir_analysis_unrecognized_intrinsic_function` To help remind forgetful people like me what step they forgot. --- compiler/rustc_hir_analysis/messages.ftl | 1 + compiler/rustc_hir_analysis/src/errors.rs | 1 + tests/ui/error-codes/E0093.stderr | 2 ++ tests/ui/feature-gates/feature-gate-abi.stderr | 4 ++++ tests/ui/feature-gates/feature-gate-intrinsics.stderr | 4 ++++ tests/ui/intrinsics-always-extern.stderr | 2 ++ 6 files changed, 14 insertions(+) diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index a61cfd0e4ce9a..7468b38ce1a67 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -462,6 +462,7 @@ hir_analysis_unrecognized_atomic_operation = hir_analysis_unrecognized_intrinsic_function = unrecognized intrinsic function: `{$name}` .label = unrecognized intrinsic + .help = if you're adding an intrinsic, be sure to update `check_intrinsic_type` hir_analysis_unused_associated_type_bounds = unnecessary associated type bound for not object safe associated type diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 6a505b961974f..cd4096a9d477d 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -143,6 +143,7 @@ pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> { #[derive(Diagnostic)] #[diag(hir_analysis_unrecognized_intrinsic_function, code = E0093)] +#[help] pub struct UnrecognizedIntrinsicFunction { #[primary_span] #[label] diff --git a/tests/ui/error-codes/E0093.stderr b/tests/ui/error-codes/E0093.stderr index 387e0c55d4d29..51c367b343ab1 100644 --- a/tests/ui/error-codes/E0093.stderr +++ b/tests/ui/error-codes/E0093.stderr @@ -3,6 +3,8 @@ error[E0093]: unrecognized intrinsic function: `foo` | LL | fn foo(); | ^^^^^^^^^ unrecognized intrinsic + | + = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr index aa60434d9fe6c..3fd1e1189abc7 100644 --- a/tests/ui/feature-gates/feature-gate-abi.stderr +++ b/tests/ui/feature-gates/feature-gate-abi.stderr @@ -187,12 +187,16 @@ error[E0093]: unrecognized intrinsic function: `f1` | LL | extern "rust-intrinsic" fn f1() {} | ^^ unrecognized intrinsic + | + = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` error[E0093]: unrecognized intrinsic function: `f2` --> $DIR/feature-gate-abi.rs:18:32 | LL | extern "platform-intrinsic" fn f2() {} | ^^ unrecognized intrinsic + | + = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` error: intrinsic must be in `extern "rust-intrinsic" { ... }` block --> $DIR/feature-gate-abi.rs:25:32 diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.stderr b/tests/ui/feature-gates/feature-gate-intrinsics.stderr index 78c21843adb08..583a4a1a84eb0 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/tests/ui/feature-gates/feature-gate-intrinsics.stderr @@ -21,12 +21,16 @@ error[E0093]: unrecognized intrinsic function: `bar` | LL | fn bar(); | ^^^^^^^^^ unrecognized intrinsic + | + = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` error[E0093]: unrecognized intrinsic function: `baz` --> $DIR/feature-gate-intrinsics.rs:5:28 | LL | extern "rust-intrinsic" fn baz() {} | ^^^ unrecognized intrinsic + | + = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` error: intrinsic must be in `extern "rust-intrinsic" { ... }` block --> $DIR/feature-gate-intrinsics.rs:5:34 diff --git a/tests/ui/intrinsics-always-extern.stderr b/tests/ui/intrinsics-always-extern.stderr index 32468f99197f3..1f7bb5a3b0de2 100644 --- a/tests/ui/intrinsics-always-extern.stderr +++ b/tests/ui/intrinsics-always-extern.stderr @@ -9,6 +9,8 @@ error[E0093]: unrecognized intrinsic function: `hello` | LL | extern "rust-intrinsic" fn hello() { | ^^^^^ unrecognized intrinsic + | + = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` error: intrinsic must be in `extern "rust-intrinsic" { ... }` block --> $DIR/intrinsics-always-extern.rs:8:43