This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 77b18b0
committed
Auto merge of rust-lang#123219 - fmease:rustdoc-variances-json, r=<try>
[WIP] rustdoc (base+json): add support for variances
I had this patch lying around for more than a month without much progress. Submitting this now to move things forward hopefully.
Addresses part of rust-lang#22108.
---
For transparency, I've stalled work on this because I haven't had the time to find ways to obtain or represent the “reason” / “provenance” of variances — a feature kindly requested by `@obi1kenobi,` maintainer of cargo-semver-checks. With “reason” we're referring to the set of constituent types that have had an influence on the variance of a given generic parameter.
This information could then be used in the diagnostics of cargo-semver-checks à la “variance of param `T` of ty `S` changed from covariant to contravariant because you changed the type of field `f` from `T` to `fn(T)”. On second thought, this seems like a major add-on and I fear that it's infeasible to implement this (smh. exposing the necessary info from rustc). On the other hand, this feature probably has a large impact on the design of the final API (i.e., how we represent variances in rustdoc JSON). I definitely don't want to hand-roll variance computation inside rustdoc.
---
TODOs:
* clean up the implementation (see individual FIXMEs)
* write docs for `rustdoc-json-types`
* add rustdoc JSON tests
r? ghostFile tree
9 files changed
+320
-198
lines changed- src
- librustdoc
- clean
- html
- json
- rustdoc-json-types
9 files changed
+320
-198
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
456 | 460 | | |
457 | 461 | | |
458 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
459 | 467 | | |
460 | 468 | | |
461 | 469 | | |
| |||
630 | 638 | | |
631 | 639 | | |
632 | 640 | | |
633 | | - | |
634 | | - | |
| 641 | + | |
| 642 | + | |
635 | 643 | | |
636 | | - | |
| 644 | + | |
637 | 645 | | |
638 | 646 | | |
639 | | - | |
| 647 | + | |
640 | 648 | | |
641 | 649 | | |
642 | 650 | | |
643 | | - | |
| 651 | + | |
644 | 652 | | |
645 | | - | |
| 653 | + | |
646 | 654 | | |
647 | 655 | | |
648 | 656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
288 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
289 | 293 | | |
290 | 294 | | |
291 | 295 | | |
| |||
317 | 321 | | |
318 | 322 | | |
319 | 323 | | |
320 | | - | |
| 324 | + | |
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
| |||
328 | 332 | | |
329 | 333 | | |
330 | 334 | | |
331 | | - | |
| 335 | + | |
332 | 336 | | |
333 | 337 | | |
334 | 338 | | |
| |||
337 | 341 | | |
338 | 342 | | |
339 | 343 | | |
340 | | - | |
| 344 | + | |
341 | 345 | | |
342 | 346 | | |
343 | 347 | | |
| |||
354 | 358 | | |
355 | 359 | | |
356 | 360 | | |
357 | | - | |
| 361 | + | |
358 | 362 | | |
359 | 363 | | |
360 | 364 | | |
| |||
532 | 536 | | |
533 | 537 | | |
534 | 538 | | |
535 | | - | |
| 539 | + | |
536 | 540 | | |
537 | 541 | | |
538 | 542 | | |
| |||
560 | 564 | | |
561 | 565 | | |
562 | 566 | | |
563 | | - | |
| 567 | + | |
564 | 568 | | |
565 | 569 | | |
566 | 570 | | |
| |||
718 | 722 | | |
719 | 723 | | |
720 | 724 | | |
721 | | - | |
722 | | - | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
723 | 731 | | |
724 | 732 | | |
725 | 733 | | |
| |||
0 commit comments