]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_middle/src/ty/subst.rs
fix most compiler/ doctests
[rust.git] / compiler / rustc_middle / src / ty / subst.rs
index 46b938ea93baa0ab7bfa5218eac13c1b7e92ef09..5063420e975d14663721f6adc9c0229e732130ea 100644 (file)
@@ -687,17 +687,17 @@ fn const_for_param(&self, p: ParamConst, source_ct: ty::Const<'tcx>) -> ty::Cons
     ///
     /// ```
     /// type Func<A> = fn(A);
-    /// type MetaFunc = for<'a> fn(Func<&'a i32>)
+    /// type MetaFunc = for<'a> fn(Func<&'a i32>);
     /// ```
     ///
     /// The type `MetaFunc`, when fully expanded, will be
-    ///
-    ///     for<'a> fn(fn(&'a i32))
-    ///             ^~ ^~ ^~~
-    ///             |  |  |
-    ///             |  |  DebruijnIndex of 2
-    ///             Binders
-    ///
+    /// ```ignore (illustrative)
+    /// for<'a> fn(fn(&'a i32))
+    /// //      ^~ ^~ ^~~
+    /// //      |  |  |
+    /// //      |  |  DebruijnIndex of 2
+    /// //      Binders
+    /// ```
     /// Here the `'a` lifetime is bound in the outer function, but appears as an argument of the
     /// inner one. Therefore, that appearance will have a DebruijnIndex of 2, because we must skip
     /// over the inner binder (remember that we count De Bruijn indices from 1). However, in the
@@ -709,17 +709,17 @@ fn const_for_param(&self, p: ParamConst, source_ct: ty::Const<'tcx>) -> ty::Cons
     ///
     /// ```
     /// type FuncTuple<A> = (A,fn(A));
-    /// type MetaFuncTuple = for<'a> fn(FuncTuple<&'a i32>)
+    /// type MetaFuncTuple = for<'a> fn(FuncTuple<&'a i32>);
     /// ```
     ///
     /// Here the final type will be:
-    ///
-    ///     for<'a> fn((&'a i32, fn(&'a i32)))
-    ///                 ^~~         ^~~
-    ///                 |           |
-    ///          DebruijnIndex of 1 |
-    ///                      DebruijnIndex of 2
-    ///
+    /// ```ignore (illustrative)
+    /// for<'a> fn((&'a i32, fn(&'a i32)))
+    /// //          ^~~         ^~~
+    /// //          |           |
+    /// //   DebruijnIndex of 1 |
+    /// //               DebruijnIndex of 2
+    /// ```
     /// As indicated in the diagram, here the same type `&'a i32` is substituted once, but in the
     /// first case we do not increase the De Bruijn index and in the second case we do. The reason
     /// is that only in the second case have we passed through a fn binder.
@@ -767,7 +767,7 @@ pub struct UserSubsts<'tcx> {
 /// sometimes needed to constrain the type parameters on the impl. For
 /// example, in this code:
 ///
-/// ```
+/// ```ignore (illustrative)
 /// struct Foo<T> { }
 /// impl<A> Foo<A> { fn method() { } }
 /// ```