Skip to content

Commit cbb32a9

Browse files
committed
Fix docs for future pulldown migration
1 parent 8395798 commit cbb32a9

File tree

26 files changed

+128
-94
lines changed

26 files changed

+128
-94
lines changed

src/libarena/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,11 @@ impl<T> TypedArena<T> {
148148
}
149149
}
150150

151-
/// Allocates a slice of objects that are copy into the `TypedArena`, returning a mutable
151+
/// Allocates a slice of objects that are copied into the `TypedArena`, returning a mutable
152152
/// reference to it. Will panic if passed a zero-sized types.
153153
///
154154
/// Panics:
155+
///
155156
/// - Zero-sized types
156157
/// - Zero-length slices
157158
#[inline]
@@ -369,6 +370,7 @@ impl DroplessArena {
369370
/// reference to it. Will panic if passed a zero-sized type.
370371
///
371372
/// Panics:
373+
///
372374
/// - Zero-sized types
373375
/// - Zero-length slices
374376
#[inline]

src/libgraphviz/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ pub enum LabelText<'a> {
306306
LabelStr(Cow<'a, str>),
307307

308308
/// This kind of label uses the graphviz label escString type:
309-
/// http://www.graphviz.org/content/attrs#kescString
309+
/// <http://www.graphviz.org/content/attrs#kescString>
310310
///
311311
/// Occurrences of backslashes (`\`) are not escaped; instead they
312312
/// are interpreted as initiating an escString escape sequence.
@@ -326,7 +326,7 @@ pub enum LabelText<'a> {
326326
}
327327

328328
/// The style for a node or edge.
329-
/// See http://www.graphviz.org/doc/info/attrs.html#k:style for descriptions.
329+
/// See <http://www.graphviz.org/doc/info/attrs.html#k:style> for descriptions.
330330
/// Note that some of these are not valid for edges.
331331
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
332332
pub enum Style {

src/librustc/dep_graph/dep_tracking_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<M: DepTrackingMapConfig> MemoizationMap for RefCell<DepTrackingMap<M>> {
5656
/// map; and `CurrentTask` represents the current task when
5757
/// `memoize` is invoked.
5858
///
59-
/// **Important:* when `op` is invoked, the current task will be
59+
/// **Important:** when `op` is invoked, the current task will be
6060
/// switched to `Map(key)`. Therefore, if `op` makes use of any
6161
/// HIR nodes or shared state accessed through its closure
6262
/// environment, it must explicitly register a read of that

src/librustc/hir/def.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ pub enum Def {
7171
/// `base_def` is definition of resolved part of the
7272
/// path, `unresolved_segments` is the number of unresolved
7373
/// segments.
74-
/// module::Type::AssocX::AssocY::MethodOrAssocType
75-
/// ^~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76-
/// base_def unresolved_segments = 3
7774
///
78-
/// <T as Trait>::AssocX::AssocY::MethodOrAssocType
79-
/// ^~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
80-
/// base_def unresolved_segments = 2
75+
/// ```text
76+
/// module::Type::AssocX::AssocY::MethodOrAssocType
77+
/// ^~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78+
/// base_def unresolved_segments = 3
79+
///
80+
/// <T as Trait>::AssocX::AssocY::MethodOrAssocType
81+
/// ^~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
82+
/// base_def unresolved_segments = 2
83+
/// ```
8184
#[derive(Copy, Clone, Debug)]
8285
pub struct PathResolution {
8386
base_def: Def,

src/librustc/hir/map/blocks.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use syntax_pos::Span;
3333
/// and a body (as well as a NodeId, a span, etc).
3434
///
3535
/// More specifically, it is one of either:
36+
///
3637
/// - A function item,
3738
/// - A closure expr (i.e. an ExprClosure), or
3839
/// - The default implementation for a trait method.

src/librustc/infer/anon_types/mod.rs

+31-17
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,25 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
147147
/// Let's work through an example to explain how it works. Assume
148148
/// the current function is as follows:
149149
///
150-
/// fn foo<'a, 'b>(..) -> (impl Bar<'a>, impl Bar<'b>)
150+
/// ```text
151+
/// fn foo<'a, 'b>(..) -> (impl Bar<'a>, impl Bar<'b>)
152+
/// ```
151153
///
152154
/// Here, we have two `impl Trait` types whose values are being
153155
/// inferred (the `impl Bar<'a>` and the `impl
154156
/// Bar<'b>`). Conceptually, this is sugar for a setup where we
155157
/// define underlying abstract types (`Foo1`, `Foo2`) and then, in
156158
/// the return type of `foo`, we *reference* those definitions:
157159
///
158-
/// abstract type Foo1<'x>: Bar<'x>;
159-
/// abstract type Foo2<'x>: Bar<'x>;
160-
/// fn foo<'a, 'b>(..) -> (Foo1<'a>, Foo2<'b>) { .. }
161-
/// // ^^^^ ^^
162-
/// // | |
163-
/// // | substs
164-
/// // def_id
160+
/// ```text
161+
/// abstract type Foo1<'x>: Bar<'x>;
162+
/// abstract type Foo2<'x>: Bar<'x>;
163+
/// fn foo<'a, 'b>(..) -> (Foo1<'a>, Foo2<'b>) { .. }
164+
/// // ^^^^ ^^
165+
/// // | |
166+
/// // | substs
167+
/// // def_id
168+
/// ```
165169
///
166170
/// As indicating in the comments above, each of those references
167171
/// is (in the compiler) basically a substitution (`substs`)
@@ -175,8 +179,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
175179
/// `Foo2`. That is, this gives rise to higher-order (pattern) unification
176180
/// constraints like:
177181
///
178-
/// for<'a> (Foo1<'a> = C1)
179-
/// for<'b> (Foo1<'b> = C2)
182+
/// ```text
183+
/// for<'a> (Foo1<'a> = C1)
184+
/// for<'b> (Foo1<'b> = C2)
185+
/// ```
180186
///
181187
/// For these equation to be satisfiable, the types `C1` and `C2`
182188
/// can only refer to a limited set of regions. For example, `C1`
@@ -189,15 +195,19 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
189195
/// regions. In fact, it is fairly likely that they do! Consider
190196
/// this possible definition of `foo`:
191197
///
192-
/// fn foo<'a, 'b>(x: &'a i32, y: &'b i32) -> (impl Bar<'a>, impl Bar<'b>) {
198+
/// ```text
199+
/// fn foo<'a, 'b>(x: &'a i32, y: &'b i32) -> (impl Bar<'a>, impl Bar<'b>) {
193200
/// (&*x, &*y)
194201
/// }
202+
/// ```
195203
///
196204
/// Here, the values for the concrete types of the two impl
197205
/// traits will include inference variables:
198206
///
199-
/// &'0 i32
200-
/// &'1 i32
207+
/// ```text
208+
/// &'0 i32
209+
/// &'1 i32
210+
/// ```
201211
///
202212
/// Ordinarily, the subtyping rules would ensure that these are
203213
/// sufficiently large. But since `impl Bar<'a>` isn't a specific
@@ -207,7 +217,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
207217
/// inferred type are regions that could validly appear.
208218
///
209219
/// This is actually a bit of a tricky constraint in general. We
210-
/// want to say that each variable (e.g., `'0``) can only take on
220+
/// want to say that each variable (e.g., `'0`) can only take on
211221
/// values that were supplied as arguments to the abstract type
212222
/// (e.g., `'a` for `Foo1<'a>`) or `'static`, which is always in
213223
/// scope. We don't have a constraint quite of this kind in the current
@@ -225,7 +235,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
225235
///
226236
/// In some cases, there is no minimum. Consider this example:
227237
///
228-
/// fn baz<'a, 'b>() -> impl Trait<'a, 'b> { ... }
238+
/// ```text
239+
/// fn baz<'a, 'b>() -> impl Trait<'a, 'b> { ... }
240+
/// ```
229241
///
230242
/// Here we would report an error, because `'a` and `'b` have no
231243
/// relation to one another.
@@ -245,8 +257,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
245257
/// which is the current function. It also means that we can
246258
/// take "implied bounds" into account in some cases:
247259
///
248-
/// trait SomeTrait<'a, 'b> { }
249-
/// fn foo<'a, 'b>(_: &'a &'b u32) -> impl SomeTrait<'a, 'b> { .. }
260+
/// ```text
261+
/// trait SomeTrait<'a, 'b> { }
262+
/// fn foo<'a, 'b>(_: &'a &'b u32) -> impl SomeTrait<'a, 'b> { .. }
263+
/// ```
250264
///
251265
/// Here, the fact that `'b: 'a` is known only because of the
252266
/// implied bounds from the `&'a &'b u32` parameter, and is not

src/librustc/middle/region.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
5353
/// expression for the indexed statement, until the end of the block.
5454
///
5555
/// So: the following code can be broken down into the scopes beneath:
56-
/// ```
56+
///
57+
/// ```text
5758
/// let a = f().g( 'b: { let x = d(); let y = d(); x.h(y) } ) ;
58-
/// ```
5959
///
6060
/// +-+ (D12.)
6161
/// +-+ (D11.)
@@ -82,6 +82,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
8282
/// (R10.): Remainder scope for block `'b:`, stmt 1 (let y = ...).
8383
/// (D11.): DestructionScope for temporaries and bindings from block `'b:`.
8484
/// (D12.): DestructionScope for temporaries created during M1 (e.g. f()).
85+
/// ```
8586
///
8687
/// Note that while the above picture shows the destruction scopes
8788
/// as following their corresponding node scopes, in the internal

src/librustc/mir/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ pub struct LocalDecl<'tcx> {
497497
///
498498
/// That's it, if we have a let-statement like the one in this
499499
/// function:
500+
///
500501
/// ```
501502
/// fn foo(x: &str) {
502503
/// #[allow(unused_mut)]
@@ -540,6 +541,7 @@ pub struct LocalDecl<'tcx> {
540541
///
541542
/// The end result looks like this:
542543
///
544+
/// ```text
543545
/// ROOT SCOPE
544546
/// │{ argument x: &str }
545547
/// │
@@ -559,6 +561,7 @@ pub struct LocalDecl<'tcx> {
559561
/// │ │{ let x: u32 }
560562
/// │ │← x.source_info.scope
561563
/// │ │← `drop(x)` // this accesses `x: u32`
564+
/// ```
562565
pub syntactic_scope: VisibilityScope,
563566
}
564567

src/librustc/traits/select.rs

+1
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
906906
/// For defaulted traits, we use a co-inductive strategy to solve, so
907907
/// that recursion is ok. This routine returns true if the top of the
908908
/// stack (`cycle[0]`):
909+
///
909910
/// - is a defaulted trait, and
910911
/// - it also appears in the backtrace at some position `X`; and,
911912
/// - all the predicates at positions `X..` between `X` an the top are

src/librustc/ty/adjustment.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,38 @@ use ty::subst::Substs;
2222
/// Here are some common scenarios:
2323
///
2424
/// 1. The simplest cases are where a pointer is not adjusted fat vs thin.
25-
/// Here the pointer will be dereferenced N times (where a dereference can
26-
/// happen to raw or borrowed pointers or any smart pointer which implements
27-
/// Deref, including Box<_>). The types of dereferences is given by
28-
/// `autoderefs`. It can then be auto-referenced zero or one times, indicated
29-
/// by `autoref`, to either a raw or borrowed pointer. In these cases unsize is
30-
/// `false`.
25+
/// Here the pointer will be dereferenced N times (where a dereference can
26+
/// happen to raw or borrowed pointers or any smart pointer which implements
27+
/// Deref, including Box<_>). The types of dereferences is given by
28+
/// `autoderefs`. It can then be auto-referenced zero or one times, indicated
29+
/// by `autoref`, to either a raw or borrowed pointer. In these cases unsize is
30+
/// `false`.
3131
///
3232
/// 2. A thin-to-fat coercion involves unsizing the underlying data. We start
33-
/// with a thin pointer, deref a number of times, unsize the underlying data,
34-
/// then autoref. The 'unsize' phase may change a fixed length array to a
35-
/// dynamically sized one, a concrete object to a trait object, or statically
36-
/// sized struct to a dynamically sized one. E.g., &[i32; 4] -> &[i32] is
37-
/// represented by:
33+
/// with a thin pointer, deref a number of times, unsize the underlying data,
34+
/// then autoref. The 'unsize' phase may change a fixed length array to a
35+
/// dynamically sized one, a concrete object to a trait object, or statically
36+
/// sized struct to a dynamically sized one. E.g., &[i32; 4] -> &[i32] is
37+
/// represented by:
3838
///
39-
/// ```
40-
/// Deref(None) -> [i32; 4],
41-
/// Borrow(AutoBorrow::Ref) -> &[i32; 4],
42-
/// Unsize -> &[i32],
43-
/// ```
39+
/// ```
40+
/// Deref(None) -> [i32; 4],
41+
/// Borrow(AutoBorrow::Ref) -> &[i32; 4],
42+
/// Unsize -> &[i32],
43+
/// ```
4444
///
45-
/// Note that for a struct, the 'deep' unsizing of the struct is not recorded.
46-
/// E.g., `struct Foo<T> { x: T }` we can coerce &Foo<[i32; 4]> to &Foo<[i32]>
47-
/// The autoderef and -ref are the same as in the above example, but the type
48-
/// stored in `unsize` is `Foo<[i32]>`, we don't store any further detail about
49-
/// the underlying conversions from `[i32; 4]` to `[i32]`.
45+
/// Note that for a struct, the 'deep' unsizing of the struct is not recorded.
46+
/// E.g., `struct Foo<T> { x: T }` we can coerce &Foo<[i32; 4]> to &Foo<[i32]>
47+
/// The autoderef and -ref are the same as in the above example, but the type
48+
/// stored in `unsize` is `Foo<[i32]>`, we don't store any further detail about
49+
/// the underlying conversions from `[i32; 4]` to `[i32]`.
5050
///
5151
/// 3. Coercing a `Box<T>` to `Box<Trait>` is an interesting special case. In
52-
/// that case, we have the pointer we need coming in, so there are no
53-
/// autoderefs, and no autoref. Instead we just do the `Unsize` transformation.
54-
/// At some point, of course, `Box` should move out of the compiler, in which
55-
/// case this is analogous to transforming a struct. E.g., Box<[i32; 4]> ->
56-
/// Box<[i32]> is an `Adjust::Unsize` with the target `Box<[i32]>`.
52+
/// that case, we have the pointer we need coming in, so there are no
53+
/// autoderefs, and no autoref. Instead we just do the `Unsize` transformation.
54+
/// At some point, of course, `Box` should move out of the compiler, in which
55+
/// case this is analogous to transforming a struct. E.g., Box<[i32; 4]> ->
56+
/// Box<[i32]> is an `Adjust::Unsize` with the target `Box<[i32]>`.
5757
#[derive(Clone, RustcEncodable, RustcDecodable)]
5858
pub struct Adjustment<'tcx> {
5959
pub kind: Adjust<'tcx>,

src/librustc/ty/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub enum InstanceDef<'tcx> {
2828
Item(DefId),
2929
Intrinsic(DefId),
3030

31-
/// <fn() as FnTrait>::call_*
31+
/// \<fn() as FnTrait>::call_*
3232
/// def-id is FnTrait::call_*
3333
FnPtrShim(DefId, Ty<'tcx>),
3434

src/librustc/ty/layout.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ impl AddAssign for Size {
340340

341341
/// Alignment of a type in bytes, both ABI-mandated and preferred.
342342
/// Each field is a power of two, giving the alignment a maximum
343-
/// value of 2^(2^8 - 1), which is limited by LLVM to a i32, with
344-
/// a maximum capacity of 2^31 - 1 or 2147483647.
343+
/// value of 2<sup>(2<sup>8</sup> - 1)</sup>, which is limited by LLVM to a i32, with
344+
/// a maximum capacity of 2<sup>31</sup> - 1 or 2147483647.
345345
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
346346
pub struct Align {
347347
abi: u8,
@@ -651,11 +651,13 @@ impl Scalar {
651651
}
652652

653653
/// The first half of a fat pointer.
654+
///
654655
/// - For a trait object, this is the address of the box.
655656
/// - For a slice, this is the base address.
656657
pub const FAT_PTR_ADDR: usize = 0;
657658

658659
/// The second half of a fat pointer.
660+
///
659661
/// - For a trait object, this is the address of the vtable.
660662
/// - For a slice, this is the length.
661663
pub const FAT_PTR_EXTRA: usize = 1;

src/librustc/ty/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1098,8 +1098,8 @@ pub type PolySubtypePredicate<'tcx> = ty::Binder<SubtypePredicate<'tcx>>;
10981098
/// In particular, form #1 is "desugared" to the combination of a
10991099
/// normal trait predicate (`T : TraitRef<...>`) and one of these
11001100
/// predicates. Form #2 is a broader form in that it also permits
1101-
/// equality between arbitrary types. Processing an instance of Form
1102-
/// #2 eventually yields one of these `ProjectionPredicate`
1101+
/// equality between arbitrary types. Processing an instance of
1102+
/// Form #2 eventually yields one of these `ProjectionPredicate`
11031103
/// instances to normalize the LHS.
11041104
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
11051105
pub struct ProjectionPredicate<'tcx> {
@@ -1401,7 +1401,7 @@ bitflags! {
14011401
/// fields/variants) and as such, whether downstream crates must match exhaustively on the
14021402
/// fields/variants of this data type.
14031403
///
1404-
/// See RFC 2008 (https://github.com/rust-lang/rfcs/pull/2008).
1404+
/// See RFC 2008 (<https://github.com/rust-lang/rfcs/pull/2008>).
14051405
const IS_NON_EXHAUSTIVE = 1 << 5;
14061406
}
14071407
}

src/librustc/ty/sty.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ impl<T> Binder<T> {
673673
/// accounting.
674674
///
675675
/// Some examples where `skip_binder` is reasonable:
676+
///
676677
/// - extracting the def-id from a PolyTraitRef;
677678
/// - comparing the self type of a PolyTraitRef to see if it is equal to
678679
/// a type parameter `X`, since the type `X` does not reference any regions
@@ -992,8 +993,8 @@ pub type Region<'tcx> = &'tcx RegionKind;
992993
/// happen, you can use `leak_check`. This is more clearly explained
993994
/// by infer/higher_ranked/README.md.
994995
///
995-
/// [1] http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/
996-
/// [2] http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
996+
/// [1]: http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/
997+
/// [2]: http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
997998
#[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)]
998999
pub enum RegionKind {
9991000
// Region bound in a type or fn declaration which will be

src/librustc_apfloat/ieee.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ pub trait Semantics: Sized {
6565
/// Number of bits in the significand. This includes the integer bit.
6666
const PRECISION: usize;
6767

68-
/// The largest E such that 2^E is representable; this matches the
68+
/// The largest E such that 2<sup>E</sup> is representable; this matches the
6969
/// definition of IEEE 754.
7070
const MAX_EXP: ExpInt;
7171

72-
/// The smallest E such that 2^E is a normalized number; this
72+
/// The smallest E such that 2<sup>E</sup> is a normalized number; this
7373
/// matches the definition of IEEE 754.
7474
const MIN_EXP: ExpInt = -Self::MAX_EXP + 1;
7575

@@ -2608,7 +2608,7 @@ mod sig {
26082608
///
26092609
/// `(n - 1) * (n - 1) + 2 * (n - 1) == (n - 1) * (n + 1)`
26102610
///
2611-
/// which is less than n^2.
2611+
/// which is less than n<sup>2</sup>.
26122612
pub(super) fn widening_mul(a: Limb, b: Limb) -> [Limb; 2] {
26132613
let mut wide = [0, 0];
26142614

0 commit comments

Comments
 (0)