diff --git a/procedural-masquerade/Cargo.toml b/procedural-masquerade/Cargo.toml index b833f1bf..66638a31 100644 --- a/procedural-masquerade/Cargo.toml +++ b/procedural-masquerade/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "procedural-masquerade" -version = "0.1.6" +version = "0.1.7" authors = ["Simon Sapin "] description = "macro_rules for making proc_macro_derive pretending to be proc_macro" documentation = "https://docs.rs/procedural-masquerade/" diff --git a/procedural-masquerade/lib.rs b/procedural-masquerade/lib.rs index 2736ccf5..4b51e149 100644 --- a/procedural-masquerade/lib.rs +++ b/procedural-masquerade/lib.rs @@ -199,14 +199,23 @@ pub fn _extract_input(derive_input: &str) -> &str { let mut input = derive_input; for expected in &[ - "#[allow(unused)]", + "#", + "[", + "allow", + "(", + "unused", + ")", + "]", "enum", "ProceduralMasqueradeDummyType", "{", "Input", "=", - "(0,", - "stringify!", + "(", + "0", + ",", + "stringify", + "!", "(", ] { input = input.trim_start(); @@ -219,7 +228,7 @@ pub fn _extract_input(derive_input: &str) -> &str { input = &input[expected.len()..]; } - for expected in [")", ").0,", "}"].iter().rev() { + for expected in [")", ")", ".", "0", ",", "}"].iter().rev() { input = input.trim_end(); assert!( input.ends_with(expected), @@ -268,7 +277,7 @@ macro_rules! define_invoke_proc_macro { // which is then ignored. // Using `stringify!` enables passing arbitrary tokens // rather than only what can be parsed as a const expression. - Input = (0, stringify! $paren ).0 + Input = (0, stringify! $paren ).0, } } }