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/syn-2.0.119/tests/regression/issue1235.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 / syn-2.0.119 / tests / regression / issue1235.rs` 32 lines ยท 932 bytes Raw Blame History 1 use proc_macro2::{Delimiter, Group}; 2 use quote::quote; 3 4 #[test] 5 fn main() { 6 // Okay. Rustc allows top-level `static` with no value syntactically, but 7 // not semantically. Syn parses as Item::Verbatim. 8 let tokens = quote! { 9 pub static FOO: usize; 10 pub static BAR: usize; 11 }; 12 let file = syn::parse2::(tokens).unwrap(); 13 println!("{:#?}", file); 14 15 // Okay. 16 let inner = Group::new( 17 Delimiter::None, 18 quote!(static FOO: usize = 0; pub static BAR: usize = 0), 19 ); 20 let tokens = quote!(pub #inner;); 21 let file = syn::parse2::(tokens).unwrap(); 22 println!("{:#?}", file); 23 24 // Formerly parser crash. 25 let inner = Group::new( 26 Delimiter::None, 27 quote!(static FOO: usize; pub static BAR: usize), 28 ); 29 let tokens = quote!(pub #inner;); 30 let file = syn::parse2::(tokens).unwrap(); 31 println!("{:#?}", file); 32 }