Skip to content

Commit

Permalink
tidy, and rename test file
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan-Fenner committed Jan 9, 2023
1 parent 8aa7fde commit 56e2593
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 71 deletions.
45 changes: 23 additions & 22 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Sometimes macros mess up the spans, so do not normalize the
// arg span to equal the error span, because that's less useful
// than pointing out the arg expr in the wrong context.
if normalized_span.source_equal(error_span) {
span
} else {
normalized_span
}
if normalized_span.source_equal(error_span) { span } else { normalized_span }
};

// Precompute the provided types and spans, since that's all we typically need for below
Expand Down Expand Up @@ -782,8 +778,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// can be collated pretty easily if needed.

// Next special case: if there is only one "Incompatible" error, just emit that
if let [Error::Invalid(provided_idx, expected_idx, Compatibility::Incompatible(Some(err)))] =
&errors[..]
if let [
Error::Invalid(provided_idx, expected_idx, Compatibility::Incompatible(Some(err))),
] = &errors[..]
{
let (formal_ty, expected_ty) = formal_and_expected_inputs[*expected_idx];
let (provided_ty, provided_arg_span) = provided_arg_tys[*provided_idx];
Expand Down Expand Up @@ -1525,21 +1522,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Our block must be a `assign desugar local; assignment`
if let Some(hir::Node::Block(hir::Block {
stmts:
[hir::Stmt {
kind:
hir::StmtKind::Local(hir::Local {
source: hir::LocalSource::AssignDesugar(_),
..
}),
..
}, hir::Stmt {
kind:
hir::StmtKind::Expr(hir::Expr {
kind: hir::ExprKind::Assign(..),
..
}),
..
}],
[
hir::Stmt {
kind:
hir::StmtKind::Local(hir::Local {
source:
hir::LocalSource::AssignDesugar(_),
..
}),
..
},
hir::Stmt {
kind:
hir::StmtKind::Expr(hir::Expr {
kind: hir::ExprKind::Assign(..),
..
}),
..
},
],
..
})) = self.tcx.hir().find(blk.hir_id)
{
Expand Down
Loading

0 comments on commit 56e2593

Please sign in to comment.