about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-12-13 18:18:19 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-12-13 18:48:33 +0000
commitf33deb7511087f0dbaa343dc92927e4ac20c52b9 (patch)
tree3c05510e41c7208564713c0f09c819d4a8ed340e
parentcc9d9ccd11e9de89c2c48259f080b35eff902fe7 (diff)
downloadrust-f33deb7511087f0dbaa343dc92927e4ac20c52b9.tar.gz
rust-f33deb7511087f0dbaa343dc92927e4ac20c52b9.zip
Account for `///` when rendering multiline spans
Don't consider `///` and `//!` docstrings to be empty for the purposes of multiline span rendering.
-rw-r--r--tests/ui/doc/unbalanced_ticks.stderr4
-rw-r--r--tests/ui/empty_line_after/doc_comments.stderr3
-rw-r--r--tests/ui/needless_doc_main.stderr14
-rw-r--r--tests/ui/suspicious_doc_comments_unfixable.stderr9
-rw-r--r--tests/ui/too_long_first_doc_paragraph-fix.stderr4
-rw-r--r--tests/ui/too_long_first_doc_paragraph.stderr7
6 files changed, 31 insertions, 10 deletions
diff --git a/tests/ui/doc/unbalanced_ticks.stderr b/tests/ui/doc/unbalanced_ticks.stderr
index 3bcf65c4595..50324010e97 100644
--- a/tests/ui/doc/unbalanced_ticks.stderr
+++ b/tests/ui/doc/unbalanced_ticks.stderr
@@ -3,7 +3,9 @@ error: backticks are unbalanced
    |
 LL |   /// This is a doc comment with `unbalanced_tick marks and several words that
    |  _____^
-...  |
+LL | |
+LL | | /// should be `encompassed_by` tick marks because they `contain_underscores`.
+LL | | /// Because of the initial `unbalanced_tick` pair, the error message is
 LL | | /// very `confusing_and_misleading`.
    | |____________________________________^
    |
diff --git a/tests/ui/empty_line_after/doc_comments.stderr b/tests/ui/empty_line_after/doc_comments.stderr
index c4d4dde7f73..c5d5f3d3759 100644
--- a/tests/ui/empty_line_after/doc_comments.stderr
+++ b/tests/ui/empty_line_after/doc_comments.stderr
@@ -96,6 +96,9 @@ error: empty lines after doc comment
   --> tests/ui/empty_line_after/doc_comments.rs:63:5
    |
 LL | /     /// for OldA
+LL | |     // struct OldA;
+LL | |
+LL | |     /// Docs
 ...  |
 LL | |
    | |_^
diff --git a/tests/ui/needless_doc_main.stderr b/tests/ui/needless_doc_main.stderr
index cfb389801db..7e362cf377c 100644
--- a/tests/ui/needless_doc_main.stderr
+++ b/tests/ui/needless_doc_main.stderr
@@ -3,7 +3,9 @@ error: needless `fn main` in doctest
    |
 LL |   /// fn main() {
    |  _____^
-...  |
+LL | |
+LL | |
+LL | | ///     unimplemented!();
 LL | | /// }
    | |_____^
    |
@@ -15,7 +17,8 @@ error: needless `fn main` in doctest
    |
 LL |   /// fn main() -> () {
    |  _____^
-...  |
+LL | |
+LL | | ///     unimplemented!();
 LL | | /// }
    | |_____^
 
@@ -24,7 +27,8 @@ error: needless `fn main` in doctest
    |
 LL |   /// fn main() {
    |  _____^
-...  |
+LL | |
+LL | | ///     unimplemented!();
 LL | | /// }
    | |_____^
 
@@ -33,7 +37,9 @@ error: needless `fn main` in doctest
    |
 LL |   /// // the fn is not always the first line
    |  _____^
-...  |
+LL | |
+LL | | /// fn main() {
+LL | | ///     unimplemented!();
 LL | | /// }
    | |_____^
 
diff --git a/tests/ui/suspicious_doc_comments_unfixable.stderr b/tests/ui/suspicious_doc_comments_unfixable.stderr
index 2209a63d2c0..d15f16f7c50 100644
--- a/tests/ui/suspicious_doc_comments_unfixable.stderr
+++ b/tests/ui/suspicious_doc_comments_unfixable.stderr
@@ -2,7 +2,10 @@ error: this is an outer doc comment and does not apply to the parent module or c
   --> tests/ui/suspicious_doc_comments_unfixable.rs:4:1
    |
 LL | / ///! a
-...  |
+LL | |
+LL | |
+LL | | ///! b
+LL | | /// c
 LL | | ///! d
    | |______^
    |
@@ -22,7 +25,9 @@ error: this is an outer doc comment and does not apply to the parent module or c
   --> tests/ui/suspicious_doc_comments_unfixable.rs:12:1
    |
 LL | / ///! a
-...  |
+LL | |
+LL | | ///! b
+LL | | /// c
 LL | | ///! d
    | |______^
    |
diff --git a/tests/ui/too_long_first_doc_paragraph-fix.stderr b/tests/ui/too_long_first_doc_paragraph-fix.stderr
index 5925d2f902a..6ef333f0cfd 100644
--- a/tests/ui/too_long_first_doc_paragraph-fix.stderr
+++ b/tests/ui/too_long_first_doc_paragraph-fix.stderr
@@ -2,7 +2,9 @@ error: first doc comment paragraph is too long
   --> tests/ui/too_long_first_doc_paragraph-fix.rs:3:1
    |
 LL | / /// A very short summary.
-...  |
+LL | | /// A much longer explanation that goes into a lot more detail about
+LL | | /// how the thing works, possibly with doclinks and so one,
+LL | | /// and probably spanning a many rows. Blablabla, it needs to be over
 LL | | /// 200 characters so I needed to write something longeeeeeeer.
    | |_^
    |
diff --git a/tests/ui/too_long_first_doc_paragraph.stderr b/tests/ui/too_long_first_doc_paragraph.stderr
index c40ee2fcb48..95f42349b9b 100644
--- a/tests/ui/too_long_first_doc_paragraph.stderr
+++ b/tests/ui/too_long_first_doc_paragraph.stderr
@@ -2,7 +2,9 @@ error: first doc comment paragraph is too long
   --> tests/ui/too_long_first_doc_paragraph.rs:8:5
    |
 LL | /     //! A very short summary.
-...  |
+LL | |     //! A much longer explanation that goes into a lot more detail about
+LL | |     //! how the thing works, possibly with doclinks and so one,
+LL | |     //! and probably spanning a many rows. Blablabla, it needs to be over
 LL | |     //! 200 characters so I needed to write something longeeeeeeer.
    | |____^
    |
@@ -27,7 +29,8 @@ error: first doc comment paragraph is too long
   --> tests/ui/too_long_first_doc_paragraph.rs:36:1
    |
 LL | / /// Lorem
-...  |
+LL | | /// ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
+LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
 LL | | /// gravida non lacinia at, rhoncus eu lacus.
    | |_^