2017-01-15 19:50:27 -06:00
|
|
|
// rustfmt-normalize_comments: true
|
2016-01-22 13:40:26 -06:00
|
|
|
itemmacro!(this, is.now().formatted(yay));
|
2015-09-14 15:53:30 -05:00
|
|
|
|
2017-06-11 23:01:41 -05:00
|
|
|
itemmacro!(
|
|
|
|
really,
|
|
|
|
long.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb()
|
|
|
|
.is
|
|
|
|
.formatted()
|
|
|
|
);
|
2016-01-24 13:11:18 -06:00
|
|
|
|
|
|
|
itemmacro!{this, is.bracket().formatted()}
|
|
|
|
|
2016-03-27 07:45:55 -05:00
|
|
|
peg_file! modname("mygrammarfile.rustpeg");
|
|
|
|
|
2015-09-14 15:53:30 -05:00
|
|
|
fn main() {
|
|
|
|
foo!();
|
|
|
|
|
|
|
|
bar!(a, b, c);
|
|
|
|
|
2017-06-22 22:57:34 -05:00
|
|
|
bar!(a, b, c,);
|
|
|
|
|
2015-09-14 15:53:30 -05:00
|
|
|
baz!(1 + 2 + 3, quux.kaas());
|
|
|
|
|
2017-06-11 23:01:41 -05:00
|
|
|
quux!(
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
|
|
|
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
|
|
);
|
2015-09-14 15:53:30 -05:00
|
|
|
|
2017-06-11 23:01:41 -05:00
|
|
|
kaas!(
|
|
|
|
// comments
|
|
|
|
a, // post macro
|
2017-07-05 11:03:20 -05:00
|
|
|
b // another
|
2017-06-11 23:01:41 -05:00
|
|
|
);
|
2015-09-14 15:53:30 -05:00
|
|
|
|
2017-06-22 22:57:34 -05:00
|
|
|
trailingcomma!(a, b, c,);
|
2015-09-14 15:53:30 -05:00
|
|
|
|
|
|
|
noexpr!( i am not an expression, OK? );
|
|
|
|
|
|
|
|
vec![a, b, c];
|
|
|
|
|
2017-06-11 23:01:41 -05:00
|
|
|
vec![
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
AAAAAA,
|
|
|
|
BBBBB,
|
|
|
|
5,
|
|
|
|
100 - 30,
|
|
|
|
1.33,
|
|
|
|
b,
|
|
|
|
b,
|
|
|
|
b,
|
|
|
|
];
|
2015-09-14 15:53:30 -05:00
|
|
|
|
|
|
|
vec![a /* comment */];
|
|
|
|
|
2016-11-13 22:42:15 -06:00
|
|
|
// Trailing spaces after a comma
|
|
|
|
vec![a];
|
|
|
|
|
2017-05-19 05:25:53 -05:00
|
|
|
vec![a; b];
|
|
|
|
vec![a; b];
|
|
|
|
vec![a; b];
|
|
|
|
|
|
|
|
vec![a, b; c];
|
|
|
|
vec![a; b, c];
|
|
|
|
|
2017-06-14 06:39:07 -05:00
|
|
|
vec![
|
|
|
|
a;
|
|
|
|
(|x| {
|
2017-07-19 10:35:00 -05:00
|
|
|
let y = x + 1;
|
|
|
|
let z = y + 1;
|
|
|
|
z
|
|
|
|
})(2)
|
2017-06-14 06:39:07 -05:00
|
|
|
];
|
|
|
|
vec![
|
|
|
|
a;
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
|
|
];
|
2017-05-21 18:50:46 -05:00
|
|
|
vec![a; unsafe { x + 1 }];
|
|
|
|
|
2017-06-22 22:57:34 -05:00
|
|
|
unknown_bracket_macro__comma_should_not_be_stripped![a,];
|
2016-11-13 22:42:15 -06:00
|
|
|
|
2015-09-14 15:53:30 -05:00
|
|
|
foo(makro!(1, 3));
|
|
|
|
|
|
|
|
hamkaas!{ () };
|
|
|
|
|
|
|
|
macrowithbraces! {dont, format, me}
|
2015-10-28 01:41:32 -05:00
|
|
|
|
|
|
|
x!(fn);
|
2016-03-27 06:44:08 -05:00
|
|
|
|
|
|
|
some_macro!();
|
|
|
|
|
|
|
|
some_macro![];
|
|
|
|
|
|
|
|
some_macro!{
|
|
|
|
// comment
|
|
|
|
};
|
|
|
|
|
|
|
|
some_macro!{
|
|
|
|
// comment
|
|
|
|
};
|
2016-10-02 23:11:49 -05:00
|
|
|
|
|
|
|
some_macro!(
|
|
|
|
// comment
|
|
|
|
not function like
|
|
|
|
);
|
2017-05-23 11:18:15 -05:00
|
|
|
|
2017-06-17 12:35:18 -05:00
|
|
|
// #1712
|
|
|
|
let image = gray_image!(
|
|
|
|
00, 01, 02;
|
|
|
|
10, 11, 12;
|
|
|
|
20, 21, 22);
|
|
|
|
|
2017-05-07 16:44:48 -05:00
|
|
|
// #1092
|
|
|
|
chain!(input, a:take!(max_size), || []);
|
2016-03-27 06:44:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl X {
|
|
|
|
empty_invoc!{}
|
2015-09-14 15:53:30 -05:00
|
|
|
}
|
2016-04-27 14:08:44 -05:00
|
|
|
|
2017-01-17 15:38:46 -06:00
|
|
|
fn issue_1279() {
|
|
|
|
println!("dsfs"); // a comment
|
|
|
|
}
|
2017-05-15 08:55:01 -05:00
|
|
|
|
|
|
|
fn issue_1555() {
|
2017-06-22 22:57:34 -05:00
|
|
|
let hello = &format!(
|
|
|
|
"HTTP/1.1 200 OK\r\nServer: {}\r\n\r\n{}",
|
|
|
|
"65454654654654654654654655464",
|
|
|
|
"4"
|
|
|
|
);
|
2017-05-15 08:55:01 -05:00
|
|
|
}
|
2017-05-27 21:41:16 -05:00
|
|
|
|
|
|
|
fn issue1178() {
|
|
|
|
macro_rules! foo {
|
|
|
|
(#[$attr:meta] $name:ident) => {}
|
|
|
|
}
|
|
|
|
|
2017-08-11 03:54:20 -05:00
|
|
|
foo!(
|
|
|
|
#[doc = "bar"]
|
|
|
|
baz
|
|
|
|
);
|
2017-05-27 21:41:16 -05:00
|
|
|
}
|
2017-08-21 09:19:01 -05:00
|
|
|
|
2017-06-22 22:57:34 -05:00
|
|
|
fn issue1739() {
|
|
|
|
sql_function!(
|
|
|
|
add_rss_item,
|
|
|
|
add_rss_item_t,
|
|
|
|
(
|
|
|
|
a: types::Integer,
|
|
|
|
b: types::Timestamptz,
|
|
|
|
c: types::Text,
|
|
|
|
d: types::Text,
|
2017-06-22 23:40:30 -05:00
|
|
|
e: types::Text
|
2017-06-22 22:57:34 -05:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
w.slice_mut(s![
|
|
|
|
..,
|
|
|
|
init_size[1] - extreeeeeeeeeeeeeeeeeeeeeeeem..init_size[1],
|
|
|
|
..
|
|
|
|
]).par_map_inplace(|el| *el = 0.);
|
|
|
|
}
|
|
|
|
|
2017-08-21 09:19:01 -05:00
|
|
|
fn issue_1885() {
|
|
|
|
let threads = people
|
|
|
|
.into_iter()
|
|
|
|
.map(|name| {
|
|
|
|
chan_select! {
|
|
|
|
rx.recv() => {}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
}
|
|
|
|
|
2017-08-25 08:35:22 -05:00
|
|
|
fn issue_1917() {
|
|
|
|
mod x {
|
|
|
|
quickcheck! {
|
|
|
|
fn test(a: String, s: String, b: String) -> TestResult {
|
|
|
|
if a.find(&s).is_none() {
|
|
|
|
|
|
|
|
TestResult::from_bool(true)
|
|
|
|
} else {
|
|
|
|
TestResult::discard()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-26 23:44:49 -05:00
|
|
|
fn issue_1921() {
|
|
|
|
// Macro with tabs.
|
|
|
|
lazy_static! {
|
|
|
|
static ref ONE: u32 = 1;
|
|
|
|
static ref TWO: u32 = 2;
|
|
|
|
static ref THREE: u32 = 3;
|
|
|
|
static ref FOUR: u32 = {
|
|
|
|
let mut acc = 1;
|
|
|
|
acc += 1;
|
|
|
|
acc += 2;
|
|
|
|
acc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-22 22:57:34 -05:00
|
|
|
// #1577
|
|
|
|
fn issue1577() {
|
|
|
|
let json = json!({
|
|
|
|
"foo": "bar",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx_pipeline!(pipe {
|
|
|
|
vbuf: gfx::VertexBuffer<Vertex> = (),
|
|
|
|
out: gfx::RenderTarget<ColorFormat> = "Target0",
|
|
|
|
});
|
2017-08-29 22:00:10 -05:00
|
|
|
|
|
|
|
// #1919
|
|
|
|
#[test]
|
|
|
|
fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
|
|
|
|
assert_eq!(
|
|
|
|
::std::mem::size_of::<HandleWithDtor<::std::os::raw::c_int>>(),
|
|
|
|
8usize,
|
|
|
|
concat!(
|
|
|
|
"Size of template specialization: ",
|
|
|
|
stringify!(HandleWithDtor<::std::os::raw::c_int>)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
assert_eq!(
|
|
|
|
::std::mem::align_of::<HandleWithDtor<::std::os::raw::c_int>>(),
|
|
|
|
8usize,
|
|
|
|
concat!(
|
|
|
|
"Alignment of template specialization: ",
|
|
|
|
stringify!(HandleWithDtor<::std::os::raw::c_int>)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2017-10-05 05:44:45 -05:00
|
|
|
|
|
|
|
// #878
|
|
|
|
macro_rules! try_opt {
|
|
|
|
($expr:expr) => (match $expr {
|
|
|
|
Some(val) => val,
|
|
|
|
|
|
|
|
None => { return None; }
|
|
|
|
})
|
|
|
|
}
|