diff options
| author | Gary Guo <gary@garyguo.net> | 2023-12-26 04:44:22 +0000 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2024-02-24 18:50:09 +0000 |
| commit | 31f078ea9941ce89f1f5ab5fb1239bbbddfe4d49 (patch) | |
| tree | 2efe9ef8add222d16f5d2de20ed2cbfe0b79efdb /compiler/rustc_builtin_macros/src/asm.rs | |
| parent | 5e4e3d790bb5e53b31abf58fd0e2be557c28d496 (diff) | |
| download | rust-31f078ea9941ce89f1f5ab5fb1239bbbddfe4d49.tar.gz rust-31f078ea9941ce89f1f5ab5fb1239bbbddfe4d49.zip | |
Forbid asm unwind to work with labels
Diffstat (limited to 'compiler/rustc_builtin_macros/src/asm.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/asm.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index 93eb3a9a43e..85f009f7e63 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -245,6 +245,7 @@ pub fn parse_asm_args<'a>( let mut have_real_output = false; let mut outputs_sp = vec![]; let mut regclass_outputs = vec![]; + let mut labels_sp = vec![]; for (op, op_sp) in &args.operands { match op { ast::InlineAsmOperand::Out { reg, expr, .. } @@ -262,6 +263,9 @@ pub fn parse_asm_args<'a>( regclass_outputs.push(*op_sp); } } + ast::InlineAsmOperand::Label { .. } => { + labels_sp.push(*op_sp); + } _ => {} } } @@ -273,6 +277,9 @@ pub fn parse_asm_args<'a>( // Bail out now since this is likely to confuse MIR return Err(err); } + if args.options.contains(ast::InlineAsmOptions::MAY_UNWIND) && !labels_sp.is_empty() { + dcx.emit_err(errors::AsmMayUnwind { labels_sp }); + } if args.clobber_abis.len() > 0 { if is_global_asm { |
