Add tests and longer error explanation
This commit is contained in:
parent
44c686113f
commit
5d52ef5091
5 changed files with 67 additions and 3 deletions
|
|
@ -7,10 +7,11 @@
|
|||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
fn main() {
|
||||
let a;
|
||||
asm!("nop" "nop"); //~ ERROR malformed inline assembly
|
||||
asm!("nop" "nop" : "=r"(a)); //~ ERROR malformed inline assembly
|
||||
asm!("nop" "nop");
|
||||
asm!("nop" "nop" : "=r"(a));
|
||||
}
|
||||
15
src/test/ui/E0660.stderr
Normal file
15
src/test/ui/E0660.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
error[E0660]: malformed inline assembly
|
||||
--> $DIR/E0660.rs:15:5
|
||||
|
|
||||
LL | asm!("nop" "nop");
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0660]: malformed inline assembly
|
||||
--> $DIR/E0660.rs:16:5
|
||||
|
|
||||
LL | asm!("nop" "nop" : "=r"(a));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0660`.
|
||||
16
src/test/ui/E0661.rs
Normal file
16
src/test/ui/E0661.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
fn main() {
|
||||
let a;
|
||||
asm!("nop" : "r"(a));
|
||||
}
|
||||
9
src/test/ui/E0661.stderr
Normal file
9
src/test/ui/E0661.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0661]: output operand constraint lacks '=' or '+'
|
||||
--> $DIR/E0661.rs:15:18
|
||||
|
|
||||
LL | asm!("nop" : "r"(a));
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0661`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue