diff --git a/maud_macros/src/lib.rs b/maud_macros/src/lib.rs index 1045fd3f..acae5b43 100644 --- a/maud_macros/src/lib.rs +++ b/maud_macros/src/lib.rs @@ -9,7 +9,7 @@ extern crate proc_macro; mod parse; mod build; -use proc_macro::{Literal, Span, Term, TokenNode, TokenStream, TokenTree}; +use proc_macro::{Literal, Span, Term, TokenStream, TokenTree}; use proc_macro::quote; type ParseResult = Result; @@ -27,14 +27,20 @@ pub fn html_debug(input: TokenStream) -> TokenStream { } fn expand(input: TokenStream) -> TokenStream { - let output_ident = TokenTree { - kind: TokenNode::Term(Term::intern("__maud_output")), - span: Span::def_site(), - }; + //let output_ident = TokenTree { + + // kind: TokenNode::Term(Term::intern("__maud_output")), + // // span is a method now, not a field + // span: Span::def_site(), + //}; + + // A TokenTree is a sequence of TokenTree variants. + let output_ident = TokenTree::Term(Term::new("__maud_output", Span::def_site())); // Heuristic: the size of the resulting markup tends to correlate with the // code size of the template itself let size_hint = input.to_string().len(); - let size_hint = TokenNode::Literal(Literal::u64(size_hint as u64)); + // QUESTION: u64_suffixed or unsuffixed? + let size_hint = Literal::u64_unsuffixed(size_hint as u64); let stmts = match parse::parse(input, output_ident.clone()) { Ok(stmts) => stmts, Err(e) => panic!(e),