diff options
| author | Kang Seonghoon <public+git@mearie.org> | 2014-11-30 11:56:31 +0900 |
|---|---|---|
| committer | Kang Seonghoon <public+git@mearie.org> | 2014-11-30 11:58:23 +0900 |
| commit | 989f906af31d8a1d25eb3657896d2f3550d62fa2 (patch) | |
| tree | 17f1c273f116c2028e41a1bd91550a557199dca6 /src/libsyntax | |
| parent | 8d8f41b75f9bec7c7676122f85e049e7d7933298 (diff) | |
| download | rust-989f906af31d8a1d25eb3657896d2f3550d62fa2.tar.gz rust-989f906af31d8a1d25eb3657896d2f3550d62fa2.zip | |
syntax: Make `asm!` clobbers a proper vector.
Otherwise `--pretty expanded` diverges.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/asm.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 28d5fbb9689..7e421df505d 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1177,7 +1177,7 @@ pub struct InlineAsm { pub asm_str_style: StrStyle, pub outputs: Vec<(InternedString, P<Expr>, bool)>, pub inputs: Vec<(InternedString, P<Expr>)>, - pub clobbers: InternedString, + pub clobbers: Vec<InternedString>, pub volatile: bool, pub alignstack: bool, pub dialect: AsmDialect, diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index d04144ef26e..a1c4c0a0a10 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -53,7 +53,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let mut asm_str_style = None; let mut outputs = Vec::new(); let mut inputs = Vec::new(); - let mut cons = "".to_string(); + let mut clobs = Vec::new(); let mut volatile = false; let mut alignstack = false; let mut dialect = ast::AsmAtt; @@ -138,7 +138,6 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) } } Clobbers => { - let mut clobs = Vec::new(); while p.token != token::Eof && p.token != token::Colon && p.token != token::ModSep { @@ -148,15 +147,12 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) } let (s, _str_style) = p.parse_str(); - let clob = format!("~{{{}}}", s); - clobs.push(clob); if OPTIONS.iter().any(|opt| s.equiv(opt)) { cx.span_warn(p.last_span, "expected a clobber, found an option"); } + clobs.push(s); } - - cons = clobs.connect(","); } Options => { let (option, _str_style) = p.parse_str(); @@ -216,7 +212,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) asm_str_style: asm_str_style.unwrap(), outputs: outputs, inputs: inputs, - clobbers: token::intern_and_get_ident(cons.as_slice()), + clobbers: clobs, volatile: volatile, alignstack: alignstack, dialect: dialect, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c12c3098279..b2c783b4bd9 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1839,7 +1839,11 @@ impl<'a> State<'a> { try!(space(&mut self.s)); try!(self.word_space(":")); - try!(self.print_string(a.clobbers.get(), ast::CookedStr)); + try!(self.commasep(Inconsistent, a.clobbers.as_slice(), + |s, co| { + try!(s.print_string(co.get(), ast::CookedStr)); + Ok(()) + })); try!(self.pclose()); } ast::ExprMac(ref m) => try!(self.print_mac(m)), |
