Expand string literals and exprs inside of macros
A couple of syntax extensions manually expanded expressions, but it wasn't done universally, most noticably inside of asm!(). There's also a bit of random cleanup.
This commit is contained in:
parent
25431774a9
commit
a0e54c7761
7 changed files with 41 additions and 23 deletions
16
src/test/run-pass/asm-concat-src.rs
Normal file
16
src/test/run-pass/asm-concat-src.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.
|
||||
|
||||
// ignore-fast #[feature] doesn't work with check-fast
|
||||
#[feature(asm)];
|
||||
|
||||
pub fn main() {
|
||||
unsafe { asm!(concat!("", "")) };
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
|
|
|
|||
15
src/test/run-pass/ext-expand-inner-exprs.rs
Normal file
15
src/test/run-pass/ext-expand-inner-exprs.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// 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.
|
||||
|
||||
static FOO : &'static [u8] = bytes!(concat!(concat!("hel", "lo"), "world"));
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(FOO, "helloworld".as_bytes());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue