From 95013e612d3ffaee2b674da4a29308aaa7551726 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Wed, 29 May 2019 00:27:42 +0300 Subject: syntax: bail out of `find_width_of_character_at_span` if the span doesn't start and end in the same file. --- src/libsyntax/source_map.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libsyntax/source_map.rs') diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs index 8a210db9185..e2171a84e23 100644 --- a/src/libsyntax/source_map.rs +++ b/src/libsyntax/source_map.rs @@ -727,6 +727,11 @@ impl SourceMap { debug!("find_width_of_character_at_span: local_begin=`{:?}`, local_end=`{:?}`", local_begin, local_end); + if local_begin.sf.start_pos != local_end.sf.start_pos { + debug!("find_width_of_character_at_span: begin and end are in different files"); + return 1; + } + let start_index = local_begin.pos.to_usize(); let end_index = local_end.pos.to_usize(); debug!("find_width_of_character_at_span: start_index=`{:?}`, end_index=`{:?}`", -- cgit 1.4.1-3-g733a5