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 = {
188 vbuf: gfx::VertexBuffer<Vertex> = (),
189 out: gfx::RenderTarget<ColorFormat> = "Target0",
194 fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
196 ::std::mem::size_of::<HandleWithDtor<::std::os::raw::c_int>>(),
199 "Size of template specialization: ",
200 stringify ! ( HandleWithDtor < :: std :: os :: raw :: c_int > )
203 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 > ) ) );
207 macro_rules! try_opt {
208 ($expr:expr) => (match $expr {
211 None => { return None; }
216 // macro call whose argument is an array with trailing comma.
218 make_test!(str_searcher_ascii_haystack, "bb", "abbcbbd", [
227 fn special_case_macros() {
229 let q = eprint!("{}", 1);
230 let r = eprint!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
231 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);
233 let q = eprintln!("{}", 1);
234 let r = eprintln!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
235 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);
237 let q = format!("{}", 1);
238 let r = format!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
239 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);
241 let q = format_args!("{}", 1);
242 let r = format_args!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
243 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);
245 let q = print!("{}", 1);
246 let r = print!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
247 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);
249 let q = println!("{}", 1);
250 let r = println!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
251 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);
253 let q = unreachable!("{}", 1);
254 let r = unreachable!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
255 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);
258 debug!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
259 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);
262 error!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
263 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);
266 info!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
267 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);
270 panic!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
271 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);
274 warn!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
275 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);
278 assert!(result == 42);
279 assert!(result == 42, "Ahoy there, {}!", target);
280 assert!(result == 42, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
281 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);
285 assert_eq!(left, right);
286 assert_eq!(left, right, "Ahoy there, {}!", target);
287 assert_eq!(left, right, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
288 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);
289 assert_eq!(left + 42, right, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
290 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);
292 write!(&mut s, "Ahoy there, {}!", target);
293 write!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
294 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);
296 writeln!(&mut s, "Ahoy there, {}!", target);
297 writeln!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
298 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);
304 pub fn foo(&self) -> Bar<foo!( )> {}
308 fn macro_in_pattern_position () {
317 baz!( 1 + 2 + 3, quux.kaas( )
319 quux!(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB) => (),
328 pub macro bar($x:ident+$y:expr; ) {
330 long_function(a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
348 macro lex_err($kind: ident $(, $body: expr)*) {
349 Err(QlError::LexError(LexError::$kind($($body,)*)))
352 // Preserve trailing comma on item-level macro with `()` or `[]`.
353 methods![ get, post, delete, ];
354 methods!( get, post, delete, );
374 _ => unreachable!(/* obviously */),
379 let _ = column!(/* here */);
383 // Preserve trailing comma when using mixed layout for macro call.
385 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);
386 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,);
390 // Preserve trailing comma inside macro, even if it looks an array.
393 $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]);
398 // Preserve trailing comma-less/ness inside nested macro.
400 do_parse_gsv<GsvData>,
403 number_of_sentences: map_res!(digit, parse_num::<u16>)
405 >> sentence_index: map_res!(digit, parse_num::<u16>)
407 >> total_number_of_sats: map_res!(digit, parse_num::<u16>)
409 >> sat0: opt!(complete!(parse_gsv_sat_info))
410 >> sat1: opt!(complete!(parse_gsv_sat_info))
411 >> sat2: opt!(complete!(parse_gsv_sat_info))
412 >> sat3: opt!(complete!(parse_gsv_sat_info))
416 total_number_of_sats,
428 convert_args!(vec!(1, 2, 3));
432 /// TLV Holds a set of JSTraceables that need to be rooted
433 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
434 RefCell::new(RootedTraceableSet::new()) ;
438 /// TLV Holds a set of JSTraceables that need to be rooted
439 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
440 RefCell::new(RootedTraceableSet::new()) ;
442 /// TLV Holds a set of JSTraceables that need to be rooted
443 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
444 RefCell::new(RootedTraceableSet::new(0)) ;
446 /// TLV Holds a set of JSTraceables that need to be rooted
447 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
448 RefCell::new(RootedTraceableSet::new(), xxx, yyy) ;
450 /// TLV Holds a set of JSTraceables that need to be rooted
451 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
452 RefCell::new(RootedTraceableSet::new(1234)) ;