Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/proc-macro2/tests/marker.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / proc-macro2 / tests / marker.rs` 97 lines ยท 2647 bytes Raw Blame History 1 #![allow(clippy::extra_unused_type_parameters)] 2 3 use proc_macro2::{ 4 Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree, 5 }; 6 7 macro_rules! assert_impl { 8 ($ty:ident is $($marker:ident) and +) => { 9 #[test] 10 #[allow(non_snake_case)] 11 fn $ty() { 12 fn assert_implemented() {} 13 assert_implemented::<$ty>(); 14 } 15 }; 16 17 ($ty:ident is not $($marker:ident) or +) => { 18 #[test] 19 #[allow(non_snake_case)] 20 fn $ty() { 21 $( 22 { 23 // Implemented for types that implement $marker. 24 #[allow(dead_code)] 25 trait IsNotImplemented { 26 fn assert_not_implemented() {} 27 } 28 impl IsNotImplemented for T {} 29 30 // Implemented for the type being tested. 31 trait IsImplemented { 32 fn assert_not_implemented() {} 33 } 34 impl IsImplemented for $ty {} 35 36 // If $ty does not implement $marker, there is no ambiguity 37 // in the following trait method call. 38 <$ty>::assert_not_implemented(); 39 } 40 )+ 41 } 42 }; 43 } 44 45 assert_impl!(Delimiter is Send and Sync); 46 assert_impl!(Spacing is Send and Sync); 47 48 assert_impl!(Group is not Send or Sync); 49 assert_impl!(Ident is not Send or Sync); 50 assert_impl!(LexError is not Send or Sync); 51 assert_impl!(Literal is not Send or Sync); 52 assert_impl!(Punct is not Send or Sync); 53 assert_impl!(Span is not Send or Sync); 54 assert_impl!(TokenStream is not Send or Sync); 55 assert_impl!(TokenTree is not Send or Sync); 56 57 #[cfg(procmacro2_semver_exempt)] 58 mod semver_exempt { 59 use proc_macro2::LineColumn; 60 61 assert_impl!(LineColumn is Send and Sync); 62 } 63 64 mod unwind_safe { 65 #[cfg(procmacro2_semver_exempt)] 66 use proc_macro2::LineColumn; 67 use proc_macro2::{ 68 Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree, 69 }; 70 use std::panic::{RefUnwindSafe, UnwindSafe}; 71 72 macro_rules! assert_unwind_safe { 73 ($($types:ident)*) => { 74 $( 75 assert_impl!($types is UnwindSafe and RefUnwindSafe); 76 )* 77 }; 78 } 79 80 assert_unwind_safe! { 81 Delimiter 82 Group 83 Ident 84 LexError 85 Literal 86 Punct 87 Spacing 88 Span 89 TokenStream 90 TokenTree 91 } 92 93 #[cfg(procmacro2_semver_exempt)] 94 assert_unwind_safe! { 95 LineColumn 96 } 97 }