Skip to content

Commit

Permalink
syntax: bail out of find_width_of_character_at_span if the span doe…
Browse files Browse the repository at this point in the history
…sn't start and end in the same file.
  • Loading branch information
eddyb committed May 28, 2019
1 parent 3e5beb2 commit 95013e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libsyntax/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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=`{:?}`",
Expand Down

0 comments on commit 95013e6

Please sign in to comment.