mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 14:57:14 +00:00
parent
f1241f14dc
commit
31261fd629
@ -63,6 +63,12 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||||||
'statement: loop {
|
'statement: loop {
|
||||||
match state {
|
match state {
|
||||||
Asm => {
|
Asm => {
|
||||||
|
if asm_str_style.is_some() {
|
||||||
|
// If we already have a string with instructions,
|
||||||
|
// ending up in Asm state again is an error.
|
||||||
|
cx.span_err(sp, "malformed inline assembly");
|
||||||
|
return DummyResult::expr(sp);
|
||||||
|
}
|
||||||
let (s, style) = match expr_to_string(cx, p.parse_expr(),
|
let (s, style) = match expr_to_string(cx, p.parse_expr(),
|
||||||
"inline assembly must be a string literal") {
|
"inline assembly must be a string literal") {
|
||||||
Some((s, st)) => (s, st),
|
Some((s, st)) => (s, st),
|
||||||
|
16
src/test/compile-fail/issue-21045.rs
Normal file
16
src/test/compile-fail/issue-21045.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2014 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" "nop"); //~ ERROR malformed inline assembly
|
||||||
|
asm!("nop" "nop" : "=r"(a)); //~ ERROR malformed inline assembly
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user