about summary refs log tree commit diff
path: root/src/librustdoc/scrape_examples.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-09-03 10:15:35 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-09-03 12:56:10 +0000
commit258ace613da6b8c90ba4995738cb13791388c4bb (patch)
tree86baeb6af697ff1ce06e94ef72305a8bd5b8029c /src/librustdoc/scrape_examples.rs
parent585bb5e68d85c1e4f32da3e2499343372626a436 (diff)
downloadrust-258ace613da6b8c90ba4995738cb13791388c4bb.tar.gz
rust-258ace613da6b8c90ba4995738cb13791388c4bb.zip
Use relative positions inside a SourceFile.
Diffstat (limited to 'src/librustdoc/scrape_examples.rs')
-rw-r--r--src/librustdoc/scrape_examples.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs
index 534c6eebbdd..dd52deef672 100644
--- a/src/librustdoc/scrape_examples.rs
+++ b/src/librustdoc/scrape_examples.rs
@@ -73,7 +73,7 @@ pub(crate) struct SyntaxRange {
 impl SyntaxRange {
     fn new(span: rustc_span::Span, file: &SourceFile) -> Option<Self> {
         let get_pos = |bytepos: BytePos| file.original_relative_byte_pos(bytepos).0;
-        let get_line = |bytepos: BytePos| file.lookup_line(bytepos);
+        let get_line = |bytepos: BytePos| file.lookup_line(file.relative_position(bytepos));
 
         Some(SyntaxRange {
             byte_span: (get_pos(span.lo()), get_pos(span.hi())),