Skip to content

Commit

Permalink
Add a ui test with ambiguous quote_spanned span
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 12, 2023
1 parent 364f021 commit d9f38b5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/ui/ambiguous-span.rs
Original file line number Diff line number Diff line change
@@ -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()=> ...);
}
13 changes: 13 additions & 0 deletions tests/ui/ambiguous-span.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d9f38b5

Please sign in to comment.