about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_monomorphize')
-rw-r--r--compiler/rustc_monomorphize/messages.ftl8
-rw-r--r--compiler/rustc_monomorphize/src/errors.rs9
-rw-r--r--compiler/rustc_monomorphize/src/mono_checks/abi_check.rs18
3 files changed, 20 insertions, 15 deletions
diff --git a/compiler/rustc_monomorphize/messages.ftl b/compiler/rustc_monomorphize/messages.ftl
index 540ce7cc4ce..463c42b69b1 100644
--- a/compiler/rustc_monomorphize/messages.ftl
+++ b/compiler/rustc_monomorphize/messages.ftl
@@ -1,17 +1,17 @@
 monomorphize_abi_error_disabled_vector_type_call =
-  this function call uses a SIMD vector type that (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled in the caller
+  this function call uses SIMD vector type `{$ty}` which (with the chosen ABI) 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 =
-  this function definition uses a SIMD vector type that (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled
+  this function definition uses SIMD vector type `{$ty}` which (with the chosen ABI) 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_abi_error_unsupported_vector_type_call =
-  this function call uses a SIMD vector type that is not currently supported with the chosen ABI
+  this function call uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI
   .label = function called here
 monomorphize_abi_error_unsupported_vector_type_def =
-  this function definition uses a SIMD vector type that is not currently supported with the chosen ABI
+  this function definition uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI
   .label = function defined here
 
 monomorphize_couldnt_dump_mono_stats =
diff --git a/compiler/rustc_monomorphize/src/errors.rs b/compiler/rustc_monomorphize/src/errors.rs
index fc8d63b5888..75687a80b82 100644
--- a/compiler/rustc_monomorphize/src/errors.rs
+++ b/compiler/rustc_monomorphize/src/errors.rs
@@ -1,6 +1,7 @@
 use std::path::PathBuf;
 
 use rustc_macros::{Diagnostic, LintDiagnostic};
+use rustc_middle::ty::Ty;
 use rustc_span::{Span, Symbol};
 
 #[derive(Diagnostic)]
@@ -75,6 +76,7 @@ pub(crate) struct AbiErrorDisabledVectorTypeDef<'a> {
     #[label]
     pub span: Span,
     pub required_feature: &'a str,
+    pub ty: Ty<'a>,
 }
 
 #[derive(LintDiagnostic)]
@@ -84,18 +86,21 @@ pub(crate) struct AbiErrorDisabledVectorTypeCall<'a> {
     #[label]
     pub span: Span,
     pub required_feature: &'a str,
+    pub ty: Ty<'a>,
 }
 
 #[derive(LintDiagnostic)]
 #[diag(monomorphize_abi_error_unsupported_vector_type_def)]
-pub(crate) struct AbiErrorUnsupportedVectorTypeDef {
+pub(crate) struct AbiErrorUnsupportedVectorTypeDef<'a> {
     #[label]
     pub span: Span,
+    pub ty: Ty<'a>,
 }
 
 #[derive(LintDiagnostic)]
 #[diag(monomorphize_abi_error_unsupported_vector_type_call)]
-pub(crate) struct AbiErrorUnsupportedVectorTypeCall {
+pub(crate) struct AbiErrorUnsupportedVectorTypeCall<'a> {
     #[label]
     pub span: Span,
+    pub ty: Ty<'a>,
 }
diff --git a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
index a0be7f11d70..36cd3e00b76 100644
--- a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
+++ b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
@@ -34,7 +34,7 @@ fn do_check_abi<'tcx>(
     tcx: TyCtxt<'tcx>,
     abi: &FnAbi<'tcx, Ty<'tcx>>,
     target_feature_def: DefId,
-    mut emit_err: impl FnMut(Option<&'static str>),
+    mut emit_err: impl FnMut(Ty<'tcx>, Option<&'static str>),
 ) {
     let feature_def = tcx.sess.target.features_for_correct_vector_abi();
     let codegen_attrs = tcx.codegen_fn_attrs(target_feature_def);
@@ -45,7 +45,7 @@ fn do_check_abi<'tcx>(
             let feature = match feature_def.iter().find(|(bits, _)| size.bits() <= *bits) {
                 Some((_, feature)) => feature,
                 None => {
-                    emit_err(None);
+                    emit_err(arg_abi.layout.ty, None);
                     continue;
                 }
             };
@@ -53,7 +53,7 @@ fn do_check_abi<'tcx>(
             if !tcx.sess.unstable_target_features.contains(&feature_sym)
                 && !codegen_attrs.target_features.iter().any(|x| x.name == feature_sym)
             {
-                emit_err(Some(&feature));
+                emit_err(arg_abi.layout.ty, Some(&feature));
             }
         }
     }
@@ -69,21 +69,21 @@ fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
         // function.
         return;
     };
-    do_check_abi(tcx, abi, instance.def_id(), |required_feature| {
+    do_check_abi(tcx, abi, instance.def_id(), |ty, required_feature| {
         let span = tcx.def_span(instance.def_id());
         if let Some(required_feature) = required_feature {
             tcx.emit_node_span_lint(
                 ABI_UNSUPPORTED_VECTOR_TYPES,
                 CRATE_HIR_ID,
                 span,
-                AbiErrorDisabledVectorTypeDef { span, required_feature },
+                AbiErrorDisabledVectorTypeDef { span, required_feature, ty },
             );
         } else {
             tcx.emit_node_span_lint(
                 ABI_UNSUPPORTED_VECTOR_TYPES,
                 CRATE_HIR_ID,
                 span,
-                AbiErrorUnsupportedVectorTypeDef { span },
+                AbiErrorUnsupportedVectorTypeDef { span, ty },
             );
         }
     })
@@ -123,20 +123,20 @@ fn check_call_site_abi<'tcx>(
         // ABI failed to compute; this will not get through codegen.
         return;
     };
-    do_check_abi(tcx, callee_abi, caller.def_id(), |required_feature| {
+    do_check_abi(tcx, callee_abi, caller.def_id(), |ty, required_feature| {
         if let Some(required_feature) = required_feature {
             tcx.emit_node_span_lint(
                 ABI_UNSUPPORTED_VECTOR_TYPES,
                 CRATE_HIR_ID,
                 span,
-                AbiErrorDisabledVectorTypeCall { span, required_feature },
+                AbiErrorDisabledVectorTypeCall { span, required_feature, ty },
             );
         } else {
             tcx.emit_node_span_lint(
                 ABI_UNSUPPORTED_VECTOR_TYPES,
                 CRATE_HIR_ID,
                 span,
-                AbiErrorUnsupportedVectorTypeCall { span },
+                AbiErrorUnsupportedVectorTypeCall { span, ty },
             );
         }
     });