dtolnay / quote

Rust quasi-quoting
Apache License 2.0
1.32k stars 90 forks source link

Compile time regression in 1.0.52 #244

Closed ogoffart closed 1 year ago

ogoffart commented 1 year ago

This code

extern crate proc_macro;

pub fn the_function() {
    let span = proc_macro::Span::call_site();
    quote::quote_spanned!(span.into() => hello);
}

compiles fine when proc_macro2 1.0.51 is in used (pinned in cargo.toml) But with proc_macro2 1.0.52, the error is:

error[E0283]: type annotations needed
  --> src/lib.rs:12:32
   |
12 |     quote::quote_spanned!(span.into() => hello);
   |     ---------------------------^^^^------------ required by a bound introduced by this call
   |
   = note: cannot satisfy `_: IntoSpan`
   = help: the following types implement trait `IntoSpan`:
             proc_macro2::extra::DelimSpan
             quote::__private::Span
help: try using a fully qualified path to specify the expected types
   |
12 |     quote::quote_spanned!(<proc_macro::Span as Into<T>>::into(span) => hello);
   |                           ++++++++++++++++++++++++++++++++++++    ~

Now, I understand this is easy to fix in the usage. But the crate is on crates.io and I'd like to avoid creating a new release if it can be easily fixed.

ogoffart commented 1 year ago

I realized now that the problem is maybe caused by the recent change in quote instead, and this issue might be filled in the wrong repo

dtolnay commented 1 year ago

Sorry about the breakage, I've yanked that version.