Skip to content

Commit d9aa635

Browse files
committed
Add UnwindingInlineAsm
1 parent 7e00a48 commit d9aa635

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

compiler/rustc_codegen_gcc/src/asm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::borrow::Cow;
1212

1313
use crate::builder::Builder;
1414
use crate::context::CodegenCx;
15+
use crate::errors::UnwindingInlineAsm;
1516
use crate::type_of::LayoutGccExt;
1617
use crate::callee::get_fn;
1718

@@ -109,7 +110,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
109110
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>)>) {
110111
if options.contains(InlineAsmOptions::MAY_UNWIND) {
111112
self.sess()
112-
.struct_span_err(span[0], "GCC backend does not support unwinding from inline asm")
113+
.create_err(UnwindingInlineAsm { span: span[0] })
113114
.emit();
114115
return;
115116
}

compiler/rustc_codegen_gcc/src/errors.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ pub(crate) struct LinkageConstOrMutType {
1313
#[primary_span]
1414
pub span: Span
1515
}
16+
17+
#[derive(SessionDiagnostic)]
18+
#[diag(codegen_gcc::unwinding_inline_asm)]
19+
pub(crate) struct UnwindingInlineAsm {
20+
#[primary_span]
21+
pub span: Span
22+
}

compiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ codegen_gcc_ranlib_failure =
22
Ranlib exited with code {$exit_code}
33
44
codegen_gcc_linkage_const_or_mut_type =
5-
must have type `*const T` or `*mut T` due to `#[linkage]` attribute
5+
must have type `*const T` or `*mut T` due to `#[linkage]` attribute
6+
7+
codegen_gcc_unwinding_inline_asm =
8+
GCC backend does not support unwinding from inline asm

0 commit comments

Comments
 (0)