rust/src/test/rustdoc-ui
bors 846ea58cd5 Auto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavus
rustdoc: overhaul code block lexing errors

Fixes #53919.

This PR moves the reporting of code block lexing errors from rendering time to an early pass, so we can use the compiler's error reporting mechanisms. This dramatically improves the diagnostics in this situation: we now de-emphasize the lexing errors as a note under a warning that has a span and suggestion instead of just emitting errors at the top level.

Additionally, this PR generalizes the markdown -> source span calculation function, which should allow other rustdoc warnings to use better spans in the future.

Last, the PR makes sure that the code block is always emitted in the docs, even if it fails to highlight correctly.

Of note:
- The new pass unfortunately adds another pass over the docs to gather the doc blocks for syntax-checking. I wonder if this could be combined with the pass that looks for testable blocks? I'm not familiar with that code, so I don't know how feasible that is.
- `pulldown_cmark` doesn't make it easy to find the spans of the code blocks, so the code that calculates the spans is a little nasty. It works for all the test cases I threw at it, but I wouldn't be surprised if an edge case would break it. Should have a thorough review.
- This PR worsens the state of #56885, since those certain fatal lexing errors are now emitted before docs get generated at all.
2019-01-20 19:01:38 +00:00
..
.gitattributes fix intra-link resolution spans in block comments 2018-12-10 21:08:26 -05:00
deny-intra-link-resolution-failure.rs Remove licenses 2018-12-25 21:08:33 -07:00
deny-intra-link-resolution-failure.stderr Remove licenses 2018-12-25 21:08:33 -07:00
deny-missing-docs-crate.rs Removed more copyright notices. 2019-01-13 19:47:02 +00:00
deny-missing-docs-crate.stderr Removed more copyright notices. 2019-01-13 19:47:02 +00:00
deny-missing-docs-macro.rs Removed more copyright notices. 2019-01-13 19:47:02 +00:00
deny-missing-docs-macro.stderr Removed more copyright notices. 2019-01-13 19:47:02 +00:00
deprecated-attrs.rs Remove licenses 2018-12-25 21:08:33 -07:00
deprecated-attrs.stderr add -Zui-testing to rustdoc 2018-09-19 18:39:39 -05:00
doc-without-codeblock.rs Remove licenses 2018-12-25 21:08:33 -07:00
doc-without-codeblock.stderr Remove licenses 2018-12-25 21:08:33 -07:00
failed-doctest-output.rs Remove licenses 2018-12-25 21:08:33 -07:00
failed-doctest-output.stdout Bless test. 2019-01-17 17:49:29 -05:00
intra-doc-alias-ice.rs Remove licenses 2018-12-25 21:08:33 -07:00
intra-doc-alias-ice.stderr Remove licenses 2018-12-25 21:08:33 -07:00
intra-link-span-ice-55723.rs Remove licenses 2018-12-25 21:08:33 -07:00
intra-link-span-ice-55723.stderr Remove licenses 2018-12-25 21:08:33 -07:00
intra-links-warning-crlf.rs fix intra-link resolution spans in block comments 2018-12-10 21:08:26 -05:00
intra-links-warning-crlf.stderr fix intra-link resolution spans in block comments 2018-12-10 21:08:26 -05:00
intra-links-warning.rs Remove licenses 2018-12-25 21:08:33 -07:00
intra-links-warning.stderr Remove licenses 2018-12-25 21:08:33 -07:00
invalid-syntax.rs rustdoc: check code block syntax in early pass 2019-01-14 21:21:21 -05:00
invalid-syntax.stderr rustdoc: check code block syntax in early pass 2019-01-14 21:21:21 -05:00
lint-group.rs Remove licenses 2018-12-25 21:08:33 -07:00
lint-group.stderr Remove licenses 2018-12-25 21:08:33 -07:00
private-item-doc-test.rs Remove licenses 2018-12-25 21:08:33 -07:00
private-item-doc-test.stderr Remove licenses 2018-12-25 21:08:33 -07:00
unused.rs Remove licenses 2018-12-25 21:08:33 -07:00