diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-02-11 18:04:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-11 18:04:34 +0100 |
| commit | 65d20f39f3d1706d239abb53ef271b5612ec60e7 (patch) | |
| tree | a8084a901cbaa56267d0876451ce8864c2667ba3 /compiler/rustc_target/src/asm/mod.rs | |
| parent | 09ee4e7b001d0be7ca3783aa93b4134474d678a0 (diff) | |
| parent | fbd30ea35fb79d73faa9d5b3feae391fed5336c8 (diff) | |
| download | rust-65d20f39f3d1706d239abb53ef271b5612ec60e7.tar.gz rust-65d20f39f3d1706d239abb53ef271b5612ec60e7.zip | |
Rollup merge of #136239 - folkertdev:show-supported-register-classes, r=SparrowLii,jieyouxu
show supported register classes in error message a simple diagnostic change that shows the supported register classes when an invalid one is found. This information can be hard to find (especially for unstable targets), and this message now gives at least something to try or search for. I've followed the pattern for invalid clobber ABIs. `@rustbot` label +A-inline-assembly
Diffstat (limited to 'compiler/rustc_target/src/asm/mod.rs')
| -rw-r--r-- | compiler/rustc_target/src/asm/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs index 0a4ffb15219..9f791603c72 100644 --- a/compiler/rustc_target/src/asm/mod.rs +++ b/compiler/rustc_target/src/asm/mod.rs @@ -39,12 +39,12 @@ macro_rules! def_reg_class { } } - pub fn parse(name: rustc_span::Symbol) -> Result<Self, &'static str> { + pub fn parse(name: rustc_span::Symbol) -> Result<Self, &'static [rustc_span::Symbol]> { match name { $( rustc_span::sym::$class => Ok(Self::$class), )* - _ => Err("unknown register class"), + _ => Err(&[$(rustc_span::sym::$class),*]), } } } @@ -635,7 +635,7 @@ impl InlineAsmRegClass { } } - pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result<Self, &'static str> { + pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result<Self, &'static [rustc_span::Symbol]> { Ok(match arch { InlineAsmArch::X86 | InlineAsmArch::X86_64 => { Self::X86(X86InlineAsmRegClass::parse(name)?) |
