Skip to content

Commit 16ef295

Browse files
author
Alexander Regueiro
committed
Accumulation of various drive-by cosmetic changes.
1 parent 589beb9 commit 16ef295

File tree

7 files changed

+45
-51
lines changed

7 files changed

+45
-51
lines changed

src/librustc/query/mod.rs

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ rustc_queries! {
168168
query predicates_defined_on(_: DefId)
169169
-> Lrc<ty::GenericPredicates<'tcx>> {}
170170

171-
/// Returns the predicates written explicit by the user.
171+
/// Returns the predicates written explicitly by the user.
172172
query explicit_predicates_of(_: DefId)
173173
-> Lrc<ty::GenericPredicates<'tcx>> {}
174174

@@ -216,17 +216,17 @@ rustc_queries! {
216216
_: DefId
217217
) -> Result<DtorckConstraint<'tcx>, NoSolution> {}
218218

219-
/// True if this is a const fn, use the `is_const_fn` to know whether your crate actually
220-
/// sees it as const fn (e.g., the const-fn-ness might be unstable and you might not have
221-
/// the feature gate active)
219+
/// Returns `true` if this is a const fn, use the `is_const_fn` to know whether your crate
220+
/// actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might
221+
/// not have the feature gate active).
222222
///
223223
/// **Do not call this function manually.** It is only meant to cache the base data for the
224224
/// `is_const_fn` function.
225225
query is_const_fn_raw(key: DefId) -> bool {
226226
desc { |tcx| "checking if item is const fn: `{}`", tcx.def_path_str(key) }
227227
}
228228

229-
/// Returns true if calls to the function may be promoted
229+
/// Returns `true` if calls to the function may be promoted.
230230
///
231231
/// This is either because the function is e.g., a tuple-struct or tuple-variant
232232
/// constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should
@@ -237,36 +237,34 @@ rustc_queries! {
237237

238238
query const_fn_is_allowed_fn_ptr(_: DefId) -> bool {}
239239

240-
/// True if this is a foreign item (i.e., linked via `extern { ... }`).
240+
/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
241241
query is_foreign_item(_: DefId) -> bool {}
242242

243243
/// Returns `Some(mutability)` if the node pointed to by `def_id` is a static item.
244244
query static_mutability(_: DefId) -> Option<hir::Mutability> {}
245245

246-
/// Get a map with the variance of every item; use `item_variance`
247-
/// instead.
246+
/// Gets a map with the variance of every item; use `item_variance` instead.
248247
query crate_variances(_: CrateNum) -> Lrc<ty::CrateVariancesMap<'tcx>> {
249248
desc { "computing the variances for items in this crate" }
250249
}
251250

252-
/// Maps from def-id of a type or region parameter to its
253-
/// (inferred) variance.
251+
/// Maps from def-ID of a type or region parameter to its (inferred) variance.
254252
query variances_of(_: DefId) -> &'tcx [ty::Variance] {}
255253
}
256254

257255
TypeChecking {
258-
/// Maps from def-id of a type to its (inferred) outlives.
256+
/// Maps from def-ID of a type to its (inferred) outlives.
259257
query inferred_outlives_crate(_: CrateNum)
260258
-> Lrc<ty::CratePredicatesMap<'tcx>> {
261259
desc { "computing the inferred outlives predicates for items in this crate" }
262260
}
263261
}
264262

265263
Other {
266-
/// Maps from an impl/trait def-id to a list of the def-ids of its items
264+
/// Maps from an impl/trait def-ID to a list of the def-ids of its items.
267265
query associated_item_def_ids(_: DefId) -> Lrc<Vec<DefId>> {}
268266

269-
/// Maps from a trait item to the trait item "descriptor"
267+
/// Maps from a trait item to the trait item "descriptor".
270268
query associated_item(_: DefId) -> ty::AssociatedItem {}
271269

272270
query impl_trait_ref(_: DefId) -> Option<ty::TraitRef<'tcx>> {}
@@ -276,7 +274,7 @@ rustc_queries! {
276274
}
277275

278276
TypeChecking {
279-
/// Maps a DefId of a type to a list of its inherent impls.
277+
/// Maps a def-ID of a type to a list of its inherent impls.
280278
/// Contains implementations of methods that are inherent to a type.
281279
/// Methods in these implementations don't need to be exported.
282280
query inherent_impls(_: DefId) -> Lrc<Vec<DefId>> {
@@ -300,7 +298,7 @@ rustc_queries! {
300298
desc { |tcx| "linting {}", key.describe_as_module(tcx) }
301299
}
302300

303-
/// Checks the attributes in the module
301+
/// Checks the attributes in the module.
304302
query check_mod_attrs(key: DefId) -> () {
305303
desc { |tcx| "checking attributes in {}", key.describe_as_module(tcx) }
306304
}
@@ -309,7 +307,7 @@ rustc_queries! {
309307
desc { |tcx| "checking for unstable API usage in {}", key.describe_as_module(tcx) }
310308
}
311309

312-
/// Checks the loops in the module
310+
/// Checks the loops in the module.
313311
query check_mod_loops(key: DefId) -> () {
314312
desc { |tcx| "checking loops in {}", key.describe_as_module(tcx) }
315313
}
@@ -338,7 +336,7 @@ rustc_queries! {
338336
desc { |tcx| "collecting item types in {}", key.describe_as_module(tcx) }
339337
}
340338

341-
/// Caches CoerceUnsized kinds for impls on custom types.
339+
/// Caches `CoerceUnsized` kinds for impls on custom types.
342340
query coerce_unsized_info(_: DefId)
343341
-> ty::adjustment::CoerceUnsizedInfo {}
344342
}
@@ -375,7 +373,7 @@ rustc_queries! {
375373
BorrowChecking {
376374
query borrowck(_: DefId) -> Lrc<BorrowCheckResult> {}
377375

378-
/// Borrow checks the function body. If this is a closure, returns
376+
/// Borrow-checks the function body. If this is a closure, returns
379377
/// additional requirements that the closure's creator must verify.
380378
query mir_borrowck(_: DefId) -> mir::BorrowCheckResult<'tcx> {}
381379
}
@@ -401,11 +399,11 @@ rustc_queries! {
401399
}
402400

403401
Other {
404-
/// Evaluate a constant without running sanity checks
402+
/// Evaluates a constant without running sanity checks.
405403
///
406404
/// **Do not use this** outside const eval. Const eval uses this to break query cycles
407405
/// during validation. Please add a comment to every use site explaining why using
408-
/// `const_eval` isn't sufficient
406+
/// `const_eval` isn't sufficient.
409407
query const_eval_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
410408
-> ConstEvalRawResult<'tcx> {
411409
no_force
@@ -660,12 +658,12 @@ rustc_queries! {
660658
}
661659

662660
Linking {
663-
// The DefIds of all non-generic functions and statics in the given crate
661+
// The `DefId`s of all non-generic functions and statics in the given crate
664662
// that can be reached from outside the crate.
665663
//
666664
// We expect this items to be available for being linked to.
667665
//
668-
// This query can also be called for LOCAL_CRATE. In this case it will
666+
// This query can also be called for `LOCAL_CRATE`. In this case it will
669667
// compute which items will be reachable to other crates, taking into account
670668
// the kind of crate that is currently compiled. Crates with only a
671669
// C interface have fewer reachable things.

src/librustc/traits/util.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,10 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
123123
// Predicates declared on the trait.
124124
let predicates = tcx.super_predicates_of(data.def_id());
125125

126-
let mut predicates: Vec<_> =
127-
predicates.predicates
128-
.iter()
129-
.map(|(p, _)| p.subst_supertrait(tcx, &data.to_poly_trait_ref()))
130-
.collect();
131-
126+
let mut predicates: Vec<_> = predicates.predicates
127+
.iter()
128+
.map(|(pred, _)| pred.subst_supertrait(tcx, &data.to_poly_trait_ref()))
129+
.collect();
132130
debug!("super_predicates: data={:?} predicates={:?}",
133131
data, predicates);
134132

@@ -150,8 +148,8 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> {
150148
// predicates.
151149
}
152150
ty::Predicate::Subtype(..) => {
153-
// Currently, we do not "elaborate" predicates like `X
154-
// <: Y`, though conceivably we might.
151+
// Currently, we do not "elaborate" predicates like `X <: Y`,
152+
// though conceivably we might.
155153
}
156154
ty::Predicate::Projection(..) => {
157155
// Nothing to elaborate in a projection predicate.

src/librustc/ty/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,25 +1075,25 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> {
10751075

10761076
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)]
10771077
pub enum Predicate<'tcx> {
1078-
/// Corresponds to `where Foo: Bar<A,B,C>`. `Foo` here would be
1078+
/// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
10791079
/// the `Self` type of the trait reference and `A`, `B`, and `C`
10801080
/// would be the type parameters.
10811081
Trait(PolyTraitPredicate<'tcx>),
10821082

1083-
/// where `'a: 'b`
1083+
/// `where 'a: 'b`
10841084
RegionOutlives(PolyRegionOutlivesPredicate<'tcx>),
10851085

1086-
/// where `T: 'a`
1086+
/// `where T: 'a`
10871087
TypeOutlives(PolyTypeOutlivesPredicate<'tcx>),
10881088

1089-
/// where `<T as TraitRef>::Name == X`, approximately.
1089+
/// `where <T as TraitRef>::Name == X`, approximately.
10901090
/// See the `ProjectionPredicate` struct for details.
10911091
Projection(PolyProjectionPredicate<'tcx>),
10921092

10931093
/// no syntax: `T` well-formed
10941094
WellFormed(Ty<'tcx>),
10951095

1096-
/// trait must be object-safe
1096+
/// Trait must be object-safe.
10971097
ObjectSafe(DefId),
10981098

10991099
/// No direct syntax. May be thought of as `where T: FnFoo<...>`

src/librustc/ty/query/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ pub use self::on_disk_cache::OnDiskCache;
100100

101101
rustc_query_append! { [define_queries!][ <'tcx>
102102
Other {
103-
/// Run analysis passes on the crate
103+
/// Runs analysis passes on the crate.
104104
[] fn analysis: Analysis(CrateNum) -> Result<(), ErrorReported>,
105-
106105
},
107106
]}

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,6 @@ enum StorageDeadOrDrop<'tcx> {
15021502
}
15031503

15041504
impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1505-
15061505
/// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure
15071506
/// is moved after being invoked.
15081507
///

src/librustc_typeck/astconv.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
702702
}
703703

704704
/// Instantiates the path for the given trait reference, assuming that it's
705-
/// bound to a valid trait type. Returns the def_id for the defining trait.
705+
/// bound to a valid trait type. Returns the def-ID for the defining trait.
706706
/// The type _cannot_ be a type other than a trait type.
707707
///
708708
/// 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 {
10351035
pred.skip_binder().ty.walk().any(|t| t == dummy_self);
10361036

10371037
// If the projection output contains `Self`, force the user to
1038-
// elaborate it explicitly to avoid a bunch of complexity.
1038+
// elaborate it explicitly to avoid a lot of complexity.
10391039
//
10401040
// The "classicaly useful" case is the following:
10411041
// ```
@@ -1044,14 +1044,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
10441044
// }
10451045
// ```
10461046
//
1047-
// Here, the user could theoretically write `dyn MyTrait<Output=X>`,
1047+
// Here, the user could theoretically write `dyn MyTrait<Output = X>`,
10481048
// but actually supporting that would "expand" to an infinitely-long type
1049-
// `fix $ τ → dyn MyTrait<MyOutput=X, Output=<τ as MyTrait>::MyOutput`.
1049+
// `fix $ τ → dyn MyTrait<MyOutput = X, Output = <τ as MyTrait>::MyOutput`.
10501050
//
1051-
// Instead, we force the user to write `dyn MyTrait<MyOutput=X, Output=X>`,
1051+
// Instead, we force the user to write `dyn MyTrait<MyOutput = X, Output = X>`,
10521052
// which is uglier but works. See the discussion in #56288 for alternatives.
10531053
if !references_self {
1054-
// Include projections defined on supertraits,
1054+
// Include projections defined on supertraits.
10551055
projection_bounds.push((pred, DUMMY_SP))
10561056
}
10571057
}
@@ -2138,7 +2138,7 @@ impl<'a, 'gcx, 'tcx> Bounds<'tcx> {
21382138
pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, param_ty: Ty<'tcx>)
21392139
-> Vec<(ty::Predicate<'tcx>, Span)>
21402140
{
2141-
// If it could be sized, and is, add the sized predicate.
2141+
// If it could be sized, and is, add the `Sized` predicate.
21422142
let sized_predicate = self.implicitly_sized.and_then(|span| {
21432143
tcx.lang_items().sized_trait().map(|sized| {
21442144
let trait_ref = ty::TraitRef {

src/librustc_typeck/collect.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,9 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad
684684
tcx.alloc_adt_def(def_id, kind, variants, repr)
685685
}
686686

687-
/// Ensures that the super-predicates of the trait with `DefId`
688-
/// trait_def_id are converted and stored. This also ensures that
689-
/// the transitive super-predicates are converted;
687+
/// Ensures that the super-predicates of the trait with a `DefId`
688+
/// of `trait_def_id` are converted and stored. This also ensures that
689+
/// the transitive super-predicates are converted.
690690
fn super_predicates_of<'a, 'tcx>(
691691
tcx: TyCtxt<'a, 'tcx, 'tcx>,
692692
trait_def_id: DefId,
@@ -707,14 +707,14 @@ fn super_predicates_of<'a, 'tcx>(
707707

708708
let icx = ItemCtxt::new(tcx, trait_def_id);
709709

710-
// Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo : Bar + Zed`.
710+
// Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo: Bar + Zed`.
711711
let self_param_ty = tcx.mk_self_type();
712712
let superbounds1 = compute_bounds(&icx, self_param_ty, bounds, SizedByDefault::No, item.span);
713713

714714
let superbounds1 = superbounds1.predicates(tcx, self_param_ty);
715715

716-
// Convert any explicit superbounds in the where clause,
717-
// e.g., `trait Foo where Self : Bar`.
716+
// Convert any explicit superbounds in the wheree-clause,
717+
// e.g., `trait Foo where Self: Bar`.
718718
// In the case of trait aliases, however, we include all bounds in the where clause,
719719
// so e.g., `trait Foo = where u32: PartialEq<Self>` would include `u32: PartialEq<Self>`
720720
// as one of its "superpredicates".

0 commit comments

Comments
 (0)