Uh oh!
There was an error while loading. Please reload this page.
Handle GCC's write-only inline asm constraint in liveness, borrowck and trans. - #9850
Conversation
alexcrichton
commented
Oct 14, 2013
It looks to be that we have a section of constraints which are all dedicated to "output constraints", but it's possible to have an output constraint which isn't validated to be writable? It seems to me that we should merge all the constraints into one list (having Or is there a purpose for having an output constraint without an |
eddyb
commented
Oct 14, 2013
For the following C code: intmain() {
shortport=0;
intval=0;
asm("in %1, %0" : "a"(val) : "d"(port));
}GCC gives me this error: while clang just fails validation, without a precise cause (but better location info than GCC): <stdin>:4:23: error: invalidoutputconstraint'a'inasm
asm("in %1, %0" : "a"(val) : "d"(port));}
^
1errorgenerated.We can follow the same rule, require '=' at the start of output constraints, and then remove all my |
There was a problem hiding this comment.
This can just be one line, no need to manually wrap. The max line length is 100 characters.
I've implemented analysis support for the [GCC '=' write-only inline asm constraint modifier](http://gcc.gnu.org/onlinedocs/gcc/Modifiers.html). I had more changes, for '+' (read+write) as well, but it turns out LLVM doesn't support '+' at all. I've removed the need for wrapping each output in ExprAddrOf, as that would require unwrapping almost everywhere and it was harder to reason about in borrowck than ExprAssign's LHS. With this change, rustc will treat (in respect to validity of accessing a local) code like this: ```rust let x: int; unsafe { asm!("mov $1, $0" : "=r"(x) : "r"(5u)); } ``` as if it were this: ```rust let x : int; x = 5; ``` Previously, the local was required to be both mutable and initialized, and the write effect wasn't recorded.
Preserve `ref` on `infallible_destructuring_match` suggestion Fixesrust-lang/rust-clippy#7499 changelog: [`infallible_destructuring_match`]: Preserve `ref` on suggestion
Don't filter out private items when completing paths in the same crate. Instead respect the `privateEditable` setting. Fixesrust-lang#9850
Don't filter out private items when completing paths in the same crate. Instead respect the `privateEditable` setting. Fixesrust-lang#9850
I've implemented analysis support for the GCC '=' write-only inline asm constraint modifier. I had more changes, for '+' (read+write) as well, but it turns out LLVM doesn't support '+' at all.
I've removed the need for wrapping each output in ExprAddrOf, as that would require unwrapping almost everywhere and it was harder to reason about in borrowck than ExprAssign's LHS.
With this change, rustc will treat (in respect to validity of accessing a local) code like this:
as if it were this:
Previously, the local was required to be both mutable and initialized, and the write effect wasn't recorded.