Skip to content

Commit

Permalink
Merge pull request #1467 from danielhenrymantilla/located_at_error
Browse files Browse the repository at this point in the history
*Resolve* spanned errors at call/mixed site
  • Loading branch information
dtolnay committed Jun 8, 2023
2 parents 2a001f4 + a091982 commit 145142a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ impl Error {

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

// ::core::compile_error!($message)
Expand Down

0 comments on commit 145142a

Please sign in to comment.