diff options
| author | Ralf Jung <post@ralfj.de> | 2025-04-03 10:59:49 +0200 | 
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-04-20 11:34:56 +0200 | 
| commit | b5f5f62a8b5890be2fde163ba3f2284f023126ad (patch) | |
| tree | 147c4272aa6c1194f5e159a3132e1d278145aa0d /compiler/rustc_monomorphize/src | |
| parent | 49e5e4e3a5610c240a717cb99003a5d5d3356679 (diff) | |
| download | rust-b5f5f62a8b5890be2fde163ba3f2284f023126ad.tar.gz rust-b5f5f62a8b5890be2fde163ba3f2284f023126ad.zip | |
make abi_unsupported_vector_types a hard error
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/errors.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_monomorphize/src/mono_checks/abi_check.rs | 34 | 
2 files changed, 16 insertions, 24 deletions
| diff --git a/compiler/rustc_monomorphize/src/errors.rs b/compiler/rustc_monomorphize/src/errors.rs index adfe096f0cd..0dd20bbb35f 100644 --- a/compiler/rustc_monomorphize/src/errors.rs +++ b/compiler/rustc_monomorphize/src/errors.rs @@ -70,10 +70,11 @@ pub(crate) struct UnknownCguCollectionMode<'a> { pub mode: &'a str, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag(monomorphize_abi_error_disabled_vector_type)] #[help] pub(crate) struct AbiErrorDisabledVectorType<'a> { + #[primary_span] #[label] pub span: Span, pub required_feature: &'a str, @@ -82,9 +83,10 @@ pub(crate) struct AbiErrorDisabledVectorType<'a> { pub is_call: bool, } -#[derive(LintDiagnostic)] +#[derive(Diagnostic)] #[diag(monomorphize_abi_error_unsupported_vector_type)] pub(crate) struct AbiErrorUnsupportedVectorType<'a> { + #[primary_span] #[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 94ee34c8b7b..2ef23d7a21d 100644 --- a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs +++ b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs @@ -5,7 +5,7 @@ use rustc_hir::{CRATE_HIR_ID, HirId}; use rustc_middle::mir::{self, Location, traversal}; use rustc_middle::ty::layout::LayoutCx; use rustc_middle::ty::{self, Instance, InstanceKind, Ty, TyCtxt, TypingEnv}; -use rustc_session::lint::builtin::{ABI_UNSUPPORTED_VECTOR_TYPES, WASM_C_ABI}; +use rustc_session::lint::builtin::WASM_C_ABI; use rustc_span::def_id::DefId; use rustc_span::{DUMMY_SP, Span, Symbol, sym}; use rustc_target::callconv::{ArgAbi, Conv, FnAbi, PassMode}; @@ -50,34 +50,24 @@ fn do_check_simd_vector_abi<'tcx>( let feature = match feature_def.iter().find(|(bits, _)| size.bits() <= *bits) { Some((_, feature)) => feature, None => { - let (span, hir_id) = loc(); - tcx.emit_node_span_lint( - ABI_UNSUPPORTED_VECTOR_TYPES, - hir_id, + let (span, _hir_id) = loc(); + tcx.dcx().emit_err(errors::AbiErrorUnsupportedVectorType { span, - errors::AbiErrorUnsupportedVectorType { - span, - ty: arg_abi.layout.ty, - is_call, - }, - ); + ty: arg_abi.layout.ty, + is_call, + }); continue; } }; if !have_feature(Symbol::intern(feature)) { // Emit error. - let (span, hir_id) = loc(); - tcx.emit_node_span_lint( - ABI_UNSUPPORTED_VECTOR_TYPES, - hir_id, + let (span, _hir_id) = loc(); + tcx.dcx().emit_err(errors::AbiErrorDisabledVectorType { span, - errors::AbiErrorDisabledVectorType { - span, - required_feature: feature, - ty: arg_abi.layout.ty, - is_call, - }, - ); + required_feature: feature, + ty: arg_abi.layout.ty, + is_call, + }); } } } | 
