diff options
| author | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2022-08-26 20:44:44 -0700 |
|---|---|---|
| committer | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2022-09-24 10:24:48 -0700 |
| commit | d9aa635969b1fa3a00899ecc58a5c7076fd16f9d (patch) | |
| tree | ae50236c8b25b3b98c1a8d7a0cf414ff1c14cf68 | |
| parent | 7e00a4830520eb01dfb547726a0705a63227e8b7 (diff) | |
| download | rust-d9aa635969b1fa3a00899ecc58a5c7076fd16f9d.tar.gz rust-d9aa635969b1fa3a00899ecc58a5c7076fd16f9d.zip | |
Add UnwindingInlineAsm
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/asm.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/errors.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl | 5 |
3 files changed, 13 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_gcc/src/asm.rs b/compiler/rustc_codegen_gcc/src/asm.rs index 52fd66af065..007b001f213 100644 --- a/compiler/rustc_codegen_gcc/src/asm.rs +++ b/compiler/rustc_codegen_gcc/src/asm.rs @@ -12,6 +12,7 @@ use std::borrow::Cow; use crate::builder::Builder; use crate::context::CodegenCx; +use crate::errors::UnwindingInlineAsm; use crate::type_of::LayoutGccExt; use crate::callee::get_fn; @@ -109,7 +110,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> { fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], _instance: Instance<'_>, _dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) { if options.contains(InlineAsmOptions::MAY_UNWIND) { self.sess() - .struct_span_err(span[0], "GCC backend does not support unwinding from inline asm") + .create_err(UnwindingInlineAsm { span: span[0] }) .emit(); return; } diff --git a/compiler/rustc_codegen_gcc/src/errors.rs b/compiler/rustc_codegen_gcc/src/errors.rs index 456a60c6f90..e0c7dca8e32 100644 --- a/compiler/rustc_codegen_gcc/src/errors.rs +++ b/compiler/rustc_codegen_gcc/src/errors.rs @@ -13,3 +13,10 @@ pub(crate) struct LinkageConstOrMutType { #[primary_span] pub span: Span } + +#[derive(SessionDiagnostic)] +#[diag(codegen_gcc::unwinding_inline_asm)] +pub(crate) struct UnwindingInlineAsm { + #[primary_span] + pub span: Span +} diff --git a/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl b/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl index 80af7232c06..1920cf0fff1 100644 --- a/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl +++ b/compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl @@ -2,4 +2,7 @@ codegen_gcc_ranlib_failure = Ranlib exited with code {$exit_code} codegen_gcc_linkage_const_or_mut_type = - must have type `*const T` or `*mut T` due to `#[linkage]` attribute \ No newline at end of file + must have type `*const T` or `*mut T` due to `#[linkage]` attribute + +codegen_gcc_unwinding_inline_asm = + GCC backend does not support unwinding from inline asm |
