diff options
| author | Alice Ryhl <aliceryhl@google.com> | 2024-05-15 10:01:55 +0200 |
|---|---|---|
| committer | Alice Ryhl <aliceryhl@google.com> | 2024-05-15 11:14:45 +0200 |
| commit | b780fa9219c4c921e3334971a9e673e22cbea375 (patch) | |
| tree | e8133ab3828212b29aed70ecba05c6e369b82e97 /compiler/rustc_codegen_llvm/src/llvm_util.rs | |
| parent | 518becf5ea30807f98b89002a70e5640e6e8bbf4 (diff) | |
| download | rust-b780fa9219c4c921e3334971a9e673e22cbea375.tar.gz rust-b780fa9219c4c921e3334971a9e673e22cbea375.zip | |
Use an error struct instead of a panic
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index b3359b81602..53b9b530e9b 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -1,6 +1,6 @@ use crate::back::write::create_informational_target_machine; use crate::errors::{ - InvalidTargetFeaturePrefix, PossibleFeature, TargetFeatureDisableOrEnable, + FixedX18InvalidArch, InvalidTargetFeaturePrefix, PossibleFeature, TargetFeatureDisableOrEnable, UnknownCTargetFeature, UnknownCTargetFeaturePrefix, UnstableCTargetFeature, }; use crate::llvm; @@ -618,11 +618,10 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str // -Zfixed-x18 if sess.opts.unstable_opts.fixed_x18 { if sess.target.arch != "aarch64" { - // TODO: What's the correct way to return a error here? - panic!("-Zfixed-x18 only allowed on aarch64"); + sess.dcx().emit_fatal(FixedX18InvalidArch { arch: &sess.target.arch }); + } else { + features.push("+reserve-x18".into()); } - - features.push("+reserve-x18".into()); } if diagnostics && let Some(f) = check_tied_features(sess, &featsmap) { |
