diff options
| author | Seiichi Uchida <seuchida@gmail.com> | 2019-03-14 22:50:53 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-14 22:50:53 +0900 |
| commit | ce5cccc32c3897488d2c503fe9d2a9a429a9b0eb (patch) | |
| tree | 7733eab3b3282d4299fa27ae8c09ee9c21586a7f /src/source_map.rs | |
| parent | 331a0500ce3e8ad70f1e2895234a0a0668e980f3 (diff) | |
| download | rust-ce5cccc32c3897488d2c503fe9d2a9a429a9b0eb.tar.gz rust-ce5cccc32c3897488d2c503fe9d2a9a429a9b0eb.zip | |
Update rustc-ap-* crates to 407.0.0 (#3447)
Diffstat (limited to 'src/source_map.rs')
| -rw-r--r-- | src/source_map.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/source_map.rs b/src/source_map.rs index d0c4adbe61d..c98b7596383 100644 --- a/src/source_map.rs +++ b/src/source_map.rs @@ -26,7 +26,13 @@ pub trait LineRangeUtils { impl<'a> SpanUtils for SnippetProvider<'a> { fn span_after(&self, original: Span, needle: &str) -> BytePos { - self.opt_span_after(original, needle).expect("bad span") + self.opt_span_after(original, needle).unwrap_or_else(|| { + panic!( + "bad span: `{}`: `{}`", + needle, + self.span_to_snippet(original).unwrap() + ) + }) } fn span_after_last(&self, original: Span, needle: &str) -> BytePos { @@ -43,7 +49,7 @@ impl<'a> SpanUtils for SnippetProvider<'a> { fn span_before(&self, original: Span, needle: &str) -> BytePos { self.opt_span_before(original, needle).unwrap_or_else(|| { panic!( - "bad span: {}: {}", + "bad span: `{}`: `{}`", needle, self.span_to_snippet(original).unwrap() ) |
