Skip to content

Commit f33deb7

Browse files
committed
Account for /// when rendering multiline spans
Don't consider `///` and `//!` docstrings to be empty for the purposes of multiline span rendering.
1 parent cc9d9cc commit f33deb7

6 files changed

+31
-10
lines changed

tests/ui/doc/unbalanced_ticks.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ error: backticks are unbalanced
33
|
44
LL | /// This is a doc comment with `unbalanced_tick marks and several words that
55
| _____^
6-
... |
6+
LL | |
7+
LL | | /// should be `encompassed_by` tick marks because they `contain_underscores`.
8+
LL | | /// Because of the initial `unbalanced_tick` pair, the error message is
79
LL | | /// very `confusing_and_misleading`.
810
| |____________________________________^
911
|

tests/ui/empty_line_after/doc_comments.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ error: empty lines after doc comment
9696
--> tests/ui/empty_line_after/doc_comments.rs:63:5
9797
|
9898
LL | / /// for OldA
99+
LL | | // struct OldA;
100+
LL | |
101+
LL | | /// Docs
99102
... |
100103
LL | |
101104
| |_^

tests/ui/needless_doc_main.stderr

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ error: needless `fn main` in doctest
33
|
44
LL | /// fn main() {
55
| _____^
6-
... |
6+
LL | |
7+
LL | |
8+
LL | | /// unimplemented!();
79
LL | | /// }
810
| |_____^
911
|
@@ -15,7 +17,8 @@ error: needless `fn main` in doctest
1517
|
1618
LL | /// fn main() -> () {
1719
| _____^
18-
... |
20+
LL | |
21+
LL | | /// unimplemented!();
1922
LL | | /// }
2023
| |_____^
2124

@@ -24,7 +27,8 @@ error: needless `fn main` in doctest
2427
|
2528
LL | /// fn main() {
2629
| _____^
27-
... |
30+
LL | |
31+
LL | | /// unimplemented!();
2832
LL | | /// }
2933
| |_____^
3034

@@ -33,7 +37,9 @@ error: needless `fn main` in doctest
3337
|
3438
LL | /// // the fn is not always the first line
3539
| _____^
36-
... |
40+
LL | |
41+
LL | | /// fn main() {
42+
LL | | /// unimplemented!();
3743
LL | | /// }
3844
| |_____^
3945

tests/ui/suspicious_doc_comments_unfixable.stderr

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ error: this is an outer doc comment and does not apply to the parent module or c
22
--> tests/ui/suspicious_doc_comments_unfixable.rs:4:1
33
|
44
LL | / ///! a
5-
... |
5+
LL | |
6+
LL | |
7+
LL | | ///! b
8+
LL | | /// c
69
LL | | ///! d
710
| |______^
811
|
@@ -22,7 +25,9 @@ error: this is an outer doc comment and does not apply to the parent module or c
2225
--> tests/ui/suspicious_doc_comments_unfixable.rs:12:1
2326
|
2427
LL | / ///! a
25-
... |
28+
LL | |
29+
LL | | ///! b
30+
LL | | /// c
2631
LL | | ///! d
2732
| |______^
2833
|

tests/ui/too_long_first_doc_paragraph-fix.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error: first doc comment paragraph is too long
22
--> tests/ui/too_long_first_doc_paragraph-fix.rs:3:1
33
|
44
LL | / /// A very short summary.
5-
... |
5+
LL | | /// A much longer explanation that goes into a lot more detail about
6+
LL | | /// how the thing works, possibly with doclinks and so one,
7+
LL | | /// and probably spanning a many rows. Blablabla, it needs to be over
68
LL | | /// 200 characters so I needed to write something longeeeeeeer.
79
| |_^
810
|

tests/ui/too_long_first_doc_paragraph.stderr

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error: first doc comment paragraph is too long
22
--> tests/ui/too_long_first_doc_paragraph.rs:8:5
33
|
44
LL | / //! A very short summary.
5-
... |
5+
LL | | //! A much longer explanation that goes into a lot more detail about
6+
LL | | //! how the thing works, possibly with doclinks and so one,
7+
LL | | //! and probably spanning a many rows. Blablabla, it needs to be over
68
LL | | //! 200 characters so I needed to write something longeeeeeeer.
79
| |____^
810
|
@@ -27,7 +29,8 @@ error: first doc comment paragraph is too long
2729
--> tests/ui/too_long_first_doc_paragraph.rs:36:1
2830
|
2931
LL | / /// Lorem
30-
... |
32+
LL | | /// ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
33+
LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
3134
LL | | /// gravida non lacinia at, rhoncus eu lacus.
3235
| |_^
3336

0 commit comments

Comments
 (0)