about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/diagnostics.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-10-10 22:24:48 +0000
committerbors <bors@rust-lang.org>2018-10-10 22:24:48 +0000
commitf42c510f2f952a6eba80e6448b46e83bfcc04e44 (patch)
treed57bb7afe65000a868a8900c04d9cef4d2904e4d /src/librustc_codegen_llvm/diagnostics.rs
parent5af0bb83044c3fb43d59ad5f49ee5ae1a293901f (diff)
parent3d7476eae1f4903684426835e97ba8f5d337c300 (diff)
downloadrust-f42c510f2f952a6eba80e6448b46e83bfcc04e44.tar.gz
rust-f42c510f2f952a6eba80e6448b46e83bfcc04e44.zip
Auto merge of #54747 - levex:inline-asm-bad-operands, r=nagisa
codegen_llvm: verify that inline assembly operands are scalars

Another set of inline assembly fixes. This time let's emit an error message when the operand value cannot be coerced into the operand constraint.

Two questions:

1) Should I reuse `E0668` which was introduced in #54568 or just use `E0669` as it stands because they do mean different things, but maybe that's not too user-friendly. Just a thought.
2) The `try_fold` returns the operand which failed to be converted into a scalar value, any suggestions on how to use that in the error message?

Thanks!
Diffstat (limited to 'src/librustc_codegen_llvm/diagnostics.rs')
-rw-r--r--src/librustc_codegen_llvm/diagnostics.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librustc_codegen_llvm/diagnostics.rs b/src/librustc_codegen_llvm/diagnostics.rs
index 242b7a1a119..5721938c9c0 100644
--- a/src/librustc_codegen_llvm/diagnostics.rs
+++ b/src/librustc_codegen_llvm/diagnostics.rs
@@ -69,4 +69,15 @@ fn main() {
 ```
 "##,
 
+E0669: r##"
+Cannot convert inline assembly operand to a single LLVM value.
+
+This error usually happens when trying to pass in a value to an input inline
+assembly operand that is actually a pair of values. In particular, this can
+happen when trying to pass in a slice, for instance a `&str`. In Rust, these
+values are represented internally as a pair of values, the pointer and its
+length. When passed as an input operand, this pair of values can not be
+coerced into a register and thus we must fail with an error.
+"##,
+
 }