Do not ICE when synthesizing spans falling inside unicode chars
This commit is contained in:
parent
60960a260f
commit
d824edfc2c
3 changed files with 28 additions and 0 deletions
|
@ -554,8 +554,14 @@ impl SourceMap {
|
|||
}
|
||||
|
||||
if let Some(ref src) = local_begin.sf.src {
|
||||
if !src.is_char_boundary(start_index) || !src.is_char_boundary(end_index) {
|
||||
return Err(SpanSnippetError::IllFormedSpan(sp));
|
||||
}
|
||||
return Ok(extract_source(src, start_index, end_index));
|
||||
} else if let Some(src) = local_begin.sf.external_src.borrow().get_source() {
|
||||
if !src.is_char_boundary(start_index) || !src.is_char_boundary(end_index) {
|
||||
return Err(SpanSnippetError::IllFormedSpan(sp));
|
||||
}
|
||||
return Ok(extract_source(src, start_index, end_index));
|
||||
} else {
|
||||
return Err(SpanSnippetError::SourceNotAvailable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue