1 // rustfmt-normalize_comments: true
2 // rustfmt-format_macro_matchers: true
3 itemmacro!(this, is.now() .formatted(yay));
5 itemmacro!(really, long.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb() .is.formatted());
7 itemmacro!{this, is.bracket().formatted()}
9 peg_file! modname ("mygrammarfile.rustpeg");
20 baz!(1+2+3, quux. kaas());
22 quux!(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB);
24 kaas!(/* comments */ a /* post macro */, b /* another */);
26 trailingcomma!( a , b , c , );
27 // Preserve trailing comma only when necessary.
30 table.map(|table| fixture.offset(table)).unwrap_or(0),
34 noexpr!( i am not an expression, OK? );
38 vec! [AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA,
39 BBBBB, 5, 100-30, 1.33, b, b, b];
41 vec! [a /* comment */];
43 // Trailing spaces after a comma
55 vec![a; (|x| { let y = x + 1; let z = y + 1; z })(2)];
56 vec![a; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx];
61 unknown_bracket_macro__comma_should_not_be_stripped![
69 macrowithbraces! {dont, format, me}
94 let image = gray_image!(
100 chain!(input, a:take!(max_size), || []);
112 println!("dsfs"); // a comment
116 let hello = &format!("HTTP/1.1 200 OK\r\nServer: {}\r\n\r\n{}",
117 "65454654654654654654654655464",
123 (#[$attr:meta] $name:ident) => {}
126 foo!(#[doc = "bar"] baz);
130 sql_function!(add_rss_item,
133 b: types::Timestamptz,
138 w.slice_mut(s![.., init_size[1] - extreeeeeeeeeeeeeeeeeeeeeeeem..init_size[1], ..])
139 .par_map_inplace(|el| *el = 0.);
143 let threads = people.into_iter().map(|name| {
147 }).collect::<Vec<_>>();
153 fn test(a: String, s: String, b: String) -> TestResult {
154 if a.find(&s).is_none() {
156 TestResult::from_bool(true)
158 TestResult::discard()
168 static ref ONE: u32 = 1;
169 static ref TWO: u32 = 2;
170 static ref THREE: u32 = 3;
171 static ref FOUR: u32 = {
190 if let Some(debug) = error.debug_info() {
192 "errorKind": format!("{:?}", error.err_kind()),
193 "debugMessage": debug.message,
196 json!({"errorKind": format!("{:?}", error.err_kind())})
201 vbuf: gfx::VertexBuffer<Vertex> = (),
202 out: gfx::RenderTarget<ColorFormat> = "Target0",
207 fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
209 ::std::mem::size_of::<HandleWithDtor<::std::os::raw::c_int>>(),
212 "Size of template specialization: ",
213 stringify ! ( HandleWithDtor < :: std :: os :: raw :: c_int > )
216 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 > ) ) );
220 macro_rules! try_opt {
221 ($expr:expr) => (match $expr {
224 None => { return None; }
229 // macro call whose argument is an array with trailing comma.
231 make_test!(str_searcher_ascii_haystack, "bb", "abbcbbd", [
240 fn special_case_macros() {
242 let q = eprint!("{}", 1);
243 let r = eprint!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
244 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);
246 let q = eprintln!("{}", 1);
247 let r = eprintln!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
248 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);
250 let q = format!("{}", 1);
251 let r = format!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
252 let s = format!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
254 let q = format_args!("{}", 1);
255 let r = format_args!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
256 let s = format_args!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
258 let q = print!("{}", 1);
259 let r = print!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
260 let s = print!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
262 let q = println!("{}", 1);
263 let r = println!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
264 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);
266 let q = unreachable!("{}", 1);
267 let r = unreachable!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
268 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);
271 debug!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
272 debug!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
275 error!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
276 error!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
279 info!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
280 info!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
283 panic!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
284 panic!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
287 warn!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
288 warn!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
291 assert!(result == 42);
292 assert!(result == 42, "Ahoy there, {}!", target);
293 assert!(result == 42, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
294 assert!(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);
298 assert_eq!(left, right);
299 assert_eq!(left, right, "Ahoy there, {}!", target);
300 assert_eq!(left, right, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
301 assert_eq!(first_realllllllllllly_long_variable_that_doesnt_fit_one_one_line, second_reallllllllllly_long_variable_that_doesnt_fit_one_one_line, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
302 assert_eq!(left + 42, right, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
303 assert_eq!(left, right, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 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);
305 write!(&mut s, "Ahoy there, {}!", target);
306 write!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
307 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);
309 writeln!(&mut s, "Ahoy there, {}!", target);
310 writeln!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
311 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);
317 pub fn foo(&self) -> Bar<foo!( )> {}
321 fn macro_in_pattern_position () {
330 baz!( 1 + 2 + 3, quux.kaas( )
332 quux!(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB) => (),
341 pub macro bar($x:ident+$y:expr; ) {
343 long_function(a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
361 macro lex_err($kind: ident $(, $body: expr)*) {
362 Err(QlError::LexError(LexError::$kind($($body,)*)))
365 // Preserve trailing comma on item-level macro with `()` or `[]`.
366 methods![ get, post, delete, ];
367 methods!( get, post, delete, );
387 _ => unreachable!(/* obviously */),
392 let _ = column!(/* here */);
396 // Preserve trailing comma when using mixed layout for macro call.
398 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);
399 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,);
403 // Preserve trailing comma inside macro, even if it looks an array.
406 $m!([a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]);
411 // Preserve trailing comma-less/ness inside nested macro.
413 do_parse_gsv<GsvData>,
416 number_of_sentences: map_res!(digit, parse_num::<u16>)
418 >> sentence_index: map_res!(digit, parse_num::<u16>)
420 >> total_number_of_sats: map_res!(digit, parse_num::<u16>)
422 >> sat0: opt!(complete!(parse_gsv_sat_info))
423 >> sat1: opt!(complete!(parse_gsv_sat_info))
424 >> sat2: opt!(complete!(parse_gsv_sat_info))
425 >> sat3: opt!(complete!(parse_gsv_sat_info))
429 total_number_of_sats,
441 convert_args!(vec!(1, 2, 3));
445 /// TLV Holds a set of JSTraceables that need to be rooted
446 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
447 RefCell::new(RootedTraceableSet::new()) ;
451 /// TLV Holds a set of JSTraceables that need to be rooted
452 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
453 RefCell::new(RootedTraceableSet::new()) ;
455 /// TLV Holds a set of JSTraceables that need to be rooted
456 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
457 RefCell::new(RootedTraceableSet::new(0)) ;
459 /// TLV Holds a set of JSTraceables that need to be rooted
460 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
461 RefCell::new(RootedTraceableSet::new(), xxx, yyy) ;
463 /// TLV Holds a set of JSTraceables that need to be rooted
464 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
465 RefCell::new(RootedTraceableSet::new(1234)) ;