diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 2be7b1bc2e1..e635df52040 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -148,10 +148,11 @@ impl TypedArena { } } - /// Allocates a slice of objects that are copy into the `TypedArena`, returning a mutable + /// Allocates a slice of objects that are copied into the `TypedArena`, returning a mutable /// reference to it. Will panic if passed a zero-sized types. /// /// Panics: + /// /// - Zero-sized types /// - Zero-length slices #[inline] @@ -369,6 +370,7 @@ impl DroplessArena { /// reference to it. Will panic if passed a zero-sized type. /// /// Panics: + /// /// - Zero-sized types /// - Zero-length slices #[inline] diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 110493bbec1..cd893b9784a 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -306,7 +306,7 @@ pub enum LabelText<'a> { LabelStr(Cow<'a, str>), /// This kind of label uses the graphviz label escString type: - /// http://www.graphviz.org/content/attrs#kescString + /// /// /// Occurrences of backslashes (`\`) are not escaped; instead they /// are interpreted as initiating an escString escape sequence. @@ -326,7 +326,7 @@ pub enum LabelText<'a> { } /// The style for a node or edge. -/// See http://www.graphviz.org/doc/info/attrs.html#k:style for descriptions. +/// See for descriptions. /// Note that some of these are not valid for edges. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Style { diff --git a/src/librustc/dep_graph/dep_tracking_map.rs b/src/librustc/dep_graph/dep_tracking_map.rs index 2d19b34c504..7e46c202a84 100644 --- a/src/librustc/dep_graph/dep_tracking_map.rs +++ b/src/librustc/dep_graph/dep_tracking_map.rs @@ -56,7 +56,7 @@ impl MemoizationMap for RefCell> { /// map; and `CurrentTask` represents the current task when /// `memoize` is invoked. /// - /// **Important:* when `op` is invoked, the current task will be + /// **Important:** when `op` is invoked, the current task will be /// switched to `Map(key)`. Therefore, if `op` makes use of any /// HIR nodes or shared state accessed through its closure /// environment, it must explicitly register a read of that diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index 57a7e6c9904..8e4a4d32c0b 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -71,13 +71,16 @@ pub enum Def { /// `base_def` is definition of resolved part of the /// path, `unresolved_segments` is the number of unresolved /// segments. -/// module::Type::AssocX::AssocY::MethodOrAssocType -/// ^~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/// base_def unresolved_segments = 3 /// -/// ::AssocX::AssocY::MethodOrAssocType -/// ^~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~ -/// base_def unresolved_segments = 2 +/// ```text +/// module::Type::AssocX::AssocY::MethodOrAssocType +/// ^~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// base_def unresolved_segments = 3 +/// +/// ::AssocX::AssocY::MethodOrAssocType +/// ^~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~ +/// base_def unresolved_segments = 2 +/// ``` #[derive(Copy, Clone, Debug)] pub struct PathResolution { base_def: Def, diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index d2888dcf6aa..1eaacdb1d7f 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -33,6 +33,7 @@ use syntax_pos::Span; /// and a body (as well as a NodeId, a span, etc). /// /// More specifically, it is one of either: +/// /// - A function item, /// - A closure expr (i.e. an ExprClosure), or /// - The default implementation for a trait method. diff --git a/src/librustc/infer/anon_types/mod.rs b/src/librustc/infer/anon_types/mod.rs index be5314a2c17..f5b88dbc2a9 100644 --- a/src/librustc/infer/anon_types/mod.rs +++ b/src/librustc/infer/anon_types/mod.rs @@ -147,7 +147,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// Let's work through an example to explain how it works. Assume /// the current function is as follows: /// - /// fn foo<'a, 'b>(..) -> (impl Bar<'a>, impl Bar<'b>) + /// ```text + /// fn foo<'a, 'b>(..) -> (impl Bar<'a>, impl Bar<'b>) + /// ``` /// /// Here, we have two `impl Trait` types whose values are being /// inferred (the `impl Bar<'a>` and the `impl @@ -155,13 +157,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// define underlying abstract types (`Foo1`, `Foo2`) and then, in /// the return type of `foo`, we *reference* those definitions: /// - /// abstract type Foo1<'x>: Bar<'x>; - /// abstract type Foo2<'x>: Bar<'x>; - /// fn foo<'a, 'b>(..) -> (Foo1<'a>, Foo2<'b>) { .. } - /// // ^^^^ ^^ - /// // | | - /// // | substs - /// // def_id + /// ```text + /// abstract type Foo1<'x>: Bar<'x>; + /// abstract type Foo2<'x>: Bar<'x>; + /// fn foo<'a, 'b>(..) -> (Foo1<'a>, Foo2<'b>) { .. } + /// // ^^^^ ^^ + /// // | | + /// // | substs + /// // def_id + /// ``` /// /// As indicating in the comments above, each of those references /// is (in the compiler) basically a substitution (`substs`) @@ -175,8 +179,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// `Foo2`. That is, this gives rise to higher-order (pattern) unification /// constraints like: /// - /// for<'a> (Foo1<'a> = C1) - /// for<'b> (Foo1<'b> = C2) + /// ```text + /// for<'a> (Foo1<'a> = C1) + /// for<'b> (Foo1<'b> = C2) + /// ``` /// /// For these equation to be satisfiable, the types `C1` and `C2` /// can only refer to a limited set of regions. For example, `C1` @@ -189,15 +195,19 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// regions. In fact, it is fairly likely that they do! Consider /// this possible definition of `foo`: /// - /// fn foo<'a, 'b>(x: &'a i32, y: &'b i32) -> (impl Bar<'a>, impl Bar<'b>) { + /// ```text + /// fn foo<'a, 'b>(x: &'a i32, y: &'b i32) -> (impl Bar<'a>, impl Bar<'b>) { /// (&*x, &*y) /// } + /// ``` /// /// Here, the values for the concrete types of the two impl /// traits will include inference variables: /// - /// &'0 i32 - /// &'1 i32 + /// ```text + /// &'0 i32 + /// &'1 i32 + /// ``` /// /// Ordinarily, the subtyping rules would ensure that these are /// sufficiently large. But since `impl Bar<'a>` isn't a specific @@ -207,7 +217,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// inferred type are regions that could validly appear. /// /// This is actually a bit of a tricky constraint in general. We - /// want to say that each variable (e.g., `'0``) can only take on + /// want to say that each variable (e.g., `'0`) can only take on /// values that were supplied as arguments to the abstract type /// (e.g., `'a` for `Foo1<'a>`) or `'static`, which is always in /// 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> { /// /// In some cases, there is no minimum. Consider this example: /// - /// fn baz<'a, 'b>() -> impl Trait<'a, 'b> { ... } + /// ```text + /// fn baz<'a, 'b>() -> impl Trait<'a, 'b> { ... } + /// ``` /// /// Here we would report an error, because `'a` and `'b` have no /// relation to one another. @@ -245,8 +257,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// which is the current function. It also means that we can /// take "implied bounds" into account in some cases: /// - /// trait SomeTrait<'a, 'b> { } - /// fn foo<'a, 'b>(_: &'a &'b u32) -> impl SomeTrait<'a, 'b> { .. } + /// ```text + /// trait SomeTrait<'a, 'b> { } + /// fn foo<'a, 'b>(_: &'a &'b u32) -> impl SomeTrait<'a, 'b> { .. } + /// ``` /// /// Here, the fact that `'b: 'a` is known only because of the /// implied bounds from the `&'a &'b u32` parameter, and is not diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index d3aa80e5585..049bf4470cb 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -53,9 +53,9 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher, /// expression for the indexed statement, until the end of the block. /// /// So: the following code can be broken down into the scopes beneath: -/// ``` +/// +/// ```text /// let a = f().g( 'b: { let x = d(); let y = d(); x.h(y) } ) ; -/// ``` /// /// +-+ (D12.) /// +-+ (D11.) @@ -82,6 +82,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher, /// (R10.): Remainder scope for block `'b:`, stmt 1 (let y = ...). /// (D11.): DestructionScope for temporaries and bindings from block `'b:`. /// (D12.): DestructionScope for temporaries created during M1 (e.g. f()). +/// ``` /// /// Note that while the above picture shows the destruction scopes /// as following their corresponding node scopes, in the internal diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index c52be9caa4f..3aa94b34699 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -497,6 +497,7 @@ pub struct LocalDecl<'tcx> { /// /// That's it, if we have a let-statement like the one in this /// function: + /// /// ``` /// fn foo(x: &str) { /// #[allow(unused_mut)] @@ -540,6 +541,7 @@ pub struct LocalDecl<'tcx> { /// /// The end result looks like this: /// + /// ```text /// ROOT SCOPE /// │{ argument x: &str } /// │ @@ -559,6 +561,7 @@ pub struct LocalDecl<'tcx> { /// │ │{ let x: u32 } /// │ │← x.source_info.scope /// │ │← `drop(x)` // this accesses `x: u32` + /// ``` pub syntactic_scope: VisibilityScope, } diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index e70de0e566e..6482ecc7ee1 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -906,6 +906,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { /// For defaulted traits, we use a co-inductive strategy to solve, so /// that recursion is ok. This routine returns true if the top of the /// stack (`cycle[0]`): + /// /// - is a defaulted trait, and /// - it also appears in the backtrace at some position `X`; and, /// - all the predicates at positions `X..` between `X` an the top are diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index 349d77cfc1b..6df6bb9df23 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -22,38 +22,38 @@ use ty::subst::Substs; /// Here are some common scenarios: /// /// 1. The simplest cases are where a pointer is not adjusted fat vs thin. -/// Here the pointer will be dereferenced N times (where a dereference can -/// happen to raw or borrowed pointers or any smart pointer which implements -/// Deref, including Box<_>). The types of dereferences is given by -/// `autoderefs`. It can then be auto-referenced zero or one times, indicated -/// by `autoref`, to either a raw or borrowed pointer. In these cases unsize is -/// `false`. +/// Here the pointer will be dereferenced N times (where a dereference can +/// happen to raw or borrowed pointers or any smart pointer which implements +/// Deref, including Box<_>). The types of dereferences is given by +/// `autoderefs`. It can then be auto-referenced zero or one times, indicated +/// by `autoref`, to either a raw or borrowed pointer. In these cases unsize is +/// `false`. /// /// 2. A thin-to-fat coercion involves unsizing the underlying data. We start -/// with a thin pointer, deref a number of times, unsize the underlying data, -/// then autoref. The 'unsize' phase may change a fixed length array to a -/// dynamically sized one, a concrete object to a trait object, or statically -/// sized struct to a dynamically sized one. E.g., &[i32; 4] -> &[i32] is -/// represented by: +/// with a thin pointer, deref a number of times, unsize the underlying data, +/// then autoref. The 'unsize' phase may change a fixed length array to a +/// dynamically sized one, a concrete object to a trait object, or statically +/// sized struct to a dynamically sized one. E.g., &[i32; 4] -> &[i32] is +/// represented by: /// -/// ``` -/// Deref(None) -> [i32; 4], -/// Borrow(AutoBorrow::Ref) -> &[i32; 4], -/// Unsize -> &[i32], -/// ``` +/// ``` +/// Deref(None) -> [i32; 4], +/// Borrow(AutoBorrow::Ref) -> &[i32; 4], +/// Unsize -> &[i32], +/// ``` /// -/// Note that for a struct, the 'deep' unsizing of the struct is not recorded. -/// E.g., `struct Foo { x: T }` we can coerce &Foo<[i32; 4]> to &Foo<[i32]> -/// The autoderef and -ref are the same as in the above example, but the type -/// stored in `unsize` is `Foo<[i32]>`, we don't store any further detail about -/// the underlying conversions from `[i32; 4]` to `[i32]`. +/// Note that for a struct, the 'deep' unsizing of the struct is not recorded. +/// E.g., `struct Foo { x: T }` we can coerce &Foo<[i32; 4]> to &Foo<[i32]> +/// The autoderef and -ref are the same as in the above example, but the type +/// stored in `unsize` is `Foo<[i32]>`, we don't store any further detail about +/// the underlying conversions from `[i32; 4]` to `[i32]`. /// /// 3. Coercing a `Box` to `Box` is an interesting special case. In -/// that case, we have the pointer we need coming in, so there are no -/// autoderefs, and no autoref. Instead we just do the `Unsize` transformation. -/// At some point, of course, `Box` should move out of the compiler, in which -/// case this is analogous to transforming a struct. E.g., Box<[i32; 4]> -> -/// Box<[i32]> is an `Adjust::Unsize` with the target `Box<[i32]>`. +/// that case, we have the pointer we need coming in, so there are no +/// autoderefs, and no autoref. Instead we just do the `Unsize` transformation. +/// At some point, of course, `Box` should move out of the compiler, in which +/// case this is analogous to transforming a struct. E.g., Box<[i32; 4]> -> +/// Box<[i32]> is an `Adjust::Unsize` with the target `Box<[i32]>`. #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Adjustment<'tcx> { pub kind: Adjust<'tcx>, diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 5b87273194c..63bf52a9bdf 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -28,7 +28,7 @@ pub enum InstanceDef<'tcx> { Item(DefId), Intrinsic(DefId), - /// ::call_* + /// \::call_* /// def-id is FnTrait::call_* FnPtrShim(DefId, Ty<'tcx>), diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 017b16e4126..2a8c259dff8 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -340,8 +340,8 @@ impl AddAssign for Size { /// Alignment of a type in bytes, both ABI-mandated and preferred. /// Each field is a power of two, giving the alignment a maximum -/// value of 2^(2^8 - 1), which is limited by LLVM to a i32, with -/// a maximum capacity of 2^31 - 1 or 2147483647. +/// value of 2(28 - 1), which is limited by LLVM to a i32, with +/// a maximum capacity of 231 - 1 or 2147483647. #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub struct Align { abi: u8, @@ -651,11 +651,13 @@ impl Scalar { } /// The first half of a fat pointer. +/// /// - For a trait object, this is the address of the box. /// - For a slice, this is the base address. pub const FAT_PTR_ADDR: usize = 0; /// The second half of a fat pointer. +/// /// - For a trait object, this is the address of the vtable. /// - For a slice, this is the length. pub const FAT_PTR_EXTRA: usize = 1; diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 12e5451f83c..2cea8c01cdf 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1098,8 +1098,8 @@ pub type PolySubtypePredicate<'tcx> = ty::Binder>; /// In particular, form #1 is "desugared" to the combination of a /// normal trait predicate (`T : TraitRef<...>`) and one of these /// predicates. Form #2 is a broader form in that it also permits -/// equality between arbitrary types. Processing an instance of Form -/// #2 eventually yields one of these `ProjectionPredicate` +/// equality between arbitrary types. Processing an instance of +/// Form #2 eventually yields one of these `ProjectionPredicate` /// instances to normalize the LHS. #[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct ProjectionPredicate<'tcx> { @@ -1401,7 +1401,7 @@ bitflags! { /// fields/variants) and as such, whether downstream crates must match exhaustively on the /// fields/variants of this data type. /// - /// See RFC 2008 (https://github.com/rust-lang/rfcs/pull/2008). + /// See RFC 2008 (). const IS_NON_EXHAUSTIVE = 1 << 5; } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 04477b82f29..433c72f4b2c 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -673,6 +673,7 @@ impl Binder { /// accounting. /// /// Some examples where `skip_binder` is reasonable: + /// /// - extracting the def-id from a PolyTraitRef; /// - comparing the self type of a PolyTraitRef to see if it is equal to /// a type parameter `X`, since the type `X` does not reference any regions @@ -992,8 +993,8 @@ pub type Region<'tcx> = &'tcx RegionKind; /// happen, you can use `leak_check`. This is more clearly explained /// by infer/higher_ranked/README.md. /// -/// [1] http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ -/// [2] http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ +/// [1]: http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ +/// [2]: http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ #[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)] pub enum RegionKind { // Region bound in a type or fn declaration which will be diff --git a/src/librustc_apfloat/ieee.rs b/src/librustc_apfloat/ieee.rs index 124c840cc56..3e76b60b84a 100644 --- a/src/librustc_apfloat/ieee.rs +++ b/src/librustc_apfloat/ieee.rs @@ -65,11 +65,11 @@ pub trait Semantics: Sized { /// Number of bits in the significand. This includes the integer bit. const PRECISION: usize; - /// The largest E such that 2^E is representable; this matches the + /// The largest E such that 2E is representable; this matches the /// definition of IEEE 754. const MAX_EXP: ExpInt; - /// The smallest E such that 2^E is a normalized number; this + /// The smallest E such that 2E is a normalized number; this /// matches the definition of IEEE 754. const MIN_EXP: ExpInt = -Self::MAX_EXP + 1; @@ -2608,7 +2608,7 @@ mod sig { /// /// `(n - 1) * (n - 1) + 2 * (n - 1) == (n - 1) * (n + 1)` /// - /// which is less than n^2. + /// which is less than n2. pub(super) fn widening_mul(a: Limb, b: Limb) -> [Limb; 2] { let mut wide = [0, 0]; diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index 7dea3dae0bc..3afc2f68400 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -10,7 +10,8 @@ //! Port of LLVM's APFloat software floating-point implementation from the //! following C++ sources (please update commit hash when backporting): -//! https://github.com/llvm-mirror/llvm/tree/23efab2bbd424ed13495a420ad8641cb2c6c28f9 +//! +//! //! * `include/llvm/ADT/APFloat.h` -> `Float` and `FloatConvert` traits //! * `lib/Support/APFloat.cpp` -> `ieee` and `ppc` modules //! * `unittests/ADT/APFloatTest.cpp` -> `tests` directory @@ -221,8 +222,8 @@ pub struct ParseError(pub &'static str); /// /// `apfloat` does not provide any exception handling beyond default exception /// handling. We represent Signaling NaNs via IEEE-754R 2008 6.2.1 should clause -/// by encoding Signaling NaNs with the first bit of its trailing significand as -/// 0. +/// by encoding Signaling NaNs with the first bit of its trailing significand +/// as 0. /// /// Future work /// =========== @@ -259,11 +260,11 @@ pub trait Float /// Number of bits in the significand. This includes the integer bit. const PRECISION: usize; - /// The largest E such that 2^E is representable; this matches the + /// The largest E such that 2E is representable; this matches the /// definition of IEEE 754. const MAX_EXP: ExpInt; - /// The smallest E such that 2^E is a normalized number; this + /// The smallest E such that 2E is a normalized number; this /// matches the definition of IEEE 754. const MIN_EXP: ExpInt; @@ -571,7 +572,7 @@ pub trait Float /// fn ilogb(self) -> ExpInt; - /// Returns: self * 2^exp for integral exponents. + /// Returns: self * 2exp for integral exponents. fn scalbn_r(self, exp: ExpInt, round: Round) -> Self; fn scalbn(self, exp: ExpInt) -> Self { self.scalbn_r(exp, Round::NearestTiesToEven) diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 202e0948541..6fcdedfb340 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -367,7 +367,7 @@ pub struct TargetOptions { /// Whether the linker support GNU-like arguments such as -O. Defaults to false. pub linker_is_gnu: bool, /// The MinGW toolchain has a known issue that prevents it from correctly - /// handling COFF object files with more than 2^15 sections. Since each weak + /// handling COFF object files with more than 215 sections. Since each weak /// symbol needs its own COMDAT section, weak linkage implies a large /// number sections that easily exceeds the given limit for larger /// codebases. Consequently we want a way to disallow weak linkage on some diff --git a/src/librustc_data_structures/control_flow_graph/dominators/mod.rs b/src/librustc_data_structures/control_flow_graph/dominators/mod.rs index 90670517f59..dc487f1162c 100644 --- a/src/librustc_data_structures/control_flow_graph/dominators/mod.rs +++ b/src/librustc_data_structures/control_flow_graph/dominators/mod.rs @@ -12,7 +12,7 @@ //! A Simple, Fast Dominance Algorithm. //! Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy //! Rice Computer Science TS-06-33870 -//! https://www.cs.rice.edu/~keith/EMBED/dom.pdf +//! use super::ControlFlowGraph; use super::iterate::reverse_post_order; diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 10fa379924b..e9a8c2427b3 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -149,7 +149,7 @@ //! The binary of a crate will not only contain machine code for the items //! defined in the source code of that crate. It will also contain monomorphic //! instantiations of any extern generic functions and of functions marked with -//! #[inline]. +//! `#[inline]`. //! The collection algorithm handles this more or less mono. If it is //! about to create a mono item for something with an external `DefId`, //! it will take a look if the MIR for that item is available, and if so just diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 55c194ae7a5..996195800ce 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -94,7 +94,7 @@ //! inlined, so it can distribute function instantiations accordingly. Since //! there is no way of knowing for sure which functions LLVM will decide to //! inline in the end, we apply a heuristic here: Only functions marked with -//! #[inline] are considered for inlining by the partitioner. The current +//! `#[inline]` are considered for inlining by the partitioner. The current //! implementation will not try to determine if a function is likely to be //! inlined by looking at the functions definition. //! diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index e0f14c04c6c..15682b2d459 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1543,7 +1543,7 @@ pub enum TraitObjectSyntax { /// Inline assembly dialect. /// -/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`` +/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")` #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum AsmDialect { Att, @@ -1552,7 +1552,7 @@ pub enum AsmDialect { /// Inline assembly. /// -/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`` +/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")` #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct InlineAsmOutput { pub constraint: Symbol, diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 2f3e2b66113..129defd2093 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -391,6 +391,7 @@ impl CodeMap { /// Returns `Some(span)`, a union of the lhs and rhs span. The lhs must precede the rhs. If /// there are gaps between lhs and rhs, the resulting union will cross these gaps. /// For this to work, the spans have to be: + /// /// * the ctxt of both spans much match /// * the lhs span needs to end on the same line the rhs span begins /// * the lhs span must start at or before the rhs span diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index be71d6e038c..0d3be28ffef 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -776,7 +776,8 @@ impl<'a> ExtCtxt<'a> { /// Emit `msg` attached to `sp`, and stop compilation immediately. /// /// `span_err` should be strongly preferred where-ever possible: - /// this should *only* be used when + /// this should *only* be used when: + /// /// - continuing has a high risk of flow-on errors (e.g. errors in /// declaring a macro would cause all uses of that macro to /// complain about "undefined macro"), or diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c5de0da0979..e5ef9393e7b 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -63,9 +63,9 @@ macro_rules! declare_features { /// A set of features to be used by later passes. pub struct Features { - /// #![feature] attrs for stable language features, for error reporting + /// `#![feature]` attrs for stable language features, for error reporting pub declared_stable_lang_features: Vec<(Symbol, Span)>, - /// #![feature] attrs for non-language (library) features + /// `#![feature]` attrs for non-language (library) features pub declared_lib_features: Vec<(Symbol, Span)>, $(pub $feature: bool),+ } diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index 55342c2768a..06a9306501c 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -10,10 +10,10 @@ //! Machinery for hygienic macros, inspired by the MTWT[1] paper. //! -//! [1] Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. -//! 2012. *Macros that work together: Compile-time bindings, partial expansion, +//! [1] Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. 2012. +//! *Macros that work together: Compile-time bindings, partial expansion, //! and definition contexts*. J. Funct. Program. 22, 2 (March 2012), 181-216. -//! DOI=10.1017/S0956796812000093 http://dx.doi.org/10.1017/S0956796812000093 +//! DOI=10.1017/S0956796812000093 use Span; use symbol::{Ident, Symbol}; @@ -224,6 +224,7 @@ impl SyntaxContext { /// Adjust this context for resolution in a scope created by the given expansion. /// For example, consider the following three resolutions of `f`: + /// /// ```rust /// mod foo { pub fn f() {} } // `f`'s `SyntaxContext` is empty. /// m!(f); @@ -255,7 +256,8 @@ impl SyntaxContext { /// Adjust this context for resolution in a scope created by the given expansion /// via a glob import with the given `SyntaxContext`. - /// For example, + /// For example: + /// /// ```rust /// m!(f); /// macro m($i:ident) { @@ -293,6 +295,7 @@ impl SyntaxContext { } /// Undo `glob_adjust` if possible: + /// /// ```rust /// if let Some(privacy_checking_scope) = self.reverse_glob_adjust(expansion, glob_ctxt) { /// assert!(self.glob_adjust(expansion, glob_ctxt) == Some(privacy_checking_scope)); diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index f04394f7166..9f8b4a73d0c 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -53,13 +53,13 @@ pub trait Stats { /// Arithmetic mean (average) of the samples: sum divided by sample-count. /// - /// See: https://en.wikipedia.org/wiki/Arithmetic_mean + /// See: fn mean(&self) -> f64; /// Median of the samples: value separating the lower half of the samples from the higher half. /// Equal to `self.percentile(50.0)`. /// - /// See: https://en.wikipedia.org/wiki/Median + /// See: fn median(&self) -> f64; /// Variance of the samples: bias-corrected mean of the squares of the differences of each @@ -68,7 +68,7 @@ pub trait Stats { /// bias that would appear if we calculated a population variance, by dividing by `(n-1)` rather /// than `n`. /// - /// See: https://en.wikipedia.org/wiki/Variance + /// See: fn var(&self) -> f64; /// Standard deviation: the square root of the sample variance. @@ -76,7 +76,7 @@ pub trait Stats { /// Note: this is not a robust statistic for non-normal distributions. Prefer the /// `median_abs_dev` for unknown distributions. /// - /// See: https://en.wikipedia.org/wiki/Standard_deviation + /// See: fn std_dev(&self) -> f64; /// Standard deviation as a percent of the mean value. See `std_dev` and `mean`. @@ -91,7 +91,7 @@ pub trait Stats { /// by the constant `1.4826` to allow its use as a consistent estimator for the standard /// deviation. /// - /// See: http://en.wikipedia.org/wiki/Median_absolute_deviation + /// See: fn median_abs_dev(&self) -> f64; /// Median absolute deviation as a percent of the median. See `median_abs_dev` and `median`. @@ -103,7 +103,7 @@ pub trait Stats { /// /// Calculated by linear interpolation between closest ranks. /// - /// See: http://en.wikipedia.org/wiki/Percentile + /// See: fn percentile(&self, pct: f64) -> f64; /// Quartiles of the sample: three values that divide the sample into four equal groups, each @@ -111,13 +111,13 @@ pub trait Stats { /// function may calculate the 3 quartiles more efficiently than 3 calls to `percentile`, but /// is otherwise equivalent. /// - /// See also: https://en.wikipedia.org/wiki/Quartile + /// See also: fn quartiles(&self) -> (f64, f64, f64); /// Inter-quartile range: the difference between the 25th percentile (1st quartile) and the 75th /// percentile (3rd quartile). See `quartiles`. /// - /// See also: https://en.wikipedia.org/wiki/Interquartile_range + /// See also: fn iqr(&self) -> f64; } @@ -311,7 +311,7 @@ fn percentile_of_sorted(sorted_samples: &[f64], pct: f64) -> f64 { /// It differs from trimming in that it does not change the number of samples, /// just changes the values of those that are outliers. /// -/// See: http://en.wikipedia.org/wiki/Winsorising +/// See: pub fn winsorize(samples: &mut [f64], pct: f64) { let mut tmp = samples.to_vec(); local_sort(&mut tmp);