diff options
| author | bors <bors@rust-lang.org> | 2016-01-25 20:41:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-01-25 20:41:44 +0000 |
| commit | eceb96b40dedd903ddfca6df97bb1e5749b87787 (patch) | |
| tree | 87751bdeafd78c1d25e462240436bf357b778942 /src/test | |
| parent | 62a3a6ecc0668a9a79e8da1f199500ee74862e2e (diff) | |
| parent | 616bfb6f15c377bc8850030f6239f14b8608b554 (diff) | |
| download | rust-eceb96b40dedd903ddfca6df97bb1e5749b87787.tar.gz rust-eceb96b40dedd903ddfca6df97bb1e5749b87787.zip | |
Auto merge of #31097 - DanielJCampbell:SaveAnalysis, r=nrc
Also altered the format_args! syntax extension, and \#[derive(debug)], to maintain compatability. r? @ nrc
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 |
