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
This commit is contained in:
Samuel El-Borai 2022-01-22 19:33:57 +01:00 committed by Bodil Stokke
parent 9d5f32ba9b
commit 95764776f2
5 changed files with 10 additions and 14 deletions

View File

@ -19,7 +19,6 @@ proc-macro = true
lalrpop-util = "0.18" lalrpop-util = "0.18"
ansi_term = "0.12.0" ansi_term = "0.12.0"
proc-macro2 = { version = "1.0.4", features = ["nightly"] } proc-macro2 = { version = "1.0.4", features = ["nightly"] }
proc-macro-hack = "0.5.2"
quote = "1.0.2" quote = "1.0.2"
[build-dependencies] [build-dependencies]

View File

@ -4,7 +4,6 @@
extern crate proc_macro; extern crate proc_macro;
use proc_macro::TokenStream; use proc_macro::TokenStream;
use proc_macro_hack::proc_macro_hack;
mod config; mod config;
mod declare; mod declare;
@ -21,7 +20,7 @@ mod span;
/// See the crate documentation for [`typed_html`][typed_html]. /// See the crate documentation for [`typed_html`][typed_html].
/// ///
/// [typed_html]: ../typed_html/index.html /// [typed_html]: ../typed_html/index.html
#[proc_macro_hack] #[proc_macro]
pub fn html(input: TokenStream) -> TokenStream { pub fn html(input: TokenStream) -> TokenStream {
let stream = lexer::unroll_stream(input.into(), false); let stream = lexer::unroll_stream(input.into(), false);
let result = html::expand_html(&stream); let result = html::expand_html(&stream);
@ -40,7 +39,7 @@ pub fn html(input: TokenStream) -> TokenStream {
/// ///
/// [typed_html]: ../typed_html/index.html /// [typed_html]: ../typed_html/index.html
#[cfg(feature = "dodrio")] #[cfg(feature = "dodrio")]
#[proc_macro_hack] #[proc_macro]
pub fn dodrio(input: TokenStream) -> TokenStream { pub fn dodrio(input: TokenStream) -> TokenStream {
let stream = lexer::unroll_stream(input.into(), false); let stream = lexer::unroll_stream(input.into(), false);
let result = html::expand_dodrio(&stream); let result = html::expand_dodrio(&stream);

View File

@ -25,7 +25,6 @@ strum_macros = "0.18"
mime = "0.3.13" mime = "0.3.13"
language-tags = "0.2.2" language-tags = "0.2.2"
htmlescape = "0.3.1" htmlescape = "0.3.1"
proc-macro-hack = "0.5.4"
proc-macro-nested = "0.1.3" proc-macro-nested = "0.1.3"
stdweb = { version = "0.4.14", optional = true } stdweb = { version = "0.4.14", optional = true }
dodrio = { version = "0.2.0", optional = true } dodrio = { version = "0.2.0", optional = true }

View File

@ -2,11 +2,10 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use typed_html_macros::declare_elements;
use crate::OutputType;
use crate::dom::{Node, TextNode}; use crate::dom::{Node, TextNode};
use crate::types::*; use crate::types::*;
use crate::OutputType;
use typed_html_macros::declare_elements;
// Marker traits for element content groups // Marker traits for element content groups
@ -18,7 +17,10 @@ macro_rules! marker_trait {
($trait:ident, $parent:ident) => { ($trait:ident, $parent:ident) => {
pub trait $trait<T: OutputType + Send>: $parent<T> {} pub trait $trait<T: OutputType + Send>: $parent<T> {}
impl<T> IntoIterator for Box<dyn $trait<T>> where T: OutputType + Send { impl<T> IntoIterator for Box<dyn $trait<T>>
where
T: OutputType + Send,
{
type Item = Box<dyn $trait<T>>; type Item = Box<dyn $trait<T>>;
type IntoIter = std::vec::IntoIter<Box<dyn $trait<T>>>; type IntoIter = std::vec::IntoIter<Box<dyn $trait<T>>>;
@ -48,7 +50,7 @@ marker_trait!(SelectContent);
marker_trait!(TableContent); marker_trait!(TableContent);
marker_trait!(TableColumnContent); marker_trait!(TableColumnContent);
declare_elements!{ declare_elements! {
html { html {
xmlns: Uri, xmlns: Uri,
} with [head, body]; } with [head, body];
@ -451,7 +453,7 @@ declare_elements!{
#[test] #[test]
fn test_data_attributes() { fn test_data_attributes() {
use crate as typed_html; use crate as typed_html;
use crate::dom::DOMTree; use crate::{dom::DOMTree, html};
let frag: DOMTree<String> = html!(<div data-id="1234">"Boo!"</div>); let frag: DOMTree<String> = html!(<div data-id="1234">"Boo!"</div>);

View File

@ -195,14 +195,11 @@
pub extern crate htmlescape; pub extern crate htmlescape;
use proc_macro_hack::proc_macro_hack;
use std::fmt::Display; use std::fmt::Display;
#[proc_macro_hack(support_nested)]
pub use typed_html_macros::html; pub use typed_html_macros::html;
#[cfg(feature = "dodrio_macro")] #[cfg(feature = "dodrio_macro")]
#[proc_macro_hack(support_nested)]
pub use typed_html_macros::dodrio; pub use typed_html_macros::dodrio;
pub mod dom; pub mod dom;