diff --git a/tests/ui/ambiguous-span.rs b/tests/ui/ambiguous-span.rs new file mode 100644 index 0000000..4582dc8 --- /dev/null +++ b/tests/ui/ambiguous-span.rs @@ -0,0 +1,16 @@ +use proc_macro2::Span; +use quote::quote_spanned; + +trait CallSite { + fn get() -> Self; +} + +impl CallSite for Span { + fn get() -> Self { + Span::call_site() + } +} + +fn main() { + let _ = quote_spanned!(CallSite::get()=> ...); +} diff --git a/tests/ui/ambiguous-span.stderr b/tests/ui/ambiguous-span.stderr new file mode 100644 index 0000000..3433df5 --- /dev/null +++ b/tests/ui/ambiguous-span.stderr @@ -0,0 +1,13 @@ +error[E0283]: type annotations needed + --> tests/ui/ambiguous-span.rs:15:28 + | +15 | let _ = quote_spanned!(CallSite::get()=> ...); + | ---------------^^^^^^^^^^^^^^^------- + | | | + | | cannot infer type + | required by a bound introduced by this call + | + = note: cannot satisfy `_: IntoSpan` + = help: the following types implement trait `IntoSpan`: + DelimSpan + Span