Skip to content

Commit 70863e2

Browse files
authoredMay 5, 2022
Rollup merge of rust-lang#96094 - Elliot-Roberts:fix_doctests, r=compiler-errors
Begin fixing all the broken doctests in `compiler/` Begins to fix rust-lang#95994. All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are. There are also a few that I marked `ignore` that could maybe be made to work but seem less important. Each `ignore` has a rough "reason" for ignoring after it parentheses, with - `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax" - `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy. - `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR. - `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup. Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful. I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
2 parents 30f3860 + 7907385 commit 70863e2

File tree

116 files changed

+666
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+666
-609
lines changed
 

‎compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ pub struct Block {
573573
pub span: Span,
574574
pub tokens: Option<LazyTokenStream>,
575575
/// The following *isn't* a parse error, but will cause multiple errors in following stages.
576-
/// ```
576+
/// ```compile_fail
577577
/// let x = {
578578
/// foo: var
579579
/// };

‎compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
616616
}
617617

618618
/// Desugar `<expr>.await` into:
619-
/// ```rust
619+
/// ```ignore (pseudo-rust)
620620
/// match ::std::future::IntoFuture::into_future(<expr>) {
621621
/// mut __awaitee => loop {
622622
/// match unsafe { ::std::future::Future::poll(
@@ -1363,7 +1363,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13631363
}
13641364

13651365
/// Desugar `ExprForLoop` from: `[opt_ident]: for <pat> in <head> <body>` into:
1366-
/// ```rust
1366+
/// ```ignore (pseudo-rust)
13671367
/// {
13681368
/// let result = match IntoIterator::into_iter(<head>) {
13691369
/// mut iter => {
@@ -1474,7 +1474,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14741474
}
14751475

14761476
/// Desugar `ExprKind::Try` from: `<expr>?` into:
1477-
/// ```rust
1477+
/// ```ignore (pseudo-rust)
14781478
/// match Try::branch(<expr>) {
14791479
/// ControlFlow::Continue(val) => #[allow(unreachable_code)] val,,
14801480
/// ControlFlow::Break(residual) =>

0 commit comments

Comments
 (0)