From 95764776f29e621d07eea6fdd79163dbf548d5e8 Mon Sep 17 00:00:00 2001 From: Samuel El-Borai Date: Sat, 22 Jan 2022 19:33:57 +0100 Subject: [PATCH] Remove use of deprecated proc_macro_hack This fixes the error: "unresolved macro `$crate::proc_macro_call_dodrio!`" from the file examples/dodrio/counter/src/lib.rs. Quoting proc_macro_hack documentation: > Note: As of Rust 1.45 this crate is superseded by native support for > #[proc_macro] in expression position. Only consider using this crate > if you care about supporting compilers between 1.31 and 1.45. Source: https://docs.rs/proc-macro-hack/latest/proc_macro_hack/index.html --- macros/Cargo.toml | 1 - macros/src/lib.rs | 5 ++--- typed-html/Cargo.toml | 1 - typed-html/src/elements.rs | 14 ++++++++------ typed-html/src/lib.rs | 3 --- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/macros/Cargo.toml b/macros/Cargo.toml index 4529eda..91cfd7e 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -19,7 +19,6 @@ proc-macro = true lalrpop-util = "0.18" ansi_term = "0.12.0" proc-macro2 = { version = "1.0.4", features = ["nightly"] } -proc-macro-hack = "0.5.2" quote = "1.0.2" [build-dependencies] diff --git a/macros/src/lib.rs b/macros/src/lib.rs index c9e7893..73f735b 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -4,7 +4,6 @@ extern crate proc_macro; use proc_macro::TokenStream; -use proc_macro_hack::proc_macro_hack; mod config; mod declare; @@ -21,7 +20,7 @@ mod span; /// See the crate documentation for [`typed_html`][typed_html]. /// /// [typed_html]: ../typed_html/index.html -#[proc_macro_hack] +#[proc_macro] pub fn html(input: TokenStream) -> TokenStream { let stream = lexer::unroll_stream(input.into(), false); let result = html::expand_html(&stream); @@ -40,7 +39,7 @@ pub fn html(input: TokenStream) -> TokenStream { /// /// [typed_html]: ../typed_html/index.html #[cfg(feature = "dodrio")] -#[proc_macro_hack] +#[proc_macro] pub fn dodrio(input: TokenStream) -> TokenStream { let stream = lexer::unroll_stream(input.into(), false); let result = html::expand_dodrio(&stream); diff --git a/typed-html/Cargo.toml b/typed-html/Cargo.toml index 120a49a..22a613f 100644 --- a/typed-html/Cargo.toml +++ b/typed-html/Cargo.toml @@ -25,7 +25,6 @@ strum_macros = "0.18" mime = "0.3.13" language-tags = "0.2.2" htmlescape = "0.3.1" -proc-macro-hack = "0.5.4" proc-macro-nested = "0.1.3" stdweb = { version = "0.4.14", optional = true } dodrio = { version = "0.2.0", optional = true } diff --git a/typed-html/src/elements.rs b/typed-html/src/elements.rs index 755b1da..42369bf 100644 --- a/typed-html/src/elements.rs +++ b/typed-html/src/elements.rs @@ -2,11 +2,10 @@ #![allow(non_camel_case_types)] -use typed_html_macros::declare_elements; - -use crate::OutputType; use crate::dom::{Node, TextNode}; use crate::types::*; +use crate::OutputType; +use typed_html_macros::declare_elements; // Marker traits for element content groups @@ -18,7 +17,10 @@ macro_rules! marker_trait { ($trait:ident, $parent:ident) => { pub trait $trait: $parent {} - impl IntoIterator for Box> where T: OutputType + Send { + impl IntoIterator for Box> + where + T: OutputType + Send, + { type Item = Box>; type IntoIter = std::vec::IntoIter>>; @@ -48,7 +50,7 @@ marker_trait!(SelectContent); marker_trait!(TableContent); marker_trait!(TableColumnContent); -declare_elements!{ +declare_elements! { html { xmlns: Uri, } with [head, body]; @@ -451,7 +453,7 @@ declare_elements!{ #[test] fn test_data_attributes() { use crate as typed_html; - use crate::dom::DOMTree; + use crate::{dom::DOMTree, html}; let frag: DOMTree = html!(
"Boo!"
); diff --git a/typed-html/src/lib.rs b/typed-html/src/lib.rs index de9a23b..1bf1167 100644 --- a/typed-html/src/lib.rs +++ b/typed-html/src/lib.rs @@ -195,14 +195,11 @@ pub extern crate htmlescape; -use proc_macro_hack::proc_macro_hack; use std::fmt::Display; -#[proc_macro_hack(support_nested)] pub use typed_html_macros::html; #[cfg(feature = "dodrio_macro")] -#[proc_macro_hack(support_nested)] pub use typed_html_macros::dodrio; pub mod dom;