]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #49654 - davidtwco:issue-29893, r=alexcrichton
authorkennytm <kennytm@gmail.com>
Thu, 5 Apr 2018 08:51:25 +0000 (16:51 +0800)
committerkennytm <kennytm@gmail.com>
Thu, 5 Apr 2018 10:37:28 +0000 (18:37 +0800)
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

src/bootstrap/doc.rs
src/librustc/middle/region.rs
src/librustc/traits/select.rs
src/librustc_resolve/lib.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/impl_wf_check.rs

index f07c3e707574b4e4a051fc6e9b1f9e0950b82917..4237ded2215c218e4fd8ed16e4d7d4a795fecc4b 100644 (file)
@@ -698,6 +698,7 @@ fn run(self, builder: &Builder) {
         t!(symlink_dir_force(&builder.config, &out, &out_dir));
 
         let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
+        cargo.env("RUSTDOCFLAGS", "--document-private-items");
         compile::rustc_cargo(build, &mut cargo);
 
         // Only include compiler crates, no dependencies of those, such as `libc`.
index c7396b34c4689548bd413d4ec8e71b24268105a2..7e1b7c08c3dad99fc22c4566c84cf15a3e78082e 100644 (file)
@@ -353,8 +353,8 @@ pub struct ScopeTree {
     /// the result of `g()` occurs after the yield (and therefore
     /// doesn't). If we want to infer that, we can look at the
     /// postorder traversal:
-    /// ```
-    /// `foo` `f` Call#1 `y` Yield `bar` `g` Call#3 Call#2 Call#0
+    /// ```plain,ignore
+    ///     `foo` `f` Call#1 `y` Yield `bar` `g` Call#3 Call#2 Call#0
     /// ```
     ///
     /// In which we can easily see that `Call#1` occurs before the yield,
index bbd428611874ae2d994cbcd90ebe1eeb4181023c..b1649686323f8750e09e47f33be76fdf28a7f839 100644 (file)
@@ -362,7 +362,9 @@ enum EvaluationResult {
     /// When checking `foo`, we have to prove `T: Trait`. This basically
     /// translates into this:
     ///
+    /// ```plain,ignore
     ///     (T: Trait + Sized →_\impl T: Trait), T: Trait ⊢ T: Trait
+    /// ```
     ///
     /// When we try to prove it, we first go the first option, which
     /// recurses. This shows us that the impl is "useless" - it won't
index 97dcf081f8c8d8f85a7626ada6e8260366895a2e..3a97d2767444bc065f75555a8c9c4e468bcf1ed5 100644 (file)
@@ -427,14 +427,14 @@ fn generate_fn_name_span(cm: &CodeMap, span: Span) -> Option<Span> {
 /// a new local type parameter.
 ///
 /// For instance:
-/// ```
+/// ```rust,ignore (pseudo-Rust)
 /// // Given span
 /// fn my_function(param: T)
-///                       ^ Original span
+/// //                    ^ Original span
 ///
 /// // Result
 /// fn my_function(param: T)
-///    ^^^^^^^^^^^ Generated span with snippet `my_function<T>`
+/// // ^^^^^^^^^^^ Generated span with snippet `my_function<T>`
 /// ```
 ///
 /// Attention: The method used is very fragile since it essentially duplicates the work of the
index 9ed4ab45a1ba7dd19c22d9a5e3ebd95e76107e9f..b5e862fac958a027089e068924fffdf6440e3a31 100644 (file)
@@ -1164,10 +1164,12 @@ fn link_region(&self,
     /// constraint that `'z <= 'a`. Given this setup, let's clarify the
     /// parameters in (roughly) terms of the example:
     ///
+    /// ```plain,ignore (pseudo-Rust)
     ///     A borrow of: `& 'z bk * r` where `r` has type `& 'a bk T`
     ///     borrow_region   ^~                 ref_region    ^~
     ///     borrow_kind        ^~               ref_kind        ^~
     ///     ref_cmt                 ^
+    /// ```
     ///
     /// Here `bk` stands for some borrow-kind (e.g., `mut`, `uniq`, etc).
     ///
index 1eed1bf4b71fb58e19496d11e9a15ea555210eba..faf3ccb1133adcb89c9a18a168d0120f8aa5a228 100644 (file)
 ///
 /// Example:
 ///
-/// ```
+/// ```rust,ignore (pseudo-Rust)
 /// impl<T> Trait<Foo> for Bar { ... }
-///      ^ T does not appear in `Foo` or `Bar`, error!
+/// //   ^ T does not appear in `Foo` or `Bar`, error!
 ///
 /// impl<T> Trait<Foo<T>> for Bar { ... }
-///      ^ T appears in `Foo<T>`, ok.
+/// //   ^ T appears in `Foo<T>`, ok.
 ///
 /// impl<T> Trait<Foo> for Bar where Bar: Iterator<Item=T> { ... }
-///      ^ T is bound to `<Bar as Iterator>::Item`, ok.
+/// //   ^ T is bound to `<Bar as Iterator>::Item`, ok.
 ///
 /// impl<'a> Trait<Foo> for Bar { }
-///      ^ 'a is unused, but for back-compat we allow it
+/// //   ^ 'a is unused, but for back-compat we allow it
 ///
 /// impl<'a> Trait<Foo> for Bar { type X = &'a i32; }
-///      ^ 'a is unused and appears in assoc type, error
+/// //   ^ 'a is unused and appears in assoc type, error
 /// ```
 pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     // We will tag this as part of the WF check -- logically, it is,