Skip to content

Commit

Permalink
Remove use of deprecated proc_macro_hack
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dgellow authored and bodil committed Jan 27, 2022
1 parent 9d5f32b commit 9576477
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
1 change: 0 additions & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 2 additions & 3 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
extern crate proc_macro;

use proc_macro::TokenStream;
use proc_macro_hack::proc_macro_hack;

mod config;
mod declare;
Expand All @@ -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);
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion typed-html/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
14 changes: 8 additions & 6 deletions typed-html/src/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -18,7 +17,10 @@ macro_rules! marker_trait {
($trait:ident, $parent:ident) => {
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 IntoIter = std::vec::IntoIter<Box<dyn $trait<T>>>;

Expand Down Expand Up @@ -48,7 +50,7 @@ marker_trait!(SelectContent);
marker_trait!(TableContent);
marker_trait!(TableColumnContent);

declare_elements!{
declare_elements! {
html {
xmlns: Uri,
} with [head, body];
Expand Down Expand Up @@ -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<String> = html!(<div data-id="1234">"Boo!"</div>);

Expand Down
3 changes: 0 additions & 3 deletions typed-html/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9576477

Please sign in to comment.