Open folkertdev opened 9 months ago
We intentionally do almost no validation of the asm contents in rustc itself and I think that this decision is unlikely to change. LLVM's assembler reports an error on the expanded asm, but it only gives a message and a character position, and rustc re-wraps that into an error with the same format as other errors.
right, there is not a lot of structure to go on in the error message (and no guarantee of any consistency between platforms). But I think some information about the source of the error (it's the assembler then? I thought it was the linker) would be helpful. Just something to search for
Code
Current output
Desired output
Rationale and extra context
it would be nice for the error to mention that a target feature is required.
this error only occurs on arm. I've not been able to get this error message on x86 (I tried with various unstable attributes like avx512 or tbm (trailing bit manipulation).with avx512 you already need the target feature because otherwise you cannot in/out avx512 registers to the assembly, so this issue is unlikely to come up there.
with tbm i would expect this error, but apparently it doesn't come up there, maybe the linker does not report it?
Other cases
No response
Rust Version
Anything else?
I'd be interested in implementing this. I've poked around a bit already, but would like to settle on a desired error message first.
One thing I'm not sure about is whether the span of the surrounding function is available when the error is generated here https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/back/write.rs#L1898. is that a hint that we can give there?