Skip to content

Aggregation of drive-by cosmetic changes for trait-upcasting PR #66610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1919,8 +1919,9 @@ pub enum ImplItemKind {
/// Bindings like `A: Debug` are represented as a special type `A =
/// $::Debug` that is understood by the astconv code.
///
/// FIXME(alexreg) -- why have a separate type for the binding case,
/// wouldn't it be better to make the `ty` field an enum like:
/// FIXME(alexreg): why have a separate type for the binding case,
/// wouldn't it be better to make the `ty` field an enum like the
/// following?
///
/// ```
/// enum TypeBindingKind {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
match *r {
ty::ReLateBound(index, ..) => {
if index >= self.binder_index {
bug!("escaping late bound region during canonicalization")
bug!("escaping late-bound region during canonicalization");
} else {
r
}
Expand Down Expand Up @@ -336,7 +336,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
.canonicalize_free_region(self, r),

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

// `TyVar(vid)` is unresolved, track its universe index in the canonicalized
// result
// result.
Err(mut ui) => {
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
// FIXME: perf problem described in #55921.
Expand Down
14 changes: 8 additions & 6 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,24 @@
use super::lexical_region_resolve::RegionResolutionError;
use super::region_constraints::GenericKind;
use super::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TypeTrace, ValuePairs};
use crate::infer::{self, SuppressRegionErrors};

use crate::hir;
use crate::hir::def_id::DefId;
use crate::hir::Node;
use crate::infer::{self, SuppressRegionErrors};
use crate::infer::opaque_types;
use crate::middle::region;
use crate::traits::{IfExpressionCause, MatchExpressionArmCause, ObligationCause};
use crate::traits::{ObligationCauseCode};
use crate::traits::{
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
};
use crate::ty::error::TypeError;
use crate::ty::{self, subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TypeFoldable};

use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
use std::{cmp, fmt};
use rustc_error_codes::*;
use syntax_pos::{Pos, Span};

use rustc_error_codes::*;
use std::{cmp, fmt};

mod note;

Expand Down Expand Up @@ -1249,7 +1251,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}

/// When encountering a case where `.as_ref()` on a `Result` or `Option` would be appropriate,
/// suggest it.
/// suggests it.
fn suggest_as_ref_where_appropriate(
&self,
span: Span,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
}

/// The `TypeOutlives` struct has the job of "lowering" a `T: 'a`
/// obligation into a series of `'a: 'b` constraints and "verifys", as
/// obligation into a series of `'a: 'b` constraints and "verify"s, as
/// described on the module comment. The final constraints are emitted
/// via a "delegate" of type `D` -- this is usually the `infcx`, which
/// accrues them into the `region_obligations` code, but for NLL we
Expand Down
15 changes: 8 additions & 7 deletions src/librustc/mir/interpret/pointer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::fmt::{self, Display};
use std::convert::TryFrom;
use super::{AllocId, InterpResult};

use crate::mir;
use crate::ty::layout::{self, HasDataLayout, Size};

use rustc_macros::HashStable;

use super::{AllocId, InterpResult};
use std::convert::TryFrom;
use std::fmt::{self, Display};

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

/// Produces a `Pointer` which points to the beginning of the `Allocation`.
/// Produces a `Pointer` that points to the beginning of the `Allocation`.
impl From<AllocId> for Pointer {
#[inline(always)]
fn from(alloc_id: AllocId) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
force_frame_pointers: Option<bool> = (None, parse_opt_bool, [TRACKED],
"force use of the frame pointers"),
debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
"explicitly enable the cfg(debug_assertions) directive"),
"explicitly enable the `cfg(debug_assertions)` directive"),
inline_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
"set the threshold for inlining a function (default: 225)"),
panic: Option<PanicStrategy> = (None, parse_panic_strategy,
Expand Down
Loading