about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/messages.ftl
diff options
context:
space:
mode:
authorLuca Versari <veluca93@gmail.com>2024-07-13 19:35:05 +0200
committerLuca Versari <veluca93@gmail.com>2024-10-25 08:46:40 +0200
commit5af56cac38fa48e4228e5e123d060e85eb1acbf7 (patch)
treecafe84347567925367fb7daa3b4f30fd956f0659 /compiler/rustc_monomorphize/messages.ftl
parent7342830c05ec0996e9e4b7df550b1043dca7829c (diff)
downloadrust-5af56cac38fa48e4228e5e123d060e85eb1acbf7.tar.gz
rust-5af56cac38fa48e4228e5e123d060e85eb1acbf7.zip
Emit error when calling/declaring functions with unavailable vectors.
On some architectures, vector types may have a different ABI when
relevant target features are enabled.

As discussed in https://github.com/rust-lang/lang-team/issues/235, this
turns out to very easily lead to unsound code.

This commit makes it an error to declare or call functions using those
vector types in a context in which the corresponding target features are
disabled, if using an ABI for which the difference is relevant.
Diffstat (limited to 'compiler/rustc_monomorphize/messages.ftl')
-rw-r--r--compiler/rustc_monomorphize/messages.ftl9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_monomorphize/messages.ftl b/compiler/rustc_monomorphize/messages.ftl
index 7210701d482..6da387bbebc 100644
--- a/compiler/rustc_monomorphize/messages.ftl
+++ b/compiler/rustc_monomorphize/messages.ftl
@@ -1,3 +1,12 @@
+monomorphize_abi_error_disabled_vector_type_call =
+  ABI error: this function call uses a vector type that requires the `{$required_feature}` target feature, which is not enabled in the caller
+  .label = function called here
+  .help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`)
+monomorphize_abi_error_disabled_vector_type_def =
+  ABI error: this function definition uses a vector type that requires the `{$required_feature}` target feature, which is not enabled
+  .label = function defined here
+  .help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`)
+
 monomorphize_couldnt_dump_mono_stats =
     unexpected error occurred while dumping monomorphization stats: {$error}