]> git.lizzy.rs Git - rust.git/blob - src/libcore/macros.rs
Rollup merge of #40703 - GuillaumeGomez:pointer-docs, r=steveklabnik
[rust.git] / src / libcore / macros.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 /// Entry point of thread panic, for details, see std::macros
12 #[macro_export]
13 #[allow_internal_unstable]
14 #[stable(feature = "core", since = "1.6.0")]
15 macro_rules! panic {
16     () => (
17         panic!("explicit panic")
18     );
19     ($msg:expr) => ({
20         static _MSG_FILE_LINE: (&'static str, &'static str, u32) = ($msg, file!(), line!());
21         $crate::panicking::panic(&_MSG_FILE_LINE)
22     });
23     ($fmt:expr, $($arg:tt)*) => ({
24         // The leading _'s are to avoid dead code warnings if this is
25         // used inside a dead function. Just `#[allow(dead_code)]` is
26         // insufficient, since the user may have
27         // `#[forbid(dead_code)]` and which cannot be overridden.
28         static _FILE_LINE: (&'static str, u32) = (file!(), line!());
29         $crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_FILE_LINE)
30     });
31 }
32
33 /// Ensure that a boolean expression is `true` at runtime.
34 ///
35 /// This will invoke the [`panic!`] macro if the provided expression cannot be
36 /// evaluated to `true` at runtime.
37 ///
38 /// Assertions are always checked in both debug and release builds, and cannot
39 /// be disabled. See [`debug_assert!`] for assertions that are not enabled in
40 /// release builds by default.
41 ///
42 /// Unsafe code relies on `assert!` to enforce run-time invariants that, if
43 /// violated could lead to unsafety.
44 ///
45 /// Other use-cases of `assert!` include [testing] and enforcing run-time
46 /// invariants in safe code (whose violation cannot result in unsafety).
47 ///
48 /// This macro has a second version, where a custom panic message can
49 /// be provided with or without arguments for formatting.
50 ///
51 /// [`panic!`]: macro.panic.html
52 /// [`debug_assert!`]: macro.debug_assert.html
53 /// [testing]: ../book/testing.html
54 ///
55 /// # Examples
56 ///
57 /// ```
58 /// // the panic message for these assertions is the stringified value of the
59 /// // expression given.
60 /// assert!(true);
61 ///
62 /// fn some_computation() -> bool { true } // a very simple function
63 ///
64 /// assert!(some_computation());
65 ///
66 /// // assert with a custom message
67 /// let x = true;
68 /// assert!(x, "x wasn't true!");
69 ///
70 /// let a = 3; let b = 27;
71 /// assert!(a + b == 30, "a = {}, b = {}", a, b);
72 /// ```
73 #[macro_export]
74 #[stable(feature = "rust1", since = "1.0.0")]
75 macro_rules! assert {
76     ($cond:expr) => (
77         if !$cond {
78             panic!(concat!("assertion failed: ", stringify!($cond)))
79         }
80     );
81     ($cond:expr, $($arg:tt)+) => (
82         if !$cond {
83             panic!($($arg)+)
84         }
85     );
86 }
87
88 /// Asserts that two expressions are equal to each other.
89 ///
90 /// On panic, this macro will print the values of the expressions with their
91 /// debug representations.
92 ///
93 /// Like [`assert!`], this macro has a second version, where a custom
94 /// panic message can be provided.
95 ///
96 /// [`assert!`]: macro.assert.html
97 ///
98 /// # Examples
99 ///
100 /// ```
101 /// let a = 3;
102 /// let b = 1 + 2;
103 /// assert_eq!(a, b);
104 ///
105 /// assert_eq!(a, b, "we are testing addition with {} and {}", a, b);
106 /// ```
107 #[macro_export]
108 #[stable(feature = "rust1", since = "1.0.0")]
109 macro_rules! assert_eq {
110     ($left:expr, $right:expr) => ({
111         match (&$left, &$right) {
112             (left_val, right_val) => {
113                 if !(*left_val == *right_val) {
114                     panic!("assertion failed: `(left == right)` \
115                            (left: `{:?}`, right: `{:?}`)", left_val, right_val)
116                 }
117             }
118         }
119     });
120     ($left:expr, $right:expr, $($arg:tt)+) => ({
121         match (&($left), &($right)) {
122             (left_val, right_val) => {
123                 if !(*left_val == *right_val) {
124                     panic!("assertion failed: `(left == right)` \
125                            (left: `{:?}`, right: `{:?}`): {}", left_val, right_val,
126                            format_args!($($arg)+))
127                 }
128             }
129         }
130     });
131 }
132
133 /// Asserts that two expressions are not equal to each other.
134 ///
135 /// On panic, this macro will print the values of the expressions with their
136 /// debug representations.
137 ///
138 /// Like `assert!()`, this macro has a second version, where a custom
139 /// panic message can be provided.
140 ///
141 /// [`assert!`]: macro.assert.html
142 ///
143 /// # Examples
144 ///
145 /// ```
146 /// let a = 3;
147 /// let b = 2;
148 /// assert_ne!(a, b);
149 ///
150 /// assert_ne!(a, b, "we are testing that the values are not equal");
151 /// ```
152 #[macro_export]
153 #[stable(feature = "assert_ne", since = "1.12.0")]
154 macro_rules! assert_ne {
155     ($left:expr, $right:expr) => ({
156         match (&$left, &$right) {
157             (left_val, right_val) => {
158                 if *left_val == *right_val {
159                     panic!("assertion failed: `(left != right)` \
160                            (left: `{:?}`, right: `{:?}`)", left_val, right_val)
161                 }
162             }
163         }
164     });
165     ($left:expr, $right:expr, $($arg:tt)+) => ({
166         match (&($left), &($right)) {
167             (left_val, right_val) => {
168                 if *left_val == *right_val {
169                     panic!("assertion failed: `(left != right)` \
170                            (left: `{:?}`, right: `{:?}`): {}", left_val, right_val,
171                            format_args!($($arg)+))
172                 }
173             }
174         }
175     });
176 }
177
178 /// Ensure that a boolean expression is `true` at runtime.
179 ///
180 /// This will invoke the [`panic!`] macro if the provided expression cannot be
181 /// evaluated to `true` at runtime.
182 ///
183 /// Like [`assert!`], this macro also has a second version, where a custom panic
184 /// message can be provided.
185 ///
186 /// Unlike [`assert!`], `debug_assert!` statements are only enabled in non
187 /// optimized builds by default. An optimized build will omit all
188 /// `debug_assert!` statements unless `-C debug-assertions` is passed to the
189 /// compiler. This makes `debug_assert!` useful for checks that are too
190 /// expensive to be present in a release build but may be helpful during
191 /// development.
192 ///
193 /// An unchecked assertion allows a program in an inconsistent state to keep
194 /// running, which might have unexpected consequences but does not introduce
195 /// unsafety as long as this only happens in safe code. The performance cost
196 /// of assertions, is however, not measurable in general. Replacing [`assert!`]
197 /// with `debug_assert!` is thus only encouraged after thorough profiling, and
198 /// more importantly, only in safe code!
199 ///
200 /// [`panic!`]: macro.panic.html
201 /// [`assert!`]: macro.assert.html
202 ///
203 /// # Examples
204 ///
205 /// ```
206 /// // the panic message for these assertions is the stringified value of the
207 /// // expression given.
208 /// debug_assert!(true);
209 ///
210 /// fn some_expensive_computation() -> bool { true } // a very simple function
211 /// debug_assert!(some_expensive_computation());
212 ///
213 /// // assert with a custom message
214 /// let x = true;
215 /// debug_assert!(x, "x wasn't true!");
216 ///
217 /// let a = 3; let b = 27;
218 /// debug_assert!(a + b == 30, "a = {}, b = {}", a, b);
219 /// ```
220 #[macro_export]
221 #[stable(feature = "rust1", since = "1.0.0")]
222 macro_rules! debug_assert {
223     ($($arg:tt)*) => (if cfg!(debug_assertions) { assert!($($arg)*); })
224 }
225
226 /// Asserts that two expressions are equal to each other.
227 ///
228 /// On panic, this macro will print the values of the expressions with their
229 /// debug representations.
230 ///
231 /// Unlike `assert_eq!`, `debug_assert_eq!` statements are only enabled in non
232 /// optimized builds by default. An optimized build will omit all
233 /// `debug_assert_eq!` statements unless `-C debug-assertions` is passed to the
234 /// compiler. This makes `debug_assert_eq!` useful for checks that are too
235 /// expensive to be present in a release build but may be helpful during
236 /// development.
237 ///
238 /// # Examples
239 ///
240 /// ```
241 /// let a = 3;
242 /// let b = 1 + 2;
243 /// debug_assert_eq!(a, b);
244 /// ```
245 #[macro_export]
246 #[stable(feature = "rust1", since = "1.0.0")]
247 macro_rules! debug_assert_eq {
248     ($($arg:tt)*) => (if cfg!(debug_assertions) { assert_eq!($($arg)*); })
249 }
250
251 /// Asserts that two expressions are not equal to each other.
252 ///
253 /// On panic, this macro will print the values of the expressions with their
254 /// debug representations.
255 ///
256 /// Unlike `assert_ne!`, `debug_assert_ne!` statements are only enabled in non
257 /// optimized builds by default. An optimized build will omit all
258 /// `debug_assert_ne!` statements unless `-C debug-assertions` is passed to the
259 /// compiler. This makes `debug_assert_ne!` useful for checks that are too
260 /// expensive to be present in a release build but may be helpful during
261 /// development.
262 ///
263 /// # Examples
264 ///
265 /// ```
266 /// let a = 3;
267 /// let b = 2;
268 /// debug_assert_ne!(a, b);
269 /// ```
270 #[macro_export]
271 #[stable(feature = "assert_ne", since = "1.12.0")]
272 macro_rules! debug_assert_ne {
273     ($($arg:tt)*) => (if cfg!(debug_assertions) { assert_ne!($($arg)*); })
274 }
275
276 /// Helper macro for reducing boilerplate code for matching `Result` together
277 /// with converting downstream errors.
278 ///
279 /// Prefer using `?` syntax to `try!`. `?` is built in to the language and is
280 /// more succinct than `try!`. It is the standard method for error propagation.
281 ///
282 /// `try!` matches the given `Result`. In case of the `Ok` variant, the
283 /// expression has the value of the wrapped value.
284 ///
285 /// In case of the `Err` variant, it retrieves the inner error. `try!` then
286 /// performs conversion using `From`. This provides automatic conversion
287 /// between specialized errors and more general ones. The resulting
288 /// error is then immediately returned.
289 ///
290 /// Because of the early return, `try!` can only be used in functions that
291 /// return `Result`.
292 ///
293 /// # Examples
294 ///
295 /// ```
296 /// use std::io;
297 /// use std::fs::File;
298 /// use std::io::prelude::*;
299 ///
300 /// enum MyError {
301 ///     FileWriteError
302 /// }
303 ///
304 /// impl From<io::Error> for MyError {
305 ///     fn from(e: io::Error) -> MyError {
306 ///         MyError::FileWriteError
307 ///     }
308 /// }
309 ///
310 /// fn write_to_file_using_try() -> Result<(), MyError> {
311 ///     let mut file = try!(File::create("my_best_friends.txt"));
312 ///     try!(file.write_all(b"This is a list of my best friends."));
313 ///     println!("I wrote to the file");
314 ///     Ok(())
315 /// }
316 /// // This is equivalent to:
317 /// fn write_to_file_using_match() -> Result<(), MyError> {
318 ///     let mut file = try!(File::create("my_best_friends.txt"));
319 ///     match file.write_all(b"This is a list of my best friends.") {
320 ///         Ok(v) => v,
321 ///         Err(e) => return Err(From::from(e)),
322 ///     }
323 ///     println!("I wrote to the file");
324 ///     Ok(())
325 /// }
326 /// ```
327 #[macro_export]
328 #[stable(feature = "rust1", since = "1.0.0")]
329 macro_rules! try {
330     ($expr:expr) => (match $expr {
331         $crate::result::Result::Ok(val) => val,
332         $crate::result::Result::Err(err) => {
333             return $crate::result::Result::Err($crate::convert::From::from(err))
334         }
335     })
336 }
337
338 /// Write formatted data into a buffer
339 ///
340 /// This macro accepts a format string, a list of arguments, and a 'writer'. Arguments will be
341 /// formatted according to the specified format string and the result will be passed to the writer.
342 /// The writer may be any value with a `write_fmt` method; generally this comes from an
343 /// implementation of either the [`std::fmt::Write`] or the [`std::io::Write`] trait. The macro
344 /// returns whatever the 'write_fmt' method returns; commonly a [`std::fmt::Result`], or an
345 /// [`io::Result`].
346 ///
347 /// See [`std::fmt`] for more information on the format string syntax.
348 ///
349 /// [`std::fmt`]: ../std/fmt/index.html
350 /// [`std::fmt::Write`]: ../std/fmt/trait.Write.html
351 /// [`std::io::Write`]: ../std/io/trait.Write.html
352 /// [`std::fmt::Result`]: ../std/fmt/type.Result.html
353 /// [`io::Result`]: ../std/io/type.Result.html
354 ///
355 /// # Examples
356 ///
357 /// ```
358 /// use std::io::Write;
359 ///
360 /// let mut w = Vec::new();
361 /// write!(&mut w, "test").unwrap();
362 /// write!(&mut w, "formatted {}", "arguments").unwrap();
363 ///
364 /// assert_eq!(w, b"testformatted arguments");
365 /// ```
366 ///
367 /// A module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects
368 /// implementing either, as objects do not typically implement both. However, the module must
369 /// import the traits qualified so their names do not conflict:
370 ///
371 /// ```
372 /// use std::fmt::Write as FmtWrite;
373 /// use std::io::Write as IoWrite;
374 ///
375 /// let mut s = String::new();
376 /// let mut v = Vec::new();
377 /// write!(&mut s, "{} {}", "abc", 123).unwrap(); // uses fmt::Write::write_fmt
378 /// write!(&mut v, "s = {:?}", s).unwrap(); // uses io::Write::write_fmt
379 /// assert_eq!(v, b"s = \"abc 123\"");
380 /// ```
381 #[macro_export]
382 #[stable(feature = "core", since = "1.6.0")]
383 macro_rules! write {
384     ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)))
385 }
386
387 /// Write formatted data into a buffer, with a newline appended.
388 ///
389 /// On all platforms, the newline is the LINE FEED character (`\n`/`U+000A`) alone
390 /// (no additional CARRIAGE RETURN (`\r`/`U+000D`).
391 ///
392 /// For more information, see [`write!`]. For information on the format string syntax, see
393 /// [`std::fmt`].
394 ///
395 /// [`write!`]: macro.write.html
396 /// [`std::fmt`]: ../std/fmt/index.html
397 ///
398 ///
399 /// # Examples
400 ///
401 /// ```
402 /// use std::io::Write;
403 ///
404 /// let mut w = Vec::new();
405 /// writeln!(&mut w).unwrap();
406 /// writeln!(&mut w, "test").unwrap();
407 /// writeln!(&mut w, "formatted {}", "arguments").unwrap();
408 ///
409 /// assert_eq!(&w[..], "\ntest\nformatted arguments\n".as_bytes());
410 /// ```
411 ///
412 /// A module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects
413 /// implementing either, as objects do not typically implement both. However, the module must
414 /// import the traits qualified so their names do not conflict:
415 ///
416 /// ```
417 /// use std::fmt::Write as FmtWrite;
418 /// use std::io::Write as IoWrite;
419 ///
420 /// let mut s = String::new();
421 /// let mut v = Vec::new();
422 /// writeln!(&mut s, "{} {}", "abc", 123).unwrap(); // uses fmt::Write::write_fmt
423 /// writeln!(&mut v, "s = {:?}", s).unwrap(); // uses io::Write::write_fmt
424 /// assert_eq!(v, b"s = \"abc 123\\n\"\n");
425 /// ```
426 #[macro_export]
427 #[stable(feature = "rust1", since = "1.0.0")]
428 macro_rules! writeln {
429     ($dst:expr) => (
430         write!($dst, "\n")
431     );
432     ($dst:expr, $fmt:expr) => (
433         write!($dst, concat!($fmt, "\n"))
434     );
435     ($dst:expr, $fmt:expr, $($arg:tt)*) => (
436         write!($dst, concat!($fmt, "\n"), $($arg)*)
437     );
438 }
439
440 /// A utility macro for indicating unreachable code.
441 ///
442 /// This is useful any time that the compiler can't determine that some code is unreachable. For
443 /// example:
444 ///
445 /// * Match arms with guard conditions.
446 /// * Loops that dynamically terminate.
447 /// * Iterators that dynamically terminate.
448 ///
449 /// # Panics
450 ///
451 /// This will always panic.
452 ///
453 /// # Examples
454 ///
455 /// Match arms:
456 ///
457 /// ```
458 /// # #[allow(dead_code)]
459 /// fn foo(x: Option<i32>) {
460 ///     match x {
461 ///         Some(n) if n >= 0 => println!("Some(Non-negative)"),
462 ///         Some(n) if n <  0 => println!("Some(Negative)"),
463 ///         Some(_)           => unreachable!(), // compile error if commented out
464 ///         None              => println!("None")
465 ///     }
466 /// }
467 /// ```
468 ///
469 /// Iterators:
470 ///
471 /// ```
472 /// # #[allow(dead_code)]
473 /// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3
474 ///     for i in 0.. {
475 ///         if 3*i < i { panic!("u32 overflow"); }
476 ///         if x < 3*i { return i-1; }
477 ///     }
478 ///     unreachable!();
479 /// }
480 /// ```
481 #[macro_export]
482 #[stable(feature = "core", since = "1.6.0")]
483 macro_rules! unreachable {
484     () => ({
485         panic!("internal error: entered unreachable code")
486     });
487     ($msg:expr) => ({
488         unreachable!("{}", $msg)
489     });
490     ($fmt:expr, $($arg:tt)*) => ({
491         panic!(concat!("internal error: entered unreachable code: ", $fmt), $($arg)*)
492     });
493 }
494
495 /// A standardized placeholder for marking unfinished code. It panics with the
496 /// message `"not yet implemented"` when executed.
497 ///
498 /// This can be useful if you are prototyping and are just looking to have your
499 /// code typecheck, or if you're implementing a trait that requires multiple
500 /// methods, and you're only planning on using one of them.
501 ///
502 /// # Examples
503 ///
504 /// Here's an example of some in-progress code. We have a trait `Foo`:
505 ///
506 /// ```
507 /// trait Foo {
508 ///     fn bar(&self);
509 ///     fn baz(&self);
510 /// }
511 /// ```
512 ///
513 /// We want to implement `Foo` on one of our types, but we also want to work on
514 /// just `bar()` first. In order for our code to compile, we need to implement
515 /// `baz()`, so we can use `unimplemented!`:
516 ///
517 /// ```
518 /// # trait Foo {
519 /// #     fn bar(&self);
520 /// #     fn baz(&self);
521 /// # }
522 /// struct MyStruct;
523 ///
524 /// impl Foo for MyStruct {
525 ///     fn bar(&self) {
526 ///         // implementation goes here
527 ///     }
528 ///
529 ///     fn baz(&self) {
530 ///         // let's not worry about implementing baz() for now
531 ///         unimplemented!();
532 ///     }
533 /// }
534 ///
535 /// fn main() {
536 ///     let s = MyStruct;
537 ///     s.bar();
538 ///
539 ///     // we aren't even using baz() yet, so this is fine.
540 /// }
541 /// ```
542 #[macro_export]
543 #[stable(feature = "core", since = "1.6.0")]
544 macro_rules! unimplemented {
545     () => (panic!("not yet implemented"))
546 }
547
548 /// Built-in macros to the compiler itself.
549 ///
550 /// These macros do not have any corresponding definition with a `macro_rules!`
551 /// macro, but are documented here. Their implementations can be found hardcoded
552 /// into libsyntax itself.
553 ///
554 /// For more information, see documentation for `std`'s macros.
555 mod builtin {
556     /// The core macro for formatted string creation & output.
557     ///
558     /// For more information, see the documentation for [`std::format_args!`].
559     ///
560     /// [`std::format_args!`]: ../std/macro.format_args.html
561     #[stable(feature = "rust1", since = "1.0.0")]
562     #[macro_export]
563     #[cfg(dox)]
564     macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({
565         /* compiler built-in */
566     }) }
567
568     /// Inspect an environment variable at compile time.
569     ///
570     /// For more information, see the documentation for [`std::env!`].
571     ///
572     /// [`std::env!`]: ../std/macro.env.html
573     #[stable(feature = "rust1", since = "1.0.0")]
574     #[macro_export]
575     #[cfg(dox)]
576     macro_rules! env { ($name:expr) => ({ /* compiler built-in */ }) }
577
578     /// Optionally inspect an environment variable at compile time.
579     ///
580     /// For more information, see the documentation for [`std::option_env!`].
581     ///
582     /// [`std::option_env!`]: ../std/macro.option_env.html
583     #[stable(feature = "rust1", since = "1.0.0")]
584     #[macro_export]
585     #[cfg(dox)]
586     macro_rules! option_env { ($name:expr) => ({ /* compiler built-in */ }) }
587
588     /// Concatenate identifiers into one identifier.
589     ///
590     /// For more information, see the documentation for [`std::concat_idents!`].
591     ///
592     /// [`std::concat_idents!`]: ../std/macro.concat_idents.html
593     #[unstable(feature = "concat_idents_macro", issue = "29599")]
594     #[macro_export]
595     #[cfg(dox)]
596     macro_rules! concat_idents {
597         ($($e:ident),*) => ({ /* compiler built-in */ })
598     }
599
600     /// Concatenates literals into a static string slice.
601     ///
602     /// For more information, see the documentation for [`std::concat!`].
603     ///
604     /// [`std::concat!`]: ../std/macro.concat.html
605     #[stable(feature = "rust1", since = "1.0.0")]
606     #[macro_export]
607     #[cfg(dox)]
608     macro_rules! concat { ($($e:expr),*) => ({ /* compiler built-in */ }) }
609
610     /// A macro which expands to the line number on which it was invoked.
611     ///
612     /// For more information, see the documentation for [`std::line!`].
613     ///
614     /// [`std::line!`]: ../std/macro.line.html
615     #[stable(feature = "rust1", since = "1.0.0")]
616     #[macro_export]
617     #[cfg(dox)]
618     macro_rules! line { () => ({ /* compiler built-in */ }) }
619
620     /// A macro which expands to the column number on which it was invoked.
621     ///
622     /// For more information, see the documentation for [`std::column!`].
623     ///
624     /// [`std::column!`]: ../std/macro.column.html
625     #[stable(feature = "rust1", since = "1.0.0")]
626     #[macro_export]
627     #[cfg(dox)]
628     macro_rules! column { () => ({ /* compiler built-in */ }) }
629
630     /// A macro which expands to the file name from which it was invoked.
631     ///
632     /// For more information, see the documentation for [`std::file!`].
633     ///
634     /// [`std::file!`]: ../std/macro.file.html
635     #[stable(feature = "rust1", since = "1.0.0")]
636     #[macro_export]
637     #[cfg(dox)]
638     macro_rules! file { () => ({ /* compiler built-in */ }) }
639
640     /// A macro which stringifies its argument.
641     ///
642     /// For more information, see the documentation for [`std::stringify!`].
643     ///
644     /// [`std::stringify!`]: ../std/macro.stringify.html
645     #[stable(feature = "rust1", since = "1.0.0")]
646     #[macro_export]
647     #[cfg(dox)]
648     macro_rules! stringify { ($t:tt) => ({ /* compiler built-in */ }) }
649
650     /// Includes a utf8-encoded file as a string.
651     ///
652     /// For more information, see the documentation for [`std::include_str!`].
653     ///
654     /// [`std::include_str!`]: ../std/macro.include_str.html
655     #[stable(feature = "rust1", since = "1.0.0")]
656     #[macro_export]
657     #[cfg(dox)]
658     macro_rules! include_str { ($file:expr) => ({ /* compiler built-in */ }) }
659
660     /// Includes a file as a reference to a byte array.
661     ///
662     /// For more information, see the documentation for [`std::include_bytes!`].
663     ///
664     /// [`std::include_bytes!`]: ../std/macro.include_bytes.html
665     #[stable(feature = "rust1", since = "1.0.0")]
666     #[macro_export]
667     #[cfg(dox)]
668     macro_rules! include_bytes { ($file:expr) => ({ /* compiler built-in */ }) }
669
670     /// Expands to a string that represents the current module path.
671     ///
672     /// For more information, see the documentation for [`std::module_path!`].
673     ///
674     /// [`std::module_path!`]: ../std/macro.module_path.html
675     #[stable(feature = "rust1", since = "1.0.0")]
676     #[macro_export]
677     #[cfg(dox)]
678     macro_rules! module_path { () => ({ /* compiler built-in */ }) }
679
680     /// Boolean evaluation of configuration flags.
681     ///
682     /// For more information, see the documentation for [`std::cfg!`].
683     ///
684     /// [`std::cfg!`]: ../std/macro.cfg.html
685     #[stable(feature = "rust1", since = "1.0.0")]
686     #[macro_export]
687     #[cfg(dox)]
688     macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
689
690     /// Parse a file as an expression or an item according to the context.
691     ///
692     /// For more information, see the documentation for [`std::include!`].
693     ///
694     /// [`std::include!`]: ../std/macro.include.html
695     #[stable(feature = "rust1", since = "1.0.0")]
696     #[macro_export]
697     #[cfg(dox)]
698     macro_rules! include { ($file:expr) => ({ /* compiler built-in */ }) }
699 }