Skip to content

Commit

Permalink
Rollup merge of rust-lang#121247 - scottmcm:intrinsic-reminder, r=pet…
Browse files Browse the repository at this point in the history
…rochenkov

Add help to `hir_analysis_unrecognized_intrinsic_function`

To help remind forgetful people like me what step they forgot.

(If this just ICE'd, rust-lang/compiler-team#620 style, the stack trace would point me here, but since there's a "nice" error that information is lost.)
  • Loading branch information
GuillaumeGomez authored Feb 18, 2024
2 parents 97ddd27 + 5793f82 commit 8030435
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_hir_analysis/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,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
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir_analysis/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/error-codes/E0093.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions tests/ui/feature-gates/feature-gate-abi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/feature-gates/feature-gate-intrinsics.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/intrinsics-always-extern.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8030435

Please sign in to comment.