core_extensions/macros/
internal.rs
1#[allow(unused_macros)]
2macro_rules! cfg_if {
3 (($meta:meta) $then:block else $else:block) => {{
4 #[cfg($meta)]
5 let ret = $then;
6
7 #[cfg(not($meta))]
8 let ret = $else;
9
10 ret
11 }};
12}
13
14#[allow(unused_macros)]
15#[cfg(not(feature = "rust_1_46"))]
16macro_rules! if_rust_1_46 {
17 ($(#[$attr:meta])* => ($($before_1_46:tt)*) ($($since_1_46:tt)*) ) => {
18 $(#[$attr])*
19 $($before_1_46)*
20 };
21}
22
23#[allow(unused_macros)]
24#[cfg(feature = "rust_1_46")]
25macro_rules! if_rust_1_46 {
26 ($(#[$attr:meta])* => ($($before_1_46:tt)*) ($($since_1_46:tt)*) ) => {
27 $(#[$attr])*
28 $($since_1_46)*
29 };
30}
31
32
33
34#[doc(hidden)]
35#[macro_export]
36macro_rules! __coerce_item {
37 ($item:item) => {
38 $item
39 }
40}
41
42#[doc(hidden)]
43#[macro_export]
44macro_rules! __validate_macro_then_parentheses {
45 (
46 (
47 $(::)? $($path:ident)::* ! $prefix:tt
48 ($($tokens:tt)*)
49 )
50 $($expansion:tt)*
51 ) => {
52 $($expansion)*
53 };
54 (
55 ($($anything:tt)*)
56 $($expansion:tt)*
57 ) => {
58 $crate::__::compile_error!{$crate::__::concat!{
59 "expected arguments to be a macro invocation followed by `()`-delimited arguments"
60 }}
61 };
62}