diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-03 10:15:35 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-03 12:56:10 +0000 |
| commit | 258ace613da6b8c90ba4995738cb13791388c4bb (patch) | |
| tree | 86baeb6af697ff1ce06e94ef72305a8bd5b8029c /src/librustdoc/scrape_examples.rs | |
| parent | 585bb5e68d85c1e4f32da3e2499343372626a436 (diff) | |
| download | rust-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.rs | 2 |
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())), |
