diff options
| author | Folkert de Vries <folkert@folkertdev.nl> | 2024-09-05 19:45:40 +0200 |
|---|---|---|
| committer | Folkert de Vries <folkert@folkertdev.nl> | 2024-10-06 19:00:09 +0200 |
| commit | 5fc60d1e52ea12f53d2c8d22fee94592860739ad (patch) | |
| tree | 084c2db049438541f8365fbb25fe4fa6123c2436 /compiler/rustc_ast/src | |
| parent | 10fa482906ab1f2fba07b32b70457ad9444e8f63 (diff) | |
| download | rust-5fc60d1e52ea12f53d2c8d22fee94592860739ad.tar.gz rust-5fc60d1e52ea12f53d2c8d22fee94592860739ad.zip | |
various fixes for `naked_asm!` implementation
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
Diffstat (limited to 'compiler/rustc_ast/src')
| -rw-r--r-- | compiler/rustc_ast/src/ast.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index cb715213176..733c2d93114 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -2435,7 +2435,7 @@ pub enum AsmMacro { } impl AsmMacro { - pub const fn macro_name(&self) -> &'static str { + pub const fn macro_name(self) -> &'static str { match self { AsmMacro::Asm => "asm", AsmMacro::GlobalAsm => "global_asm", @@ -2443,13 +2443,21 @@ impl AsmMacro { } } - pub const fn is_supported_option(&self, option: InlineAsmOptions) -> bool { + pub const fn is_supported_option(self, option: InlineAsmOptions) -> bool { match self { AsmMacro::Asm => true, AsmMacro::GlobalAsm => InlineAsmOptions::GLOBAL_OPTIONS.contains(option), AsmMacro::NakedAsm => InlineAsmOptions::NAKED_OPTIONS.contains(option), } } + + pub const fn diverges(self, options: InlineAsmOptions) -> bool { + match self { + AsmMacro::Asm => options.contains(InlineAsmOptions::NORETURN), + AsmMacro::GlobalAsm => true, + AsmMacro::NakedAsm => true, + } + } } /// Inline assembly. |
