Account for /// when rendering multiline spans

Don't consider `///` and `//!` docstrings to be empty for the purposes of multiline span rendering.
This commit is contained in:
Esteban Küber 2024-12-13 18:18:19 +00:00
parent cc9d9ccd11
commit f33deb7511
6 changed files with 31 additions and 10 deletions

View file

@ -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`.
| |____________________________________^
|

View file

@ -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 | |
| |_^

View file

@ -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 | | /// }
| |_____^

View file

@ -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
| |______^
|

View file

@ -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.
| |_^
|

View file

@ -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.
| |_^