Skip to content

Commit 95013e6

Browse files
committed
syntax: bail out of find_width_of_character_at_span if the span doesn't start and end in the same file.
1 parent 3e5beb2 commit 95013e6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libsyntax/source_map.rs

+5
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,11 @@ impl SourceMap {
727727
debug!("find_width_of_character_at_span: local_begin=`{:?}`, local_end=`{:?}`",
728728
local_begin, local_end);
729729

730+
if local_begin.sf.start_pos != local_end.sf.start_pos {
731+
debug!("find_width_of_character_at_span: begin and end are in different files");
732+
return 1;
733+
}
734+
730735
let start_index = local_begin.pos.to_usize();
731736
let end_index = local_end.pos.to_usize();
732737
debug!("find_width_of_character_at_span: start_index=`{:?}`, end_index=`{:?}`",

0 commit comments

Comments
 (0)