Skip to content

Commit f11759d

Browse files
committed
Auto merge of #66610 - alexreg:trait-upcasting-cosmetic, r=Centril
Aggregation of drive-by cosmetic changes for trait-upcasting PR Cherry-picked from #60900. As requested by @Centril (and @nikomatsakis, I believe). r? @Centril
2 parents 53712f8 + 1b2de17 commit f11759d

File tree

40 files changed

+646
-638
lines changed

40 files changed

+646
-638
lines changed

src/librustc/hir/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1919,8 +1919,9 @@ pub enum ImplItemKind {
19191919
/// Bindings like `A: Debug` are represented as a special type `A =
19201920
/// $::Debug` that is understood by the astconv code.
19211921
///
1922-
/// FIXME(alexreg) -- why have a separate type for the binding case,
1923-
/// wouldn't it be better to make the `ty` field an enum like:
1922+
/// FIXME(alexreg): why have a separate type for the binding case,
1923+
/// wouldn't it be better to make the `ty` field an enum like the
1924+
/// following?
19241925
///
19251926
/// ```
19261927
/// enum TypeBindingKind {

src/librustc/infer/canonical/canonicalizer.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
306306
match *r {
307307
ty::ReLateBound(index, ..) => {
308308
if index >= self.binder_index {
309-
bug!("escaping late bound region during canonicalization")
309+
bug!("escaping late-bound region during canonicalization");
310310
} else {
311311
r
312312
}
@@ -336,7 +336,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
336336
.canonicalize_free_region(self, r),
337337

338338
ty::ReClosureBound(..) => {
339-
bug!("closure bound region encountered during canonicalization")
339+
bug!("closure bound region encountered during canonicalization");
340340
}
341341
}
342342
}
@@ -346,14 +346,14 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
346346
ty::Infer(ty::TyVar(vid)) => {
347347
debug!("canonical: type var found with vid {:?}", vid);
348348
match self.infcx.unwrap().probe_ty_var(vid) {
349-
// `t` could be a float / int variable: canonicalize that instead
349+
// `t` could be a float / int variable; canonicalize that instead.
350350
Ok(t) => {
351351
debug!("(resolved to {:?})", t);
352352
self.fold_ty(t)
353353
}
354354

355355
// `TyVar(vid)` is unresolved, track its universe index in the canonicalized
356-
// result
356+
// result.
357357
Err(mut ui) => {
358358
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
359359
// FIXME: perf problem described in #55921.

src/librustc/infer/error_reporting/mod.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,24 @@
4848
use super::lexical_region_resolve::RegionResolutionError;
4949
use super::region_constraints::GenericKind;
5050
use super::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TypeTrace, ValuePairs};
51-
use crate::infer::{self, SuppressRegionErrors};
5251

5352
use crate::hir;
5453
use crate::hir::def_id::DefId;
5554
use crate::hir::Node;
55+
use crate::infer::{self, SuppressRegionErrors};
5656
use crate::infer::opaque_types;
5757
use crate::middle::region;
58-
use crate::traits::{IfExpressionCause, MatchExpressionArmCause, ObligationCause};
59-
use crate::traits::{ObligationCauseCode};
58+
use crate::traits::{
59+
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
60+
};
6061
use crate::ty::error::TypeError;
6162
use crate::ty::{self, subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TypeFoldable};
63+
6264
use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
63-
use std::{cmp, fmt};
65+
use rustc_error_codes::*;
6466
use syntax_pos::{Pos, Span};
6567

66-
use rustc_error_codes::*;
68+
use std::{cmp, fmt};
6769

6870
mod note;
6971

@@ -1270,7 +1272,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12701272
}
12711273

12721274
/// When encountering a case where `.as_ref()` on a `Result` or `Option` would be appropriate,
1273-
/// suggest it.
1275+
/// suggests it.
12741276
fn suggest_as_ref_where_appropriate(
12751277
&self,
12761278
span: Span,

src/librustc/infer/outlives/obligations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
221221
}
222222

223223
/// The `TypeOutlives` struct has the job of "lowering" a `T: 'a`
224-
/// obligation into a series of `'a: 'b` constraints and "verifys", as
224+
/// obligation into a series of `'a: 'b` constraints and "verify"s, as
225225
/// described on the module comment. The final constraints are emitted
226226
/// via a "delegate" of type `D` -- this is usually the `infcx`, which
227227
/// accrues them into the `region_obligations` code, but for NLL we

src/librustc/mir/interpret/pointer.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use std::fmt::{self, Display};
2-
use std::convert::TryFrom;
1+
use super::{AllocId, InterpResult};
32

43
use crate::mir;
54
use crate::ty::layout::{self, HasDataLayout, Size};
5+
66
use rustc_macros::HashStable;
77

8-
use super::{AllocId, InterpResult};
8+
use std::convert::TryFrom;
9+
use std::fmt::{self, Display};
910

1011
/// Used by `check_in_alloc` to indicate context of check
1112
#[derive(Debug, Copy, Clone, RustcEncodable, RustcDecodable, HashStable)]
@@ -74,8 +75,8 @@ pub trait PointerArithmetic: layout::HasDataLayout {
7475
fn overflowing_signed_offset(&self, val: u64, i: i128) -> (u64, bool) {
7576
// FIXME: is it possible to over/underflow here?
7677
if i < 0 {
77-
// Trickery to ensure that i64::min_value() works fine: compute n = -i.
78-
// This formula only works for true negative values, it overflows for zero!
78+
// Trickery to ensure that `i64::min_value()` works fine: compute `n = -i`.
79+
// This formula only works for true negative values; it overflows for zero!
7980
let n = u64::max_value() - (i as u64) + 1;
8081
let res = val.overflowing_sub(n);
8182
self.truncate_to_ptr(res)
@@ -105,7 +106,7 @@ impl<T: layout::HasDataLayout> PointerArithmetic for T {}
105106
///
106107
/// Defaults to the index based and loosely coupled `AllocId`.
107108
///
108-
/// Pointer is also generic over the `Tag` associated with each pointer,
109+
/// `Pointer` is also generic over the `Tag` associated with each pointer,
109110
/// which is used to do provenance tracking during execution.
110111
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd,
111112
RustcEncodable, RustcDecodable, Hash, HashStable)]
@@ -129,7 +130,7 @@ impl<Id: fmt::Debug> fmt::Debug for Pointer<(), Id> {
129130
}
130131
}
131132

132-
/// Produces a `Pointer` which points to the beginning of the `Allocation`.
133+
/// Produces a `Pointer` that points to the beginning of the `Allocation`.
133134
impl From<AllocId> for Pointer {
134135
#[inline(always)]
135136
fn from(alloc_id: AllocId) -> Self {

src/librustc/session/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
12031203
force_frame_pointers: Option<bool> = (None, parse_opt_bool, [TRACKED],
12041204
"force use of the frame pointers"),
12051205
debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
1206-
"explicitly enable the cfg(debug_assertions) directive"),
1206+
"explicitly enable the `cfg(debug_assertions)` directive"),
12071207
inline_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
12081208
"set the threshold for inlining a function (default: 225)"),
12091209
panic: Option<PanicStrategy> = (None, parse_panic_strategy,

0 commit comments

Comments
 (0)