2017-01-15 19:50:27 -06:00
|
|
|
// rustfmt-normalize_comments: true
|
2018-07-17 19:09:50 -05:00
|
|
|
// rustfmt-format_macro_matchers: 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
|
|
|
|
2018-11-17 12:53:11 -06:00
|
|
|
itemmacro! {this, is.brace().formatted()}
|
2016-01-24 13:11:18 -06:00
|
|
|
|
2015-09-14 15:53:30 -05:00
|
|
|
fn main() {
|
|
|
|
foo!();
|
|
|
|
|
2018-03-28 04:14:51 -05:00
|
|
|
foo!(,);
|
|
|
|
|
2015-09-14 15:53:30 -05:00
|
|
|
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!(
|
2018-01-25 07:30:23 -06:00
|
|
|
// comments
|
|
|
|
a, // post macro
|
|
|
|
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,);
|
2017-10-27 02:35:40 -05:00
|
|
|
// Preserve trailing comma only when necessary.
|
|
|
|
ok!(file.seek(SeekFrom::Start(
|
|
|
|
table.map(|table| fixture.offset(table)).unwrap_or(0),
|
|
|
|
)));
|
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));
|
|
|
|
|
2018-11-17 12:53:11 -06:00
|
|
|
hamkaas! { () };
|
2015-09-14 15:53:30 -05:00
|
|
|
|
|
|
|
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![];
|
|
|
|
|
2018-11-17 12:53:11 -06:00
|
|
|
some_macro! {
|
2016-03-27 06:44:08 -05:00
|
|
|
// comment
|
|
|
|
};
|
|
|
|
|
2018-11-17 12:53:11 -06:00
|
|
|
some_macro! {
|
2016-03-27 06:44:08 -05:00
|
|
|
// 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
|
2017-12-04 17:44:26 -06:00
|
|
|
chain!(input, a: take!(max_size), || []);
|
2018-05-23 10:13:56 -05:00
|
|
|
|
|
|
|
// #2727
|
|
|
|
foo!("bar");
|
2016-03-27 06:44:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl X {
|
2018-11-17 12:53:11 -06:00
|
|
|
empty_invoc! {}
|
2018-11-05 23:48:49 -06:00
|
|
|
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{}",
|
2017-11-30 22:30:21 -06:00
|
|
|
"65454654654654654654654655464", "4"
|
2017-06-22 22:57:34 -05:00
|
|
|
);
|
2017-05-15 08:55:01 -05:00
|
|
|
}
|
2017-05-27 21:41:16 -05:00
|
|
|
|
|
|
|
fn issue1178() {
|
|
|
|
macro_rules! foo {
|
2018-03-22 02:09:21 -05:00
|
|
|
(#[$attr:meta] $name:ident) => {};
|
2017-05-27 21:41:16 -05:00
|
|
|
}
|
|
|
|
|
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],
|
|
|
|
..
|
2018-09-19 09:19:24 -05:00
|
|
|
])
|
|
|
|
.par_map_inplace(|el| *el = 0.);
|
2017-06-22 22:57:34 -05:00
|
|
|
}
|
|
|
|
|
2017-08-21 09:19:01 -05:00
|
|
|
fn issue_1885() {
|
|
|
|
let threads = people
|
|
|
|
.into_iter()
|
|
|
|
.map(|name| {
|
|
|
|
chan_select! {
|
|
|
|
rx.recv() => {}
|
|
|
|
}
|
2018-09-19 09:19:24 -05:00
|
|
|
})
|
|
|
|
.collect::<Vec<_>>();
|
2017-08-21 09:19:01 -05:00
|
|
|
}
|
|
|
|
|
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
|
2018-02-23 10:04:54 -06:00
|
|
|
};
|
2017-08-26 23:44:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-22 22:57:34 -05:00
|
|
|
// #1577
|
|
|
|
fn issue1577() {
|
|
|
|
let json = json!({
|
|
|
|
"foo": "bar",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-11-07 02:49:53 -06:00
|
|
|
// #3174
|
|
|
|
fn issue_3174() {
|
|
|
|
let data = if let Some(debug) = error.debug_info() {
|
|
|
|
json!({
|
|
|
|
"errorKind": format!("{:?}", error.err_kind()),
|
|
|
|
"debugMessage": debug.message,
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
json!({ "errorKind": format!("{:?}", error.err_kind()) })
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-06-22 22:57:34 -05:00
|
|
|
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 {
|
2018-03-22 02:09:21 -05:00
|
|
|
($expr:expr) => {
|
2018-01-24 13:25:57 -06:00
|
|
|
match $expr {
|
|
|
|
Some(val) => val,
|
2017-10-05 05:44:45 -05:00
|
|
|
|
2018-01-24 13:25:57 -06:00
|
|
|
None => {
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-10-05 05:44:45 -05:00
|
|
|
}
|
2017-11-30 07:12:55 -06:00
|
|
|
|
|
|
|
// #2214
|
|
|
|
// macro call whose argument is an array with trailing comma.
|
|
|
|
fn issue2214() {
|
|
|
|
make_test!(
|
|
|
|
str_searcher_ascii_haystack,
|
|
|
|
"bb",
|
|
|
|
"abbcbbd",
|
|
|
|
[
|
|
|
|
Reject(0, 1),
|
|
|
|
Match(1, 3),
|
|
|
|
Reject(3, 4),
|
|
|
|
Match(4, 6),
|
|
|
|
Reject(6, 7),
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
2017-11-30 22:28:16 -06:00
|
|
|
|
|
|
|
fn special_case_macros() {
|
2018-01-17 09:50:16 -06:00
|
|
|
let p = eprint!();
|
2017-12-05 18:45:01 -06:00
|
|
|
let q = eprint!("{}", 1);
|
|
|
|
let r = eprint!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
|
|
|
let s = eprint!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
let q = eprintln!("{}", 1);
|
|
|
|
let r = eprintln!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
|
|
|
let s = eprintln!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
let q = format!("{}", 1);
|
|
|
|
let r = format!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
2017-11-30 22:28:16 -06:00
|
|
|
let s = format!(
|
2017-12-05 18:45:01 -06:00
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
let q = format_args!("{}", 1);
|
|
|
|
let r = format_args!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
|
|
|
let s = format_args!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
2017-12-05 18:49:48 -06:00
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
let q = print!("{}", 1);
|
|
|
|
let r = print!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
|
|
|
let s = print!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
2017-12-05 18:45:01 -06:00
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
let q = println!("{}", 1);
|
|
|
|
let r = println!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
|
|
|
let s = println!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
let q = unreachable!("{}", 1);
|
|
|
|
let r = unreachable!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
|
|
|
let s = unreachable!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
debug!("{}", 1);
|
|
|
|
debug!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
|
|
|
);
|
|
|
|
debug!(
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{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}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
2017-11-30 22:28:16 -06:00
|
|
|
);
|
|
|
|
|
2018-01-17 09:50:16 -06:00
|
|
|
assert!();
|
|
|
|
assert!(result == 42);
|
2017-12-22 19:06:17 -06:00
|
|
|
assert!(result == 42, "Ahoy there, {}!", target);
|
2017-11-30 22:28:16 -06:00
|
|
|
assert!(
|
2017-12-22 19:06:17 -06:00
|
|
|
result == 42,
|
2017-12-27 15:19:42 -06:00
|
|
|
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
|
|
|
|
result,
|
|
|
|
input,
|
|
|
|
expected
|
2017-11-30 22:28:16 -06:00
|
|
|
);
|
2017-12-07 00:42:33 -06:00
|
|
|
assert!(
|
2017-12-22 19:06:17 -06:00
|
|
|
result == 42,
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
2018-01-17 09:50:16 -06:00
|
|
|
assert_eq!();
|
|
|
|
assert_eq!(left);
|
|
|
|
assert_eq!(left, right);
|
2017-12-22 19:06:17 -06:00
|
|
|
assert_eq!(left, right, "Ahoy there, {}!", target);
|
|
|
|
assert_eq!(
|
|
|
|
left, right,
|
2017-12-27 15:19:42 -06:00
|
|
|
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
|
2017-12-22 19:06:17 -06:00
|
|
|
result, input, expected
|
|
|
|
);
|
2017-12-22 19:32:55 -06:00
|
|
|
assert_eq!(
|
|
|
|
first_realllllllllllly_long_variable_that_doesnt_fit_one_one_line,
|
|
|
|
second_reallllllllllly_long_variable_that_doesnt_fit_one_one_line,
|
2017-12-27 15:19:42 -06:00
|
|
|
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
|
|
|
|
result,
|
|
|
|
input,
|
|
|
|
expected
|
2017-12-22 19:32:55 -06:00
|
|
|
);
|
2017-12-22 19:06:17 -06:00
|
|
|
assert_eq!(
|
|
|
|
left + 42,
|
|
|
|
right,
|
2017-12-27 15:19:42 -06:00
|
|
|
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
|
|
|
|
result,
|
|
|
|
input,
|
|
|
|
expected
|
2017-12-22 19:06:17 -06:00
|
|
|
);
|
|
|
|
assert_eq!(
|
2017-12-27 15:19:42 -06:00
|
|
|
left,
|
|
|
|
right,
|
2017-12-07 00:42:33 -06:00
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
write!(&mut s, "Ahoy there, {}!", target);
|
|
|
|
write!(
|
|
|
|
&mut s,
|
2017-12-27 15:19:42 -06:00
|
|
|
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
|
2017-12-07 00:42:33 -06:00
|
|
|
result, input, expected
|
|
|
|
);
|
|
|
|
write!(
|
|
|
|
&mut s,
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
|
|
|
|
|
|
|
writeln!(&mut s, "Ahoy there, {}!", target);
|
|
|
|
writeln!(
|
|
|
|
&mut s,
|
2017-12-27 15:19:42 -06:00
|
|
|
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
|
2017-12-07 00:42:33 -06:00
|
|
|
result, input, expected
|
|
|
|
);
|
|
|
|
writeln!(
|
|
|
|
&mut s,
|
|
|
|
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
13,
|
|
|
|
14,
|
|
|
|
15,
|
|
|
|
16,
|
|
|
|
17,
|
|
|
|
18,
|
|
|
|
19,
|
|
|
|
20,
|
|
|
|
21,
|
|
|
|
22,
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
25,
|
|
|
|
26
|
|
|
|
);
|
2017-11-30 22:28:16 -06:00
|
|
|
}
|
2017-12-04 17:41:10 -06:00
|
|
|
|
|
|
|
// #1209
|
|
|
|
impl Foo {
|
|
|
|
/// foo
|
|
|
|
pub fn foo(&self) -> Bar<foo!()> {}
|
|
|
|
}
|
2017-12-09 09:21:49 -06:00
|
|
|
|
|
|
|
// #819
|
|
|
|
fn macro_in_pattern_position() {
|
|
|
|
let x = match y {
|
|
|
|
foo!() => (),
|
|
|
|
bar!(a, b, c) => (),
|
|
|
|
bar!(a, b, c,) => (),
|
|
|
|
baz!(1 + 2 + 3, quux.kaas()) => (),
|
|
|
|
quux!(
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
|
|
|
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
|
|
) => (),
|
|
|
|
};
|
|
|
|
}
|
2018-01-01 00:51:30 -06:00
|
|
|
|
2018-01-25 08:12:18 -06:00
|
|
|
macro foo() {}
|
2018-01-01 00:51:30 -06:00
|
|
|
|
2018-03-22 02:09:21 -05:00
|
|
|
pub macro bar($x:ident + $y:expr;) {
|
2018-01-25 07:28:55 -06:00
|
|
|
fn foo($x: Foo) {
|
|
|
|
long_function(
|
|
|
|
a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
|
|
|
|
$x.bar($y),
|
|
|
|
);
|
2018-01-01 00:51:30 -06:00
|
|
|
}
|
|
|
|
}
|
2018-01-03 01:36:52 -06:00
|
|
|
|
2018-01-25 07:28:55 -06:00
|
|
|
macro foo() {
|
|
|
|
// a comment
|
|
|
|
fn foo() {
|
|
|
|
// another comment
|
|
|
|
bar();
|
2018-01-03 01:36:52 -06:00
|
|
|
}
|
|
|
|
}
|
2018-02-03 17:52:50 -06:00
|
|
|
|
2018-03-31 10:54:44 -05:00
|
|
|
// #2574
|
|
|
|
macro_rules! test {
|
|
|
|
() => {{}};
|
|
|
|
}
|
|
|
|
|
2018-02-03 17:52:50 -06:00
|
|
|
macro lex_err($kind: ident $(, $body: expr)*) {
|
|
|
|
Err(QlError::LexError(LexError::$kind($($body,)*)))
|
|
|
|
}
|
2018-02-23 20:48:07 -06:00
|
|
|
|
|
|
|
// Preserve trailing comma on item-level macro with `()` or `[]`.
|
|
|
|
methods![get, post, delete,];
|
|
|
|
methods!(get, post, delete,);
|
2018-04-03 21:02:01 -05:00
|
|
|
|
2018-04-02 08:52:39 -05:00
|
|
|
// #2588
|
|
|
|
macro_rules! m {
|
|
|
|
() => {
|
|
|
|
r#"
|
|
|
|
test
|
|
|
|
"#
|
|
|
|
};
|
|
|
|
}
|
|
|
|
fn foo() {
|
2018-11-17 12:53:11 -06:00
|
|
|
f! {r#"
|
2018-04-02 08:52:39 -05:00
|
|
|
test
|
|
|
|
"#};
|
|
|
|
}
|
|
|
|
|
2018-04-03 21:02:01 -05:00
|
|
|
// #2591
|
|
|
|
fn foo() {
|
|
|
|
match 0u32 {
|
|
|
|
0 => (),
|
|
|
|
_ => unreachable!(/* obviously */),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo() {
|
|
|
|
let _ = column!(/* here */);
|
|
|
|
}
|
2018-04-11 19:54:00 -05:00
|
|
|
|
|
|
|
// #2616
|
|
|
|
// Preserve trailing comma when using mixed layout for macro call.
|
|
|
|
fn foo() {
|
|
|
|
foo!(
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
|
|
|
);
|
|
|
|
foo!(
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
|
);
|
|
|
|
}
|
2018-04-28 01:09:36 -05:00
|
|
|
|
2018-07-24 17:13:51 -05:00
|
|
|
// #2830
|
|
|
|
// Preserve trailing comma-less/ness inside nested macro.
|
|
|
|
named!(
|
|
|
|
do_parse_gsv<GsvData>,
|
|
|
|
map_res!(
|
|
|
|
do_parse!(
|
|
|
|
number_of_sentences: map_res!(digit, parse_num::<u16>)
|
|
|
|
>> char!(',')
|
|
|
|
>> sentence_index: map_res!(digit, parse_num::<u16>)
|
|
|
|
>> char!(',')
|
|
|
|
>> total_number_of_sats: map_res!(digit, parse_num::<u16>)
|
|
|
|
>> char!(',')
|
|
|
|
>> sat0: opt!(complete!(parse_gsv_sat_info))
|
|
|
|
>> sat1: opt!(complete!(parse_gsv_sat_info))
|
|
|
|
>> sat2: opt!(complete!(parse_gsv_sat_info))
|
|
|
|
>> sat3: opt!(complete!(parse_gsv_sat_info))
|
|
|
|
>> (
|
|
|
|
number_of_sentences,
|
|
|
|
sentence_index,
|
|
|
|
total_number_of_sats,
|
|
|
|
sat0,
|
|
|
|
sat1,
|
|
|
|
sat2,
|
|
|
|
sat3
|
|
|
|
)
|
|
|
|
),
|
|
|
|
construct_gsv_data
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
// #2857
|
|
|
|
convert_args!(vec!(1, 2, 3));
|
2018-10-07 23:38:01 -05:00
|
|
|
|
|
|
|
// #3031
|
|
|
|
thread_local!(
|
|
|
|
/// TLV Holds a set of JSTraceables that need to be rooted
|
|
|
|
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new());
|
|
|
|
);
|
|
|
|
|
|
|
|
thread_local![
|
|
|
|
/// TLV Holds a set of JSTraceables that need to be rooted
|
|
|
|
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new());
|
|
|
|
|
|
|
|
/// TLV Holds a set of JSTraceables that need to be rooted
|
|
|
|
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
|
|
|
|
RefCell::new(RootedTraceableSet::new(0));
|
|
|
|
|
|
|
|
/// TLV Holds a set of JSTraceables that need to be rooted
|
|
|
|
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
|
|
|
|
RefCell::new(RootedTraceableSet::new(), xxx, yyy);
|
|
|
|
|
|
|
|
/// TLV Holds a set of JSTraceables that need to be rooted
|
|
|
|
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
|
|
|
|
RefCell::new(RootedTraceableSet::new(1234));
|
|
|
|
];
|
2018-12-19 10:13:18 -06:00
|
|
|
|
|
|
|
fn issue3004() {
|
|
|
|
foo!(|_| { () });
|
|
|
|
stringify!((foo+));
|
|
|
|
}
|
2019-02-07 21:28:35 -06:00
|
|
|
|
|
|
|
// #3331
|
|
|
|
pub fn fold_abi<V: Fold + ?Sized>(_visitor: &mut V, _i: Abi) -> Abi {
|
|
|
|
Abi {
|
|
|
|
extern_token: Token![extern](tokens_helper(_visitor, &_i.extern_token.span)),
|
|
|
|
name: (_i.name).map(|it| _visitor.fold_lit_str(it)),
|
|
|
|
}
|
|
|
|
}
|
2019-03-21 01:58:39 -05:00
|
|
|
|
|
|
|
// #3463
|
|
|
|
x! {()}
|
2019-05-27 10:03:42 -05:00
|
|
|
|
2019-08-28 06:50:41 -05:00
|
|
|
// #3746
|
|
|
|
f!(match a {
|
|
|
|
4 => &[
|
|
|
|
(3, false), // Missing
|
|
|
|
(4, true) // I-frame
|
|
|
|
][..],
|
|
|
|
});
|
|
|
|
|
2019-05-27 10:03:42 -05:00
|
|
|
// #3583
|
|
|
|
foo!(|x = y|);
|