Navigation Menu

Skip to content

Commit

Permalink
Minor cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Regueiro committed Dec 26, 2018
1 parent 87532e9 commit ab239f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/librustc_typeck/check/_match.rs
Expand Up @@ -275,7 +275,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
PatKind::Tuple(ref elements, ddpos) => {
let mut expected_len = elements.len();
if ddpos.is_some() {
// Require known type only when `..` is present
// Require known type only when `..` is present.
if let ty::Tuple(ref tys) =
self.structurally_resolved_type(pat.span, expected).sty {
expected_len = tys.len();
Expand All @@ -284,8 +284,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let max_len = cmp::max(expected_len, elements.len());

let element_tys_iter = (0..max_len).map(|_| self.next_ty_var(
// FIXME: MiscVariable for now, obtaining the span and name information
// from all tuple elements isn't trivial.
// FIXME: `MiscVariable` for now -- obtaining the span and name information
// from all tuple elements isn't trivial.
TypeVariableOrigin::TypeInference(pat.span)));
let element_tys = tcx.mk_type_list(element_tys_iter);
let pat_ty = tcx.mk_ty(ty::Tuple(element_tys));
Expand Down
13 changes: 7 additions & 6 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -4615,7 +4615,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
local: &'gcx hir::Local,
init: &'gcx hir::Expr) -> Ty<'tcx>
{
// FIXME(tschottdorf): contains_explicit_ref_binding() must be removed
// FIXME(tschottdorf): `contains_explicit_ref_binding()` must be removed
// for #42640 (default match binding modes).
//
// See #44848.
Expand Down Expand Up @@ -4660,7 +4660,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}

pub fn check_stmt(&self, stmt: &'gcx hir::Stmt) {
// Don't do all the complex logic below for DeclItem.
// Don't do all the complex logic below for `DeclItem`.
match stmt.node {
hir::StmtKind::Decl(ref decl, _) => {
if let hir::DeclKind::Item(_) = decl.node {
Expand All @@ -4672,7 +4672,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {

self.warn_if_unreachable(stmt.node.id(), stmt.span, "statement");

// Hide the outer diverging and has_errors flags.
// Hide the outer diverging and `has_errors` flags.
let old_diverges = self.diverges.get();
let old_has_errors = self.has_errors.get();
self.diverges.set(Diverges::Maybe);
Expand All @@ -4684,19 +4684,20 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
hir::DeclKind::Local(ref l) => {
self.check_decl_local(&l);
}
hir::DeclKind::Item(_) => {/* ignore for now */}
// Ignore for now.
hir::DeclKind::Item(_) => ()
}
}
hir::StmtKind::Expr(ref expr, _) => {
// Check with expected type of ()
// Check with expected type of `()`.
self.check_expr_has_type_or_error(&expr, self.tcx.mk_unit());
}
hir::StmtKind::Semi(ref expr, _) => {
self.check_expr(&expr);
}
}

// Combine the diverging and has_error flags.
// Combine the diverging and `has_error` flags.
self.diverges.set(self.diverges.get() | old_diverges);
self.has_errors.set(self.has_errors.get() | old_has_errors);
}
Expand Down

0 comments on commit ab239f3

Please sign in to comment.