Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Span::mixed_site directly from proc-macro2 #254

Merged
merged 2 commits into from
Jan 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[#238](https://github.com/lambda-fairy/maud/pull/238)
- [Changed] Generalize `impl Into<String> for PreEscaped<T>` to `impl From<PreEscaped<T>> for String`.
[#248](https://github.com/lambda-fairy/maud/pull/248)
- [Fixed] Use `Span::mixed_site` directly from proc-macro2
[#254](https://github.com/lambda-fairy/maud/pull/254)

## [0.22.1] - 2020-11-02

Expand Down
2 changes: 1 addition & 1 deletion maud_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ edition = "2018"
syn = "1.0.8"
maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }
quote = "1.0.7"
proc-macro2 = "1.0.18"
proc-macro2 = "1.0.19"
proc-macro-error = "1.0.0"

[lib]
Expand Down
8 changes: 2 additions & 6 deletions maud_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod ast;
mod generate;
mod parse;

use proc_macro2::{Ident, TokenStream, TokenTree};
use proc_macro2::{Ident, Span, TokenStream, TokenTree};
use proc_macro_error::proc_macro_error;
use quote::quote;

Expand All @@ -28,11 +28,7 @@ pub fn html_debug(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}

fn expand(input: TokenStream) -> TokenStream {
// TODO: call `proc_macro2::Span::mixed_site()` directly when Rust 1.45 is stable
let output_ident = TokenTree::Ident(Ident::new(
"__maud_output",
proc_macro::Span::mixed_site().into(),
));
let output_ident = TokenTree::Ident(Ident::new("__maud_output", Span::mixed_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();
Expand Down