about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2022-12-25 17:41:31 +0100
committerLukas Markeffsky <@>2022-12-25 17:41:31 +0100
commit83e653920d694a010fad8c7d87d302c2d5b3a177 (patch)
treee2672d85b9620ff115561eb8c9b672dedb01a3cd
parent94d624500316affdbe893597ee249899991f31a6 (diff)
downloadrust-83e653920d694a010fad8c7d87d302c2d5b3a177.tar.gz
rust-83e653920d694a010fad8c7d87d302c2d5b3a177.zip
document that `Span::to` can go backwards
-rw-r--r--compiler/rustc_span/src/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 2181c090027..bee4b0a2332 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -796,6 +796,9 @@ impl Span {
 
     /// Returns a `Span` that would enclose both `self` and `end`.
     ///
+    /// Note that this can also be used to extend the span "backwards":
+    /// `start.to(end)` and `end.to(start)` return the same `Span`.
+    ///
     /// ```text
     ///     ____             ___
     ///     self lorem ipsum end