about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Regueiro <alexreg@me.com>2019-04-29 03:54:03 +0100
committerAlexander Regueiro <alexreg@me.com>2019-05-20 16:12:48 +0100
commit16ef2957705392abd6a7d9ac46619863ac339ef1 (patch)
tree7928600c47ef6cadee048ebea923fad52b1b89fa
parent589beb979c0f1a9736e02e578913db88398c3ba5 (diff)
downloadrust-16ef2957705392abd6a7d9ac46619863ac339ef1.tar.gz
rust-16ef2957705392abd6a7d9ac46619863ac339ef1.zip
Accumulation of various drive-by cosmetic changes.
-rw-r--r--src/librustc/query/mod.rs42
-rw-r--r--src/librustc/traits/util.rs14
-rw-r--r--src/librustc/ty/mod.rs10
-rw-r--r--src/librustc/ty/query/mod.rs3
-rw-r--r--src/librustc_mir/borrow_check/error_reporting.rs1
-rw-r--r--src/librustc_typeck/astconv.rs14
-rw-r--r--src/librustc_typeck/collect.rs12
7 files changed, 45 insertions, 51 deletions
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs
index 2fff4c3f109..d043a32f06b 100644
--- a/src/librustc/query/mod.rs
+++ b/src/librustc/query/mod.rs
@@ -168,7 +168,7 @@ rustc_queries! {
         query predicates_defined_on(_: DefId)
             -> Lrc<ty::GenericPredicates<'tcx>> {}
 
-        /// Returns the predicates written explicit by the user.
+        /// Returns the predicates written explicitly by the user.
         query explicit_predicates_of(_: DefId)
             -> Lrc<ty::GenericPredicates<'tcx>> {}
 
@@ -216,9 +216,9 @@ rustc_queries! {
             _: DefId
         ) -> Result<DtorckConstraint<'tcx>, NoSolution> {}
 
-        /// True if this is a const fn, use the `is_const_fn` to know whether your crate actually
-        /// sees it as const fn (e.g., the const-fn-ness might be unstable and you might not have
-        /// the feature gate active)
+        /// Returns `true` if this is a const fn, use the `is_const_fn` to know whether your crate
+        /// actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might
+        /// not have the feature gate active).
         ///
         /// **Do not call this function manually.** It is only meant to cache the base data for the
         /// `is_const_fn` function.
@@ -226,7 +226,7 @@ rustc_queries! {
             desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
         }
 
-        /// Returns true if calls to the function may be promoted
+        /// Returns `true` if calls to the function may be promoted.
         ///
         /// This is either because the function is e.g., a tuple-struct or tuple-variant
         /// constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should
@@ -237,25 +237,23 @@ rustc_queries! {
 
         query const_fn_is_allowed_fn_ptr(_: DefId) -> bool {}
 
-        /// True if this is a foreign item (i.e., linked via `extern { ... }`).
+        /// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
         query is_foreign_item(_: DefId) -> bool {}
 
         /// Returns `Some(mutability)` if the node pointed to by `def_id` is a static item.
         query static_mutability(_: DefId) -> Option<hir::Mutability> {}
 
-        /// Get a map with the variance of every item; use `item_variance`
-        /// instead.
+        /// Gets a map with the variance of every item; use `item_variance` instead.
         query crate_variances(_: CrateNum) -> Lrc<ty::CrateVariancesMap<'tcx>> {
             desc { "computing the variances for items in this crate" }
         }
 
-        /// Maps from def-id of a type or region parameter to its
-        /// (inferred) variance.
+        /// Maps from def-ID of a type or region parameter to its (inferred) variance.
         query variances_of(_: DefId) -> &'tcx [ty::Variance] {}
     }
 
     TypeChecking {
-        /// Maps from def-id of a type to its (inferred) outlives.
+        /// Maps from def-ID of a type to its (inferred) outlives.
         query inferred_outlives_crate(_: CrateNum)
             -> Lrc<ty::CratePredicatesMap<'tcx>> {
             desc { "computing the inferred outlives predicates for items in this crate" }
@@ -263,10 +261,10 @@ rustc_queries! {
     }
 
     Other {
-        /// Maps from an impl/trait def-id to a list of the def-ids of its items
+        /// Maps from an impl/trait def-ID to a list of the def-ids of its items.
         query associated_item_def_ids(_: DefId) -> Lrc<Vec<DefId>> {}
 
-        /// Maps from a trait item to the trait item "descriptor"
+        /// Maps from a trait item to the trait item "descriptor".
         query associated_item(_: DefId) -> ty::AssociatedItem {}
 
         query impl_trait_ref(_: DefId) -> Option<ty::TraitRef<'tcx>> {}
@@ -276,7 +274,7 @@ rustc_queries! {
     }
 
     TypeChecking {
-        /// Maps a DefId of a type to a list of its inherent impls.
+        /// Maps a def-ID of a type to a list of its inherent impls.
         /// Contains implementations of methods that are inherent to a type.
         /// Methods in these implementations don't need to be exported.
         query inherent_impls(_: DefId) -> Lrc<Vec<DefId>> {
@@ -300,7 +298,7 @@ rustc_queries! {
             desc { |tcx| "linting {}", key.describe_as_module(tcx) }
         }
 
-        /// Checks the attributes in the module
+        /// Checks the attributes in the module.
         query check_mod_attrs(key: DefId) -> () {
             desc { |tcx| "checking attributes in {}", key.describe_as_module(tcx) }
         }
@@ -309,7 +307,7 @@ rustc_queries! {
             desc { |tcx| "checking for unstable API usage in {}", key.describe_as_module(tcx) }
         }
 
-        /// Checks the loops in the module
+        /// Checks the loops in the module.
         query check_mod_loops(key: DefId) -> () {
             desc { |tcx| "checking loops in {}", key.describe_as_module(tcx) }
         }
@@ -338,7 +336,7 @@ rustc_queries! {
             desc { |tcx| "collecting item types in {}", key.describe_as_module(tcx) }
         }
 
-        /// Caches CoerceUnsized kinds for impls on custom types.
+        /// Caches `CoerceUnsized` kinds for impls on custom types.
         query coerce_unsized_info(_: DefId)
             -> ty::adjustment::CoerceUnsizedInfo {}
     }
@@ -375,7 +373,7 @@ rustc_queries! {
     BorrowChecking {
         query borrowck(_: DefId) -> Lrc<BorrowCheckResult> {}
 
-        /// Borrow checks the function body. If this is a closure, returns
+        /// Borrow-checks the function body. If this is a closure, returns
         /// additional requirements that the closure's creator must verify.
         query mir_borrowck(_: DefId) -> mir::BorrowCheckResult<'tcx> {}
     }
@@ -401,11 +399,11 @@ rustc_queries! {
     }
 
     Other {
-        /// Evaluate a constant without running sanity checks
+        /// Evaluates a constant without running sanity checks.
         ///
         /// **Do not use this** outside const eval. Const eval uses this to break query cycles
         /// during validation. Please add a comment to every use site explaining why using
-        /// `const_eval` isn't sufficient
+        /// `const_eval` isn't sufficient.
         query const_eval_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
             -> ConstEvalRawResult<'tcx> {
             no_force
@@ -660,12 +658,12 @@ rustc_queries! {
     }
 
     Linking {
-        // The DefIds of all non-generic functions and statics in the given crate
+        // The `DefId`s of all non-generic functions and statics in the given crate
         // that can be reached from outside the crate.
         //
         // We expect this items to be available for being linked to.
         //
-        // This query can also be called for LOCAL_CRATE. In this case it will
+        // This query can also be called for `LOCAL_CRATE`. In this case it will
         // compute which items will be reachable to other crates, taking into account
         // the kind of crate that is currently compiled. Crates with only a
         // C interface have fewer reachable things.
diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs
index be29ea5701b..578d8bbedf3 100644
--- a/src/librustc/traits/util.rs
+++ b/src/librustc/traits/util.rs
@@ -123,12 +123,10 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
                 // Predicates declared on the trait.
                 let predicates = tcx.super_predicates_of(data.def_id());
 
-                let mut predicates: Vec<_> =
-                    predicates.predicates
-                              .iter()
-                              .map(|(p, _)| p.subst_supertrait(tcx, &data.to_poly_trait_ref()))
-                              .collect();
-
+                let mut predicates: Vec<_> = predicates.predicates
+                    .iter()
+                    .map(|(pred, _)| pred.subst_supertrait(tcx, &data.to_poly_trait_ref()))
+                    .collect();
                 debug!("super_predicates: data={:?} predicates={:?}",
                        data, predicates);
 
@@ -150,8 +148,8 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
                 // predicates.
             }
             ty::Predicate::Subtype(..) => {
-                // Currently, we do not "elaborate" predicates like `X
-                // <: Y`, though conceivably we might.
+                // Currently, we do not "elaborate" predicates like `X <: Y`,
+                // though conceivably we might.
             }
             ty::Predicate::Projection(..) => {
                 // Nothing to elaborate in a projection predicate.
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index e1c432d5b6d..c55e508c8b5 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -1075,25 +1075,25 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
 
 #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)]
 pub enum Predicate<'tcx> {
-    /// Corresponds to `where Foo: Bar<A,B,C>`. `Foo` here would be
+    /// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
     /// the `Self` type of the trait reference and `A`, `B`, and `C`
     /// would be the type parameters.
     Trait(PolyTraitPredicate<'tcx>),
 
-    /// where `'a: 'b`
+    /// `where 'a: 'b`
     RegionOutlives(PolyRegionOutlivesPredicate<'tcx>),
 
-    /// where `T: 'a`
+    /// `where T: 'a`
     TypeOutlives(PolyTypeOutlivesPredicate<'tcx>),
 
-    /// where `<T as TraitRef>::Name == X`, approximately.
+    /// `where <T as TraitRef>::Name == X`, approximately.
     /// See the `ProjectionPredicate` struct for details.
     Projection(PolyProjectionPredicate<'tcx>),
 
     /// no syntax: `T` well-formed
     WellFormed(Ty<'tcx>),
 
-    /// trait must be object-safe
+    /// Trait must be object-safe.
     ObjectSafe(DefId),
 
     /// No direct syntax. May be thought of as `where T: FnFoo<...>`
diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs
index 18d575f7364..be52b7e6451 100644
--- a/src/librustc/ty/query/mod.rs
+++ b/src/librustc/ty/query/mod.rs
@@ -100,8 +100,7 @@ pub use self::on_disk_cache::OnDiskCache;
 
 rustc_query_append! { [define_queries!][ <'tcx>
     Other {
-        /// Run analysis passes on the crate
+        /// Runs analysis passes on the crate.
         [] fn analysis: Analysis(CrateNum) -> Result<(), ErrorReported>,
-
     },
 ]}
diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs
index 1a1000f0bb4..32d182edfdc 100644
--- a/src/librustc_mir/borrow_check/error_reporting.rs
+++ b/src/librustc_mir/borrow_check/error_reporting.rs
@@ -1502,7 +1502,6 @@ enum StorageDeadOrDrop<'tcx> {
 }
 
 impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
-
     /// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure
     /// is moved after being invoked.
     ///
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 4b052aec5fc..06605695630 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -702,7 +702,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
     }
 
     /// Instantiates the path for the given trait reference, assuming that it's
-    /// bound to a valid trait type. Returns the def_id for the defining trait.
+    /// bound to a valid trait type. Returns the def-ID for the defining trait.
     /// The type _cannot_ be a type other than a trait type.
     ///
     /// If the `projections` argument is `None`, then assoc type bindings like `Foo<T = X>`
@@ -1035,7 +1035,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
                         pred.skip_binder().ty.walk().any(|t| t == dummy_self);
 
                     // If the projection output contains `Self`, force the user to
-                    // elaborate it explicitly to avoid a bunch of complexity.
+                    // elaborate it explicitly to avoid a lot of complexity.
                     //
                     // The "classicaly useful" case is the following:
                     // ```
@@ -1044,14 +1044,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
                     //     }
                     // ```
                     //
-                    // Here, the user could theoretically write `dyn MyTrait<Output=X>`,
+                    // Here, the user could theoretically write `dyn MyTrait<Output = X>`,
                     // but actually supporting that would "expand" to an infinitely-long type
-                    // `fix $ τ → dyn MyTrait<MyOutput=X, Output=<τ as MyTrait>::MyOutput`.
+                    // `fix $ τ → dyn MyTrait<MyOutput = X, Output = <τ as MyTrait>::MyOutput`.
                     //
-                    // Instead, we force the user to write `dyn MyTrait<MyOutput=X, Output=X>`,
+                    // Instead, we force the user to write `dyn MyTrait<MyOutput = X, Output = X>`,
                     // which is uglier but works. See the discussion in #56288 for alternatives.
                     if !references_self {
-                        // Include projections defined on supertraits,
+                        // Include projections defined on supertraits.
                         projection_bounds.push((pred, DUMMY_SP))
                     }
                 }
@@ -2138,7 +2138,7 @@ impl<'a, 'gcx, 'tcx> Bounds<'tcx> {
     pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, param_ty: Ty<'tcx>)
                       -> Vec<(ty::Predicate<'tcx>, Span)>
     {
-        // If it could be sized, and is, add the sized predicate.
+        // If it could be sized, and is, add the `Sized` predicate.
         let sized_predicate = self.implicitly_sized.and_then(|span| {
             tcx.lang_items().sized_trait().map(|sized| {
                 let trait_ref = ty::TraitRef {
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 711d79f95f5..104c8e25d13 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -684,9 +684,9 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad
     tcx.alloc_adt_def(def_id, kind, variants, repr)
 }
 
-/// Ensures that the super-predicates of the trait with `DefId`
-/// trait_def_id are converted and stored. This also ensures that
-/// the transitive super-predicates are converted;
+/// Ensures that the super-predicates of the trait with a `DefId`
+/// of `trait_def_id` are converted and stored. This also ensures that
+/// the transitive super-predicates are converted.
 fn super_predicates_of<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     trait_def_id: DefId,
@@ -707,14 +707,14 @@ fn super_predicates_of<'a, 'tcx>(
 
     let icx = ItemCtxt::new(tcx, trait_def_id);
 
-    // Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo : Bar + Zed`.
+    // Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo: Bar + Zed`.
     let self_param_ty = tcx.mk_self_type();
     let superbounds1 = compute_bounds(&icx, self_param_ty, bounds, SizedByDefault::No, item.span);
 
     let superbounds1 = superbounds1.predicates(tcx, self_param_ty);
 
-    // Convert any explicit superbounds in the where clause,
-    // e.g., `trait Foo where Self : Bar`.
+    // Convert any explicit superbounds in the wheree-clause,
+    // e.g., `trait Foo where Self: Bar`.
     // In the case of trait aliases, however, we include all bounds in the where clause,
     // so e.g., `trait Foo = where u32: PartialEq<Self>` would include `u32: PartialEq<Self>`
     // as one of its "superpredicates".