diff options
| author | SLASHLogin <loginmlgxd@gmail.com> | 2022-08-26 21:27:17 +0200 |
|---|---|---|
| committer | SLASHLogin <loginmlgxd@gmail.com> | 2022-11-09 14:56:21 +0100 |
| commit | 185ef7b6de0dcdd32af43fd75efa41fd128cbaad (patch) | |
| tree | afa86983a15ad6263b67a8584fe20169c13912b5 /compiler/rustc_codegen_llvm/src/attributes.rs | |
| parent | 33ef16f291b6a43dc57dcb8915bdb4aa736a7936 (diff) | |
| download | rust-185ef7b6de0dcdd32af43fd75efa41fd128cbaad.tar.gz rust-185ef7b6de0dcdd32af43fd75efa41fd128cbaad.zip | |
Port `MissingFeatures` and `TargetFeatureDisableOrEnable`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 02eef104077..ce54c281384 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -12,7 +12,7 @@ use rustc_target::spec::{FramePointer, SanitizerSet, StackProbeType, StackProtec use smallvec::SmallVec; use crate::attributes; -use crate::errors::SanitizerMemtagRequiresMte; +use crate::errors::{MissingFeatures, SanitizerMemtagRequiresMte, TargetFeatureDisableOrEnable}; use crate::llvm::AttributePlace::Function; use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects}; use crate::llvm_util; @@ -394,13 +394,11 @@ pub fn from_fn_attrs<'ll, 'tcx>( .get_attrs(instance.def_id(), sym::target_feature) .next() .map_or_else(|| cx.tcx.def_span(instance.def_id()), |a| a.span); - let msg = format!( - "the target features {} must all be either enabled or disabled together", - f.join(", ") - ); - let mut err = cx.tcx.sess.struct_span_err(span, &msg); - err.help("add the missing features in a `target_feature` attribute"); - err.emit(); + cx.tcx + .sess + .create_err(TargetFeatureDisableOrEnable { features: f, span: Some(span) }) + .subdiagnostic(MissingFeatures) + .emit(); return; } |
