Skip to content

Commit 84f6440

Browse files
committed
Rollup merge of #49654 - davidtwco:issue-29893, r=alexcrichton
Host compiler documentation: Include private items Fixes #29893. Now that compiler documentation is being hosted, including private items seems sensible as these types are going to be being used by contributors working on the compiler. However, including this means that doc comments that contain codeblocks with invalid Rust and can fail the documenting of a given crate (as evidenced by the changes in the second commit included in this PR). We'd need some way of ensuring that this cannot happen so that these failures don't cause documenting to fail. I'm unsure whether this change to documentation steps will cause this to happen already or if something new will be required. r? @alexcrichton
2 parents b146e33 + 809d01c commit 84f6440

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

src/bootstrap/doc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ impl Step for Rustc {
698698
t!(symlink_dir_force(&builder.config, &out, &out_dir));
699699

700700
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
701+
cargo.env("RUSTDOCFLAGS", "--document-private-items");
701702
compile::rustc_cargo(build, &mut cargo);
702703

703704
// Only include compiler crates, no dependencies of those, such as `libc`.

src/librustc/middle/region.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ pub struct ScopeTree {
353353
/// the result of `g()` occurs after the yield (and therefore
354354
/// doesn't). If we want to infer that, we can look at the
355355
/// postorder traversal:
356-
/// ```
357-
/// `foo` `f` Call#1 `y` Yield `bar` `g` Call#3 Call#2 Call#0
356+
/// ```plain,ignore
357+
/// `foo` `f` Call#1 `y` Yield `bar` `g` Call#3 Call#2 Call#0
358358
/// ```
359359
///
360360
/// In which we can easily see that `Call#1` occurs before the yield,

src/librustc/traits/select.rs

+2
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,9 @@ enum EvaluationResult {
362362
/// When checking `foo`, we have to prove `T: Trait`. This basically
363363
/// translates into this:
364364
///
365+
/// ```plain,ignore
365366
/// (T: Trait + Sized →_\impl T: Trait), T: Trait ⊢ T: Trait
367+
/// ```
366368
///
367369
/// When we try to prove it, we first go the first option, which
368370
/// recurses. This shows us that the impl is "useless" - it won't

src/librustc_resolve/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -427,14 +427,14 @@ fn generate_fn_name_span(cm: &CodeMap, span: Span) -> Option<Span> {
427427
/// a new local type parameter.
428428
///
429429
/// For instance:
430-
/// ```
430+
/// ```rust,ignore (pseudo-Rust)
431431
/// // Given span
432432
/// fn my_function(param: T)
433-
/// ^ Original span
433+
/// // ^ Original span
434434
///
435435
/// // Result
436436
/// fn my_function(param: T)
437-
/// ^^^^^^^^^^^ Generated span with snippet `my_function<T>`
437+
/// // ^^^^^^^^^^^ Generated span with snippet `my_function<T>`
438438
/// ```
439439
///
440440
/// Attention: The method used is very fragile since it essentially duplicates the work of the

src/librustc_typeck/check/regionck.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1164,10 +1164,12 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> {
11641164
/// constraint that `'z <= 'a`. Given this setup, let's clarify the
11651165
/// parameters in (roughly) terms of the example:
11661166
///
1167+
/// ```plain,ignore (pseudo-Rust)
11671168
/// A borrow of: `& 'z bk * r` where `r` has type `& 'a bk T`
11681169
/// borrow_region ^~ ref_region ^~
11691170
/// borrow_kind ^~ ref_kind ^~
11701171
/// ref_cmt ^
1172+
/// ```
11711173
///
11721174
/// Here `bk` stands for some borrow-kind (e.g., `mut`, `uniq`, etc).
11731175
///

src/librustc_typeck/impl_wf_check.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ use syntax_pos::Span;
4242
///
4343
/// Example:
4444
///
45-
/// ```
45+
/// ```rust,ignore (pseudo-Rust)
4646
/// impl<T> Trait<Foo> for Bar { ... }
47-
/// ^ T does not appear in `Foo` or `Bar`, error!
47+
/// // ^ T does not appear in `Foo` or `Bar`, error!
4848
///
4949
/// impl<T> Trait<Foo<T>> for Bar { ... }
50-
/// ^ T appears in `Foo<T>`, ok.
50+
/// // ^ T appears in `Foo<T>`, ok.
5151
///
5252
/// impl<T> Trait<Foo> for Bar where Bar: Iterator<Item=T> { ... }
53-
/// ^ T is bound to `<Bar as Iterator>::Item`, ok.
53+
/// // ^ T is bound to `<Bar as Iterator>::Item`, ok.
5454
///
5555
/// impl<'a> Trait<Foo> for Bar { }
56-
/// ^ 'a is unused, but for back-compat we allow it
56+
/// // ^ 'a is unused, but for back-compat we allow it
5757
///
5858
/// impl<'a> Trait<Foo> for Bar { type X = &'a i32; }
59-
/// ^ 'a is unused and appears in assoc type, error
59+
/// // ^ 'a is unused and appears in assoc type, error
6060
/// ```
6161
pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
6262
// We will tag this as part of the WF check -- logically, it is,

0 commit comments

Comments
 (0)