Skip to content

Commit

Permalink
Implement compile_error using call site span
Browse files Browse the repository at this point in the history
Mixed site is equivalent to def site for local variables, labels, and
$crate; and equivalent to call site for all other name resolution. Since
it is being used here for a macro invocation which is not one of the
above 3 def site scenarios, directly using call_site is clearer to me.
  • Loading branch information
dtolnay committed Jun 8, 2023
1 parent 145142a commit 8aeb1d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ impl Error {

impl ErrorMessage {
fn to_compile_error(&self) -> TokenStream {
let (mut start, mut end) = (Span::mixed_site(), Span::mixed_site());
let (mut start, mut end) = (Span::call_site(), Span::call_site());
if let Some(range) = self.span.get() {
start = start.located_at(range.start);
end = end.located_at(range.end);
Expand Down

0 comments on commit 8aeb1d7

Please sign in to comment.