diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-make/save-analysis/foo.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index 3e4ba5af80c..7a1c200ba20 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -287,6 +287,26 @@ pub struct blah { used_link_args: RefCell<[&'static str; 0]>, } +#[macro_use] +mod macro_use_test { + macro_rules! test_rec { + (q, $src: expr) => {{ + print!("{}", $src); + test_rec!($src); + }}; + ($src: expr) => { + print!("{}", $src); + }; + } + + macro_rules! internal_vars { + ($src: ident) => {{ + let mut x = $src; + x += 100; + }}; + } +} + fn main() { // foo let s = box some_fields {field1: 43}; hello((43, "a".to_string()), *s); @@ -356,6 +376,11 @@ fn main() { // foo while let Some(z) = None { foo_foo(z); } + + let mut x = 4; + test_rec!(q, "Hello"); + assert_eq!(x, 4); + internal_vars!(x); } fn foo_foo(_: i32) {} @@ -398,3 +423,16 @@ impl Error + 'static + Send { <Error + 'static>::is::<T>(self) } } +extern crate serialize; +#[derive(Clone, Copy, Hash, Encodable, Decodable, PartialEq, Eq, PartialOrd, Ord, Debug, Default)] +struct AllDerives(i32); + +fn test_format_args() { + let x = 1; + let y = 2; + let name = "Joe Blogg"; + println!("Hello {}", name); + print!("Hello {0}", name); + print!("{0} + {} = {}", x, y); + print!("x is {}, y is {1}, name is {n}", x, y, n = name); +} \ No newline at end of file |
