Correct inline assembly clobber formatting.
Fixes the formatting for inline assembly clobbers used in the book. As this causes llvm to silently ignore the clobber an error is also added to catch cases in which the wrong formatting was used. Additionally a test case is added to confirm that this error works.
This commit is contained in:
parent
47380768e7
commit
e32da12753
3 changed files with 32 additions and 3 deletions
|
@ -192,7 +192,10 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::Token
|
|||
|
||||
if OPTIONS.iter().any(|&opt| s == opt) {
|
||||
cx.span_warn(p.last_span, "expected a clobber, found an option");
|
||||
} else if s.starts_with("{") || s.ends_with("}") {
|
||||
cx.span_err(p.last_span, "clobber should not be surrounded by braces");
|
||||
}
|
||||
|
||||
clobs.push(s);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue