Auto merge of #31097 - DanielJCampbell:SaveAnalysis, r=nrc

Also altered the format_args! syntax extension, and \#[derive(debug)], to maintain compatability.
r? @ nrc
This commit is contained in:
bors 2016-01-25 20:41:44 +00:00
commit eceb96b40d
8 changed files with 248 additions and 198 deletions

View file

@ -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);
}