From f33deb7511087f0dbaa343dc92927e4ac20c52b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 13 Dec 2024 18:18:19 +0000 Subject: [PATCH] Account for `///` when rendering multiline spans Don't consider `///` and `//!` docstrings to be empty for the purposes of multiline span rendering. --- tests/ui/doc/unbalanced_ticks.stderr | 4 +++- tests/ui/empty_line_after/doc_comments.stderr | 3 +++ tests/ui/needless_doc_main.stderr | 14 ++++++++++---- tests/ui/suspicious_doc_comments_unfixable.stderr | 9 +++++++-- tests/ui/too_long_first_doc_paragraph-fix.stderr | 4 +++- tests/ui/too_long_first_doc_paragraph.stderr | 7 +++++-- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/tests/ui/doc/unbalanced_ticks.stderr b/tests/ui/doc/unbalanced_ticks.stderr index 3bcf65c4595d..50324010e97f 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 c4d4dde7f73f..c5d5f3d37594 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 cfb389801db0..7e362cf377ce 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 2209a63d2c0f..d15f16f7c503 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 5925d2f902a7..6ef333f0cfd2 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 c40ee2fcb48f..95f42349b9b3 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. | |_^