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.
This commit is contained in:
@@ -92,3 +92,21 @@ pub(crate) struct StartNotFound;
|
||||
pub(crate) struct UnknownCguCollectionMode<'a> {
|
||||
pub mode: &'a str,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(monomorphize_abi_error_disabled_vector_type_def)]
|
||||
#[help]
|
||||
pub(crate) struct AbiErrorDisabledVectorTypeDef<'a> {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub required_feature: &'a str,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(monomorphize_abi_error_disabled_vector_type_call)]
|
||||
#[help]
|
||||
pub(crate) struct AbiErrorDisabledVectorTypeCall<'a> {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub required_feature: &'a str,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user